CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
84/100
Scores the file, not the repository.Length
744 words
12 headings · 1 code blocksRepository
2.0k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Before You Code67Read and follow the **karpathy-guidelines** skill (`.claude/skills/karpathy-guidelines`) when writing, reviewing, or refactoring code here — surface assumptions, make surgical changes, keep it simple, and define verifiable success criteria.89## Project Overview1011Cate is a desktop application that provides an infinite zoomable canvas where editor panels, terminal panels, and browser panels float spatially (similar to Figma/Miro, but for coding). Built with Electron + React + TypeScript, styled with Tailwind CSS.1213## Build System1415The Electron app lives at the project root. Uses **electron-vite** for bundling.1617```bash18npm install # install dependencies19npm run dev # start dev server with hot reload20npm run build # production build21npm test # run vitest suite22```2324Tests use **Vitest** and live alongside the code they cover (`*.test.ts` / `*.test.tsx`). A few git-touching tests assume a clean working repo and may fail when the dev tree has a branch named `main` or local modifications — those failures are environmental, not regressions.2526## Dependencies2728Managed via npm (`package.json`):29- **Electron** — desktop shell (Chromium + Node.js)30- **React 18** + **react-dom** — UI framework31- **xterm.js** (`@xterm/xterm`) — terminal emulator with WebGL addon32- **node-pty** — native PTY for terminal backend33- **Monaco Editor** — code editor (VS Code's editor component)34- **zustand** — lightweight state management35- **chokidar** — filesystem watching36- **simple-git** — git operations37- **@phosphor-icons/react** — icons38- **electron-updater** — auto-update (GitHub Releases)3940## Architecture4142### Process Model (Electron)4344- **Main process** (`src/main/`) — window management, IPC handlers, native APIs45- **Preload** (`src/preload/`) — secure bridge exposing IPC to renderer46- **Renderer** (`src/renderer/`) — React app with canvas UI4748IPC channels are defined in `src/shared/ipc-channels.ts`. Type definitions in `src/shared/types.ts`.4950### Coordinate System & Canvas5152The canvas (`Canvas.tsx`) positions nodes using CSS transforms. Panel positions are stored in **canvas-space** and converted to **view-space** via zoom level and viewport offset. Key conversions in `src/renderer/lib/canvas/coordinates.ts`: `canvasToView()` / `viewToCanvas()`. Zoom range defined by `ZOOM_MIN`/`ZOOM_MAX` in shared types.5354### Canvas Interaction5556`useCanvasInteraction` hook handles wheel events (Cmd+scroll = zoom, two-finger = pan) and right-click drag panning. Node drag/resize handled by `useCanvasNodeDrag` and `useNodeResize` hooks.5758### Panel System5960Panel definitions are centralised in `src/shared/panels.ts`. The detachable panel61types (`PanelType` in `src/shared/types.ts`) are: terminal, browser, editor,62canvas, agent, document, extension. Renderer components live in `src/renderer/panels/`:63- **EditorPanel** — Monaco Editor with syntax highlighting64- **TerminalPanel** — xterm.js terminal with WebGL renderer, backed by node-pty65- **BrowserPanel** — embedded webview (file:// allowed for local HTML)66- **CanvasPanel** — nested canvas67- **DocumentPanel** — PDF / docx preview68- **AgentPanel** — Claude-Code agent thread (sidebar + dock)69- **ExtensionPanel** — third-party extension panel (isolated webview served by an extension server)7071The file tree (`src/renderer/sidebar/FileExplorer.tsx`) and recent-projects72switcher (`src/renderer/sidebar/ProjectList.tsx`) are **sidebar** components, not73detachable panels.7475Each panel can be wrapped in a `CanvasNode` (`src/renderer/canvas/CanvasNode.tsx`) — title bar, drag, resize, close — or live inside a dock zone via `DockTabStack` (`src/renderer/docking/`). All panel records render through the shared `PanelHost` (`src/renderer/panels/PanelHost.tsx`); detached windows are dock windows (`src/renderer/shells/DockWindowShell.tsx`) with local panels state synced back to main for session persistence.7677### State Management7879Zustand stores in `src/renderer/stores/`:80- **canvasStore** — nodes, regions, zoom, viewport offset, focus state, history; per-canvas instances created via `CanvasStoreContext`. A `focusEpoch` counter lets panels re-run focus side effects when the same node is re-focused.81- **appStore** — workspaces, panels, selected workspace, sidebar82- **dockStore** — dock-zone layout (per window)83- **settingsStore** — user preferences84- **shortcutStore** — keyboard shortcut bindings85- **statusStore** — status bar state86- **uiStore** — transient UI state (command palette, etc.)87- **extensionsStore** — renderer-side mirror of the main process's extension registry (enabled-extension set)8889Persisted state is stored as hand-editable JSON files under `userData` (no90electron-store). `settingsFile.ts` owns `settings.json`; `jsonStateFile.ts` is a91reusable factory for that same pattern — it delegates the in-memory-authority92engine to `jsonStateStore.ts` and keeps the filesystem backend (sync load,93debounced atomic write, chokidar external-edit watcher, corrupt-file quarantine).94`workspaceStateStore.ts` uses it for `recent-projects.json`, `sidebar.json`,95`remote-workspaces.json`, and `layouts.json`. Per-project canvas/session state96lives in `<project>/.cate/workspace.json` + `session.json`. AI provider credentials are97global in `userData/pi-agent/auth.json` (+ `models.json`), mirrored into each98workspace's `.cate/pi-agent/`.99100### Key Patterns101102- **Functional React** with hooks for all logic103- **Zustand** for global state (no Redux/Context boilerplate)104- **Tailwind CSS** for styling105- **IPC** for all main↔renderer communication (filesystem, git, terminal, shell)106- Keyboard shortcuts via `useShortcuts` hook107- File explorer is git-aware (tracks file status)108
Also in 0-AI-UG/cate
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| 0-AI-UG/cateAGENTS.md · 2.0k | AGENTS.md | setupbuildteststyle+3 | 84/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 949 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | today | |
| lollipopkit/flutter_server_boxCLAUDE.md · 8.3k | CLAUDE.md | buildteststylearch+2 | 98/100 | 3 days ago |
