This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run dev- Start development server with hot reloadnpm run build- Build the application for productionnpm run typecheck- Run TypeScript type checking for both main and renderer processesnpm run lint- Run ESLintnpm run format- Format code with Prettiernpm run build:win- Build Windows executablenpm run build:mac- Build macOS executablenpm run build:linux- Build Linux executable
LazyBox is an Electron-based desktop Markdown editor, forked from doocs/md. The app uses a multi-process Electron architecture:
- Main Process (
src/main/) - Node.js environment, handles window management, file system operations, and IPC - Preload (
src/preload/) - Bridge between main and renderer, exposes safe APIs viacontextBridge - Renderer Process (
src/renderer/) - Vue 3 application with Pinia state management
All file operations and system calls go through IPC handlers defined in src/main/ipc.ts. The preload script (src/preload/index.ts) exposes these as window.$api with two API sets:
- Legacy API - Single-file operations (
addPost,renamePost,removePost, etc.) - New API - Workspace-based file tree operations (
createFile,readDirectoryTree,moveFileOrFolder, etc.)
The app uses a workspace-based file management system:
- Workspace Store (
src/renderer/src/stores/workspace.ts) - Manages multiple workspaces, tracks current/recent workspaces, persists to localStorage - File Tree Store (
src/renderer/src/stores/fileTree.ts) - Handles file tree loading, file/folder CRUD operations - Local File Operations (
src/main/local.ts) - Main process file system utilities withdefaultAppDir = ~/documents/codes/LazyBox
App.vue conditionally renders based on workspace state:
Welcome.vue- Shown when no workspace is open (workspace selection screen)CodemirrorEditor.vue- Main editor when a workspace is active
The renderer system (src/renderer/src/utils/renderer.ts) uses:
markedfor Markdown parsinghighlight.jsfor code syntax highlightingmermaidfor diagram renderingDOMPurifyfor sanitization- Custom theme system with CSS-in-JS styling
Theme customization flows through:
- Base theme definitions in
@renderer/config/theme.ts - CSS editor (
CssEditor.vue) for user custom CSS renderer.tscombines theme + custom CSS + applies to rendered output
- Main Store (
src/renderer/src/stores/index.ts) - Editor state, theme settings, CSS configuration - Workspace Store - Workspace CRUD, recent workspaces tracking
- File Tree Store - File tree loading and operations
- Display Store - UI state (dialogs, sliders visibility)
- UI components in
src/renderer/src/components/ui/are auto-imported Radix Vue wrappers CodemirrorEditordirectory contains the main editor interface with sub-panels (FileTreePanel, PostSlider, RightSlider, CssEditor)- The app uses
path-browserifyfor path operations in renderer (original Nodepathis polyfilled) - Assets are imported through Vite's
?assetand?rawsuffixes
- Default workspace path:
~/documents/codes/LazyBox - Default document name:
探索 Markdown - First-run flag key:
lazybox-first-run-4
The project uses project references with separate configs:
tsconfig.node.json- Main process (Node.js types)tsconfig.web.json- Renderer process (DOM types)