aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-28 07:32:23 -0800
committerClawd <ai@clawd.bot>2026-02-28 07:32:23 -0800
commit35a38d909f1777e3b384ba26d68b88f641ec6a1a (patch)
tree811e5763a5207433896c986e7654cd5bff9ad93e /README.md
parent6d70c5f8a3ed90564b08616a3fb041409916059c (diff)
Phase 5: Integration & polish
- Add error handling with auto-dismissing error bar - Add keyboard shortcuts: - Escape to interrupt Claude - Cmd/Ctrl+Enter to submit - Fix unused import warning - Update README.md with project documentation - Concept and workflow explanation - UI layout diagram - Installation and development instructions - Project structure overview - Keyboard shortcuts reference
Diffstat (limited to 'README.md')
-rw-r--r--README.md136
1 files changed, 65 insertions, 71 deletions
diff --git a/README.md b/README.md
index f74d4fc..1e23bc9 100644
--- a/README.md
+++ b/README.md
@@ -1,104 +1,98 @@
1# minimal-electron-bsql 1# Claude Flow
2 2
3A bare-bones Electron + TypeScript + [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) app. 3A document-centric coding assistant that enforces a structured workflow: **Research → Plan → Implement**.
4No forge, no boilerplate, no scaffolding. Just the absolute minimum setup that:
5 4
6- Runs in dev mode on macOS/Linux/Windows 5Built with Electron, React, TypeScript, better-sqlite3, and the Claude Agent SDK.
7- Uses `better-sqlite3` from the **main process**
8- Creates a SQLite DB at startup, inserts + selects a row
9- Displays a trivial HTML UI
10- Can be packaged for distribution (SQLite included)
11 6
12--- 7## Concept
13 8
14## Project structure 9The primary UI is a **markdown document viewer/editor** with a **chat sidebar**. The workflow is driven by the document, not the chat.
10
11### Workflow Phases
12
131. **Research** — Claude researches your codebase based on your direction, writing findings to `.claude-flow/research.md`
142. **Plan** — Claude creates a detailed implementation plan in `.claude-flow/plan.md` with code snippets and a TODO checklist
153. **Implement** — Claude executes the plan, marking tasks complete as it goes
16
17At each phase, you can edit the document to add notes (marked with `// REVIEW:` or `// NOTE:`), click **Review** to have Claude address your feedback, then **Submit** to advance to the next phase.
18
19## UI Layout
15 20
16``` 21```
17minimal-electron-bsql/ 22┌──────────────────────────────────────────────────────────────┐
18├── src/ 23│ [Project ▾] [Session ▾] [Research ● ─ Plan ─] │
19│ └── main/ 24├────────────────────────────────────────┬─────────────────────┤
20│ └── index.ts # Electron main process 25│ │ │
21├── renderer/ 26│ # Research Findings │ Chat Dialogue │
22│ └── index.html # Minimal UI 27│ │ │
23├── package.json 28│ ## Authentication System │ Claude: What │
24├── tsconfig.json 29│ │ should I research?│
30│ The auth module uses JWT... │ │
31│ │ You: Research the │
32│ // REVIEW: check OAuth too │ auth system │
33│ │ │
34├────────────────────────────────────────┼─────────────────────┤
35│ 42k / 200k tokens ████░░░░ │ [Send] │
36│ [Review] [Submit] │ │
37└────────────────────────────────────────┴─────────────────────┘
25``` 38```
26 39
27## Requirements 40## Requirements
28 41
29- Node.js ≥ 18 42- Node.js ≥ 18
30- macOS (Apple Silicon or Intel). Windows & Linux should work with native build tools installed. 43- macOS (Apple Silicon or Intel), Windows, or Linux
31- Xcode Command Line Tools (macOS) or MSVC Build Tools (Windows) for native rebuilds 44- Claude API key or Claude Code subscription
32
33---
34 45
35## Install 46## Install
36 47
37```bash 48```bash
38git clone <this-repo> 49git clone <this-repo>
39cd minimal-electron-bsql 50cd claude-flow
40npm install 51npm install
41``` 52```
42 53
43ℹ️ On install, native modules are rebuilt for your Electron version via `@electron/rebuild`. 54## Development
44
45
46
47Scripts
48
49- npm run dev → compile TS and start Electron in dev mode
50- npm run build → compile TypeScript only
51- npm run start → start Electron with compiled code
52- npm run rebuild → force-rebuild native modules (better-sqlite3)
53- npm run dist → create distributable builds via electron-builder
54- npm run pack → package into unpacked app directory
55
56## What happens on startup
57
58In src/main/index.ts:
59
601. Database file created at app.getPath('userData')/app.db
612. A table messages is created (if not exists)
623. One row "hello from better-sqlite3" is inserted
634. A SELECT runs and the row is logged to console
645. Window shows renderer/index.html → just <main>hi</main>
65
66
67
68Packaging notes
69• Native modules: better-sqlite3.node must live outside app.asar. This is handled via:
70
71```
72"asarUnpack": ["node_modules/better-sqlite3/**/*"]
73```
74
75- Cross-arch builds (macOS):
76- Build separately for arm64 and x64:
77 55
78```bash 56```bash
79npm run dist -- --mac arm64 57npm run dev
80npm run dist -- --mac x64
81``` 58```
82 59
83- Optionally merge into a universal binary: 60This starts Vite dev server and Electron in watch mode.
61
62## Build
84 63
85```bash 64```bash
86npx electron-builder --universal 65npm run dist
87``` 66```
88 67
89- Database location: Always use app.getPath('userData'). Do not write next to your code files, since those are inside app.asar when packaged. 68Creates distributable builds via electron-builder.
69
70## Project Structure
90 71
91 72```
73claude-flow/
74├── src/main/ # Electron main process
75│ ├── index.ts # App lifecycle, window management
76│ ├── preload.ts # IPC bridge with typed API
77│ ├── db/ # SQLite database (projects, sessions, messages)
78│ ├── claude/ # Claude SDK wrapper with phase configs
79│ └── ipc/ # IPC handlers
80├── renderer/ # React frontend
81│ ├── src/
82│ │ ├── App.tsx # Main app with state management
83│ │ ├── components/ # Header, DocumentPane, ChatPane, ActionBar
84│ │ ├── styles/ # CSS
85│ │ └── types.ts # TypeScript types
86│ └── index.html
87├── package.json
88├── tsconfig.json
89└── vite.config.ts
90```
92 91
93Common pitfalls & fixes 92## Keyboard Shortcuts
94 93
95- was compiled against a different Node.js version error 94- **Cmd/Ctrl + Enter** — Submit (advance to next phase)
96- Run npm run rebuild after npm install or upgrading Electron. 95- **Escape** — Interrupt Claude
97- .node module not found after packaging
98- Check asarUnpack includes better-sqlite3.
99- Windows/Linux builds
100- Windows: install Build Tools for Visual Studio + Python
101- Linux: sudo apt install build-essential python3
102 96
103## License 97## License
104 98