@peaske7/readit 0.1.8 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/CLAUDE.md +118 -76
- package/.claude/commands/review.md +1 -1
- package/.claude/roadmap.md +32 -9
- package/.claude/user-stories.md +100 -15
- package/AGENTS.md +30 -26
- package/Makefile +32 -0
- package/README.md +90 -5
- package/biome.json +18 -8
- package/bun.lock +426 -710
- package/bunfig.toml +2 -0
- package/docs/perf-baseline.md +130 -0
- package/docs/superpowers/plans/2026-03-26-surgical-pruning.md +1176 -0
- package/docs/superpowers/specs/2026-03-27-go-server-rewrite-design.md +284 -0
- package/e2e/comments.spec.ts +14 -58
- package/e2e/document-load.spec.ts +1 -23
- package/e2e/export.spec.ts +4 -4
- package/e2e/perf/add-comment.spec.ts +116 -0
- package/e2e/perf/fixtures/generate.ts +327 -0
- package/e2e/perf/initial-load.spec.ts +49 -0
- package/e2e/perf/perf.setup.ts +23 -0
- package/e2e/perf/perf.teardown.ts +9 -0
- package/e2e/perf/screenshot-final.png +0 -0
- package/e2e/perf/scroll.spec.ts +39 -0
- package/e2e/perf/tab-switch.spec.ts +69 -0
- package/e2e/perf/text-selection.spec.ts +119 -0
- package/e2e/perf/utils/metrics.ts +350 -0
- package/e2e/perf/utils/perf-cli.ts +86 -0
- package/e2e/persistence-file.spec.ts +41 -26
- package/e2e/utils/selection.ts +17 -73
- package/go/cmd/readit/main.go +416 -0
- package/go/go.mod +20 -0
- package/go/go.sum +41 -0
- package/go/internal/server/anchor.go +302 -0
- package/go/internal/server/anchor_test.go +111 -0
- package/go/internal/server/comments.go +390 -0
- package/go/internal/server/documents.go +113 -0
- package/go/internal/server/embed.go +17 -0
- package/go/internal/server/headings.go +33 -0
- package/go/internal/server/headings_test.go +75 -0
- package/go/internal/server/htmltext.go +123 -0
- package/go/internal/server/markdown.go +157 -0
- package/go/internal/server/markdown_bench_test.go +42 -0
- package/go/internal/server/markdown_test.go +79 -0
- package/go/internal/server/server.go +453 -0
- package/go/internal/server/server_bench_test.go +122 -0
- package/go/internal/server/settings.go +110 -0
- package/go/internal/server/sse.go +140 -0
- package/go/internal/server/storage.go +275 -0
- package/go/internal/server/storage_test.go +118 -0
- package/go/internal/server/template.go +66 -0
- package/go/internal/server/types.go +101 -0
- package/go/internal/server/watcher.go +74 -0
- package/index.html +4 -14
- package/nvim-readit/lua/readit/health.lua +64 -0
- package/nvim-readit/lua/readit/init.lua +463 -0
- package/nvim-readit/plugin/readit.lua +19 -0
- package/package.json +24 -41
- package/playwright.config.ts +12 -0
- package/shell/_readit +158 -0
- package/shell/readit.zsh +87 -0
- package/src/App.svelte +881 -0
- package/src/{cli/index.ts → cli.ts} +216 -70
- package/src/components/ActionsMenu.svelte +95 -0
- package/src/components/CommentBadge.svelte +67 -0
- package/src/components/CommentErrorBanner.svelte +33 -0
- package/src/components/CommentInput.svelte +75 -0
- package/src/components/CommentListItem.svelte +95 -0
- package/src/components/CommentManager.svelte +129 -0
- package/src/components/CommentNav.svelte +109 -0
- package/src/components/DocumentViewer.svelte +218 -0
- package/src/components/FloatingComment.svelte +107 -0
- package/src/components/Header.svelte +76 -0
- package/src/components/InlineEditor.svelte +72 -0
- package/src/components/MarginNote.svelte +167 -0
- package/src/components/MarginNotesContainer.svelte +33 -0
- package/src/components/RawModal.svelte +126 -0
- package/src/components/ReanchorConfirm.svelte +30 -0
- package/src/components/SettingsModal.svelte +220 -0
- package/src/components/ShortcutCapture.svelte +82 -0
- package/src/components/ShortcutList.svelte +145 -0
- package/src/components/TabBar.svelte +52 -0
- package/src/components/TableOfContents.svelte +125 -0
- package/src/components/ui/ActionLink.svelte +40 -0
- package/src/components/ui/Button.svelte +53 -0
- package/src/components/ui/Dialog.svelte +97 -0
- package/src/components/ui/DropdownMenu.svelte +85 -0
- package/src/components/ui/DropdownMenuItem.svelte +38 -0
- package/src/components/ui/DropdownMenuSeparator.svelte +11 -0
- package/src/components/ui/Text.svelte +42 -0
- package/src/env.d.ts +6 -0
- package/src/index.css +36 -166
- package/src/lib/__fixtures__/bench-data.ts +1 -54
- package/src/lib/anchor.bench.ts +47 -68
- package/src/lib/anchor.test.ts +5 -9
- package/src/lib/anchor.ts +9 -93
- package/src/lib/comment-storage.bench.ts +6 -20
- package/src/lib/comment-storage.test.ts +45 -37
- package/src/lib/comment-storage.ts +23 -64
- package/src/lib/export.bench.ts +9 -23
- package/src/lib/export.ts +7 -14
- package/src/lib/headings.test.ts +103 -0
- package/src/lib/headings.ts +44 -0
- package/src/lib/highlight/core.test.ts +1 -6
- package/src/lib/highlight/dom.ts +53 -280
- package/src/lib/highlight/highlight-registry.ts +221 -0
- package/src/lib/highlight/highlight.bench.ts +92 -0
- package/src/lib/highlight/highlighter.ts +122 -302
- package/src/lib/highlight/{core.ts → resolver.ts} +3 -19
- package/src/lib/highlight/types.ts +0 -40
- package/src/lib/html-text.test.ts +162 -0
- package/src/lib/html-text.ts +161 -0
- package/src/lib/i18n/en.ts +13 -36
- package/src/lib/i18n/ja.ts +14 -37
- package/src/lib/i18n/types.ts +13 -36
- package/src/lib/margin-layout.bench.ts +48 -15
- package/src/lib/margin-layout.ts +2 -31
- package/src/lib/markdown-renderer.test.ts +154 -0
- package/src/lib/markdown-renderer.ts +177 -0
- package/src/lib/mermaid-config.ts +38 -0
- package/src/lib/mermaid-renderer.ts +162 -0
- package/src/lib/mermaid-worker.ts +60 -0
- package/src/lib/positions.ts +157 -0
- package/src/lib/shortcut-registry.ts +138 -103
- package/src/lib/utils.ts +2 -48
- package/src/main.ts +16 -0
- package/src/schema.ts +92 -0
- package/src/{server/index.ts → server.ts} +427 -163
- package/src/stores/app.svelte.ts +231 -0
- package/src/stores/locale.svelte.ts +46 -0
- package/src/stores/settings.svelte.ts +90 -0
- package/src/stores/shortcuts.svelte.ts +104 -0
- package/src/stores/ui.svelte.ts +12 -0
- package/src/template.ts +104 -0
- package/src/test-setup.ts +47 -0
- package/svelte.config.js +5 -0
- package/tsconfig.json +2 -2
- package/vite.config.ts +31 -3
- package/vscode-readit/.mcp.json +7 -0
- package/vscode-readit/.vscodeignore +7 -0
- package/vscode-readit/bun.lock +78 -0
- package/vscode-readit/icon.svg +10 -0
- package/vscode-readit/package.json +110 -0
- package/vscode-readit/src/extension.ts +117 -0
- package/vscode-readit/src/server-manager.ts +272 -0
- package/vscode-readit/src/webview-provider.ts +204 -0
- package/vscode-readit/tsconfig.json +20 -0
- package/e2e/fixtures/sample.html +0 -13
- package/src/App.tsx +0 -416
- package/src/components/ActionsMenu.tsx +0 -112
- package/src/components/DocumentViewer/CodeBlock.tsx +0 -160
- package/src/components/DocumentViewer/DocumentViewer.tsx +0 -259
- package/src/components/DocumentViewer/IframeContainer.tsx +0 -251
- package/src/components/DocumentViewer/InlineCode.tsx +0 -60
- package/src/components/DocumentViewer/MermaidDiagram.tsx +0 -137
- package/src/components/DocumentViewer/index.ts +0 -1
- package/src/components/FloatingTOC.tsx +0 -61
- package/src/components/Header.tsx +0 -65
- package/src/components/InlineEditor.tsx +0 -74
- package/src/components/MarginNote.tsx +0 -207
- package/src/components/MarginNotes.tsx +0 -50
- package/src/components/RawModal.tsx +0 -143
- package/src/components/ReanchorConfirm.tsx +0 -36
- package/src/components/SettingsModal.tsx +0 -310
- package/src/components/ShortcutCapture.tsx +0 -48
- package/src/components/ShortcutList.tsx +0 -198
- package/src/components/TabBar.tsx +0 -60
- package/src/components/TableOfContents.tsx +0 -108
- package/src/components/comments/CommentBadge.tsx +0 -49
- package/src/components/comments/CommentInput.tsx +0 -114
- package/src/components/comments/CommentListItem.tsx +0 -92
- package/src/components/comments/CommentManager.tsx +0 -113
- package/src/components/comments/CommentMinimap.tsx +0 -62
- package/src/components/comments/CommentNav.tsx +0 -109
- package/src/components/ui/ActionBar.tsx +0 -16
- package/src/components/ui/ActionLink.tsx +0 -32
- package/src/components/ui/Button.tsx +0 -55
- package/src/components/ui/Dialog.tsx +0 -156
- package/src/components/ui/DropdownMenu.tsx +0 -114
- package/src/components/ui/SeparatorDot.tsx +0 -9
- package/src/components/ui/Text.tsx +0 -54
- package/src/contexts/CommentContext.tsx +0 -229
- package/src/contexts/LayoutContext.tsx +0 -88
- package/src/contexts/LocaleContext.tsx +0 -35
- package/src/hooks/useClickOutside.ts +0 -35
- package/src/hooks/useClipboard.ts +0 -82
- package/src/hooks/useCommentNavigation.ts +0 -130
- package/src/hooks/useComments.ts +0 -323
- package/src/hooks/useDocument.ts +0 -156
- package/src/hooks/useEditorScheme.ts +0 -51
- package/src/hooks/useFontPreference.ts +0 -59
- package/src/hooks/useHeadings.test.ts +0 -159
- package/src/hooks/useHeadings.ts +0 -129
- package/src/hooks/useKeybindings.ts +0 -108
- package/src/hooks/useKeyboardShortcuts.ts +0 -63
- package/src/hooks/useLayoutMode.ts +0 -44
- package/src/hooks/useLocalePreference.ts +0 -42
- package/src/hooks/useReanchorMode.ts +0 -33
- package/src/hooks/useScrollMetrics.ts +0 -56
- package/src/hooks/useScrollSpy.ts +0 -81
- package/src/hooks/useTextSelection.ts +0 -123
- package/src/hooks/useThemePreference.ts +0 -66
- package/src/lib/context.bench.ts +0 -41
- package/src/lib/context.test.ts +0 -224
- package/src/lib/context.ts +0 -193
- package/src/lib/editor-links.ts +0 -59
- package/src/lib/highlight/colors.ts +0 -37
- package/src/lib/highlight/index.ts +0 -23
- package/src/lib/highlight/script-builder.ts +0 -485
- package/src/lib/html-processor.test.tsx +0 -170
- package/src/lib/html-processor.tsx +0 -95
- package/src/lib/i18n/completeness.test.ts +0 -51
- package/src/lib/i18n/translations.test.ts +0 -39
- package/src/lib/layout-constants.ts +0 -12
- package/src/lib/scroll.test.ts +0 -118
- package/src/lib/scroll.ts +0 -47
- package/src/lib/shortcut-registry.test.ts +0 -173
- package/src/lib/utils.test.ts +0 -110
- package/src/main.tsx +0 -13
- package/src/store/index.test.ts +0 -242
- package/src/store/index.ts +0 -254
- package/src/types/index.ts +0 -127
package/.claude/CLAUDE.md
CHANGED
|
@@ -11,14 +11,24 @@ Inspired by [difit](https://github.com/yoshiko-pg/difit) - a local code review t
|
|
|
11
11
|
```bash
|
|
12
12
|
# Development
|
|
13
13
|
bun install # Install dependencies
|
|
14
|
-
bun dev # Start dev server (
|
|
15
|
-
bun run
|
|
16
|
-
bun run
|
|
14
|
+
bun dev # Start dev server (CLI with --watch)
|
|
15
|
+
bun run dev:client # Start Vite dev server only
|
|
16
|
+
bun run build # Build for production (Vite + CLI)
|
|
17
|
+
bun run test # Run unit tests (Vitest)
|
|
18
|
+
bun run test:e2e # Run e2e tests (Playwright)
|
|
19
|
+
bun run test:perf # Run performance tests
|
|
20
|
+
bun run bench # Run benchmarks
|
|
17
21
|
bun run typecheck # Run TypeScript checks
|
|
18
22
|
bun run check # Run Biome (lint + format check)
|
|
19
23
|
bun run check:fix # Fix lint + format issues
|
|
20
24
|
bun run format # Format with Biome
|
|
21
25
|
|
|
26
|
+
# Go server (production binary)
|
|
27
|
+
make dev # Go server + Vite HMR
|
|
28
|
+
make build # Build single binary (dist/readit)
|
|
29
|
+
make test # Run Go tests
|
|
30
|
+
make clean # Clean build artifacts
|
|
31
|
+
|
|
22
32
|
# Usage
|
|
23
33
|
bunx readit <file.md> # Review Markdown file
|
|
24
34
|
bunx readit <file.html> # Review HTML file
|
|
@@ -29,6 +39,8 @@ bunx readit <file.md> --clean # Clear existing comments
|
|
|
29
39
|
|
|
30
40
|
bunx readit list # List all files with comments
|
|
31
41
|
bunx readit show <file.md> # Show comments for a file
|
|
42
|
+
bunx readit open <files...> # Add files to running server
|
|
43
|
+
bunx readit completion zsh # Output shell integration script
|
|
32
44
|
```
|
|
33
45
|
|
|
34
46
|
## Architecture
|
|
@@ -36,97 +48,126 @@ bunx readit show <file.md> # Show comments for a file
|
|
|
36
48
|
```
|
|
37
49
|
readit/
|
|
38
50
|
├── src/
|
|
39
|
-
│ ├── cli
|
|
40
|
-
│
|
|
41
|
-
│ ├──
|
|
42
|
-
│
|
|
51
|
+
│ ├── cli.ts # CLI entry point (Commander.js)
|
|
52
|
+
│ ├── server.ts # Bun.serve() server + API routes
|
|
53
|
+
│ ├── App.svelte # Main Svelte component
|
|
54
|
+
│ ├── main.ts # Svelte entry point
|
|
55
|
+
│ ├── schema.ts # TypeScript types
|
|
56
|
+
│ ├── template.ts # HTML template rendering
|
|
57
|
+
│ ├── index.css # Tailwind styles + CSS custom properties
|
|
43
58
|
│ ├── components/
|
|
44
|
-
│ │ ├── Header.
|
|
45
|
-
│ │ ├── DocumentViewer.
|
|
46
|
-
│ │ ├──
|
|
47
|
-
│ │ ├──
|
|
48
|
-
│ │ ├──
|
|
49
|
-
│ │ ├──
|
|
50
|
-
│ │ ├──
|
|
51
|
-
│ │ ├──
|
|
52
|
-
│ │ ├──
|
|
53
|
-
│ │ ├──
|
|
54
|
-
│ │ ├──
|
|
55
|
-
│ │ ├──
|
|
56
|
-
│ │ ├──
|
|
57
|
-
│ │ ├──
|
|
58
|
-
│ │ ├──
|
|
59
|
-
│ │ ├──
|
|
60
|
-
│ │
|
|
61
|
-
│ ├──
|
|
62
|
-
│ │
|
|
63
|
-
│ │
|
|
64
|
-
│ │
|
|
65
|
-
│ │
|
|
66
|
-
│ │
|
|
67
|
-
│ │
|
|
68
|
-
│ │
|
|
69
|
-
│ │
|
|
70
|
-
│
|
|
71
|
-
│ │ ├──
|
|
72
|
-
│ │
|
|
73
|
-
│ ├──
|
|
74
|
-
│ │ ├──
|
|
75
|
-
│ │
|
|
76
|
-
│
|
|
77
|
-
│
|
|
78
|
-
│
|
|
79
|
-
│
|
|
80
|
-
│
|
|
81
|
-
│
|
|
82
|
-
│
|
|
83
|
-
│
|
|
84
|
-
│
|
|
85
|
-
│
|
|
86
|
-
│
|
|
87
|
-
│
|
|
88
|
-
│
|
|
89
|
-
│
|
|
90
|
-
│
|
|
91
|
-
│
|
|
92
|
-
│ ├──
|
|
93
|
-
│ ├──
|
|
94
|
-
│
|
|
59
|
+
│ │ ├── Header.svelte
|
|
60
|
+
│ │ ├── DocumentViewer.svelte # Renders document HTML
|
|
61
|
+
│ │ ├── CommentInput.svelte # Comment input area
|
|
62
|
+
│ │ ├── CommentNav.svelte # Navigate between comments
|
|
63
|
+
│ │ ├── CommentListItem.svelte # Comment item in manager
|
|
64
|
+
│ │ ├── CommentManager.svelte # Comment management panel
|
|
65
|
+
│ │ ├── CommentBadge.svelte # Comment count badge
|
|
66
|
+
│ │ ├── MarginNote.svelte # Individual margin note
|
|
67
|
+
│ │ ├── MarginNotesContainer.svelte
|
|
68
|
+
│ │ ├── ActionsMenu.svelte # Actions dropdown menu
|
|
69
|
+
│ │ ├── InlineEditor.svelte # Inline text editing
|
|
70
|
+
│ │ ├── RawModal.svelte # View raw .comments.md file
|
|
71
|
+
│ │ ├── ReanchorConfirm.svelte # Re-anchor confirmation dialog
|
|
72
|
+
│ │ ├── SettingsModal.svelte # Settings modal
|
|
73
|
+
│ │ ├── ShortcutCapture.svelte # Keyboard shortcut capture
|
|
74
|
+
│ │ ├── ShortcutList.svelte # Keyboard shortcuts list
|
|
75
|
+
│ │ ├── TabBar.svelte # Multi-file tab bar
|
|
76
|
+
│ │ ├── TableOfContents.svelte # Document headings navigation
|
|
77
|
+
│ │ └── ui/ # Primitive UI components
|
|
78
|
+
│ │ ├── ActionLink.svelte
|
|
79
|
+
│ │ ├── Button.svelte
|
|
80
|
+
│ │ ├── Dialog.svelte
|
|
81
|
+
│ │ ├── DropdownMenu.svelte
|
|
82
|
+
│ │ ├── DropdownMenuItem.svelte
|
|
83
|
+
│ │ ├── DropdownMenuSeparator.svelte
|
|
84
|
+
│ │ └── Text.svelte
|
|
85
|
+
│ ├── stores/ # Svelte 5 reactive stores
|
|
86
|
+
│ │ ├── app.svelte.ts # Application state
|
|
87
|
+
│ │ ├── settings.svelte.ts # User settings
|
|
88
|
+
│ │ ├── shortcuts.svelte.ts # Keyboard shortcuts
|
|
89
|
+
│ │ ├── locale.svelte.ts # i18n state
|
|
90
|
+
│ │ └── ui.svelte.ts # UI state
|
|
91
|
+
│ └── lib/
|
|
92
|
+
│ ├── anchor.ts # Anchor-based comment resolution
|
|
93
|
+
│ ├── comment-storage.ts # File-based comment storage
|
|
94
|
+
│ ├── export.ts # Export utilities (JSON, prompt format)
|
|
95
|
+
│ ├── headings.ts # Heading extraction
|
|
96
|
+
│ ├── html-text.ts # HTML text extraction
|
|
97
|
+
│ ├── margin-layout.ts # Margin note position resolution
|
|
98
|
+
│ ├── markdown-renderer.ts # Server-side markdown rendering
|
|
99
|
+
│ ├── mermaid-renderer.ts # Mermaid diagram rendering
|
|
100
|
+
│ ├── mermaid-config.ts # Mermaid configuration
|
|
101
|
+
│ ├── mermaid-worker.ts # Mermaid worker thread
|
|
102
|
+
│ ├── positions.ts # Position calculations
|
|
103
|
+
│ ├── shortcut-registry.ts # Keyboard shortcut registry
|
|
104
|
+
│ ├── utils.ts # Common utilities (cn, etc.)
|
|
105
|
+
│ ├── highlight/ # Text highlighting system
|
|
106
|
+
│ │ ├── highlighter.ts # Highlight manager
|
|
107
|
+
│ │ ├── highlight-registry.ts # Highlight registry
|
|
108
|
+
│ │ ├── resolver.ts # Highlight resolution
|
|
109
|
+
│ │ ├── dom.ts # DOM manipulation
|
|
110
|
+
│ │ └── types.ts # Type definitions
|
|
111
|
+
│ └── i18n/ # Internationalization
|
|
112
|
+
│ ├── index.ts
|
|
113
|
+
│ ├── translations.ts
|
|
114
|
+
│ ├── types.ts
|
|
115
|
+
│ ├── en.ts # English translations
|
|
116
|
+
│ └── ja.ts # Japanese translations
|
|
117
|
+
├── go/ # Go server (production binary)
|
|
118
|
+
│ ├── cmd/readit/main.go # Go CLI entry point
|
|
119
|
+
│ └── internal/server/ # HTTP server, markdown, comments, SSE
|
|
120
|
+
├── shell/ # Shell integration
|
|
121
|
+
│ ├── readit.zsh # Zsh plugin (@ file picker + completions)
|
|
122
|
+
│ └── _readit # Zsh compdef completion function
|
|
123
|
+
├── nvim-readit/ # Neovim plugin
|
|
124
|
+
│ ├── lua/readit/init.lua # Core plugin (server mgmt, commands, keymaps)
|
|
125
|
+
│ ├── lua/readit/health.lua # :checkhealth support
|
|
126
|
+
│ └── plugin/readit.lua # Auto-loader
|
|
127
|
+
├── vscode-readit/ # VS Code extension
|
|
128
|
+
│ └── src/ # Extension source (TypeScript)
|
|
129
|
+
├── e2e/ # Playwright e2e tests
|
|
130
|
+
├── docs/ # Design docs and specs
|
|
95
131
|
├── dist/ # Built output
|
|
96
132
|
├── .claude/ # AI agent docs
|
|
97
133
|
│ ├── user-stories.md
|
|
98
134
|
│ ├── roadmap.md
|
|
99
135
|
│ └── settings.json
|
|
136
|
+
├── Makefile # Go build targets (make dev, make build)
|
|
100
137
|
├── CLAUDE.md # This file
|
|
101
|
-
|
|
102
|
-
└── CHANGELOG.md # Version changelog
|
|
138
|
+
└── AGENTS.md # AI agent instructions
|
|
103
139
|
```
|
|
104
140
|
|
|
105
141
|
## Key Design Decisions
|
|
106
142
|
|
|
107
|
-
1. **
|
|
108
|
-
2. **
|
|
109
|
-
3. **
|
|
110
|
-
4. **
|
|
111
|
-
5. **
|
|
112
|
-
6. **
|
|
113
|
-
7. **
|
|
143
|
+
1. **markdown-it for Markdown**: Server-side rendering with shiki for syntax highlighting
|
|
144
|
+
2. **Mermaid for diagrams**: Server-side Mermaid diagram rendering
|
|
145
|
+
3. **Margin notes UX**: Comments appear as margin notes next to highlighted text (Google Docs style)
|
|
146
|
+
4. **File-based comments**: Human-readable `.comments.md` files stored in `~/.readit/comments/`
|
|
147
|
+
5. **difit-style UX**: CLI → local server → browser, familiar pattern
|
|
148
|
+
6. **Svelte 5 stores for state**: Reactive stores (`.svelte.ts`) for state management
|
|
149
|
+
7. **i18n support**: English and Japanese translations
|
|
150
|
+
8. **Live reload**: fs.watch() on documents + SSE push to browser; handles rename-style saves (Vim/Neovim/Emacs)
|
|
151
|
+
9. **Editor integrations**: Neovim plugin (Lua), VS Code extension, shell completions with `@` fzf file picker
|
|
114
152
|
|
|
115
153
|
## Tech Stack
|
|
116
154
|
|
|
117
155
|
- **Runtime**: Bun
|
|
118
156
|
- **CLI**: Commander.js for argument parsing
|
|
119
|
-
- **Server**: Bun.serve() for API and static files
|
|
120
|
-
- **Markdown Rendering**:
|
|
121
|
-
- **
|
|
122
|
-
- **Frontend**: React 19 + TypeScript + Vite
|
|
157
|
+
- **Server**: Bun.serve() for API, SSE, and static files
|
|
158
|
+
- **Markdown Rendering**: markdown-it (server-side) + shiki (syntax highlighting)
|
|
159
|
+
- **Frontend**: Svelte 5 + TypeScript + Vite
|
|
123
160
|
- **Styling**: Tailwind CSS v4
|
|
124
|
-
- **
|
|
161
|
+
- **Icons**: lucide-svelte
|
|
162
|
+
- **Testing**: Vitest (unit) + Playwright (e2e)
|
|
163
|
+
- **Production Binary**: Go (embeds frontend via go:embed)
|
|
125
164
|
- **Quality**: Biome (lint + format), lefthook
|
|
165
|
+
- **Shell Integration**: Zsh/Bash/Fish completions, fzf-powered `@` file picker
|
|
166
|
+
- **Editor Plugins**: Neovim (Lua), VS Code (TypeScript)
|
|
126
167
|
|
|
127
168
|
## Current Limitations
|
|
128
169
|
|
|
129
|
-
- Comments use text
|
|
170
|
+
- Comments use anchor-based text matching, may break if document changes significantly
|
|
130
171
|
- No comment status tracking yet (resolved/unresolved planned for v0.3.0)
|
|
131
172
|
|
|
132
173
|
## User Stories
|
|
@@ -136,7 +177,8 @@ See `.claude/user-stories.md` for detailed user stories and acceptance criteria.
|
|
|
136
177
|
## Code Style
|
|
137
178
|
|
|
138
179
|
- TypeScript strict mode
|
|
139
|
-
-
|
|
140
|
-
- Tailwind for styling
|
|
180
|
+
- Svelte 5 components with reactive stores
|
|
181
|
+
- Tailwind for styling
|
|
141
182
|
- ESM modules throughout
|
|
142
|
-
- Co-located test files (`*.test.ts`)
|
|
183
|
+
- Co-located test files (`*.test.ts`, `*.bench.ts`)
|
|
184
|
+
- E2E tests in `e2e/`
|
|
@@ -78,7 +78,7 @@ Reference `.claude/rules/style-guide.md` for detailed examples.
|
|
|
78
78
|
**For surface issues:**
|
|
79
79
|
|
|
80
80
|
1. Fix silently after addressing fundamental issues
|
|
81
|
-
2. Run `
|
|
81
|
+
2. Run `bun run check:fix` to format
|
|
82
82
|
|
|
83
83
|
## Anti-patterns to Flag
|
|
84
84
|
|
package/.claude/roadmap.md
CHANGED
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
## v0.1.0 - MVP ✅
|
|
4
4
|
|
|
5
5
|
- [x] CLI with Commander.js
|
|
6
|
-
- [x]
|
|
7
|
-
- [x] HTML file support
|
|
8
|
-
- [x]
|
|
9
|
-
- [x]
|
|
6
|
+
- [x] markdown-it for Markdown rendering (server-side with shiki syntax highlighting)
|
|
7
|
+
- [x] HTML file support
|
|
8
|
+
- [x] Bun.serve() server serving API + static files
|
|
9
|
+
- [x] Svelte 5 frontend with Tailwind CSS v4
|
|
10
10
|
- [x] Text selection → comment input
|
|
11
11
|
- [x] Margin notes UI (Google Docs style)
|
|
12
12
|
- [x] Highlight commented text with yellow background
|
|
13
13
|
- [x] Copy All / Export JSON
|
|
14
14
|
- [x] File-based comment persistence (`.comments.md` files)
|
|
15
15
|
- [x] Copy for LLM feature (⌘⇧C) - copy selection/comment with surrounding context
|
|
16
|
-
- [x] CLI subcommands: `list`, `show`
|
|
16
|
+
- [x] CLI subcommands: `list`, `show`, `open`
|
|
17
17
|
|
|
18
18
|
## v0.2.0 - File-Based Comment Storage ✅
|
|
19
19
|
|
|
@@ -65,7 +65,7 @@ Review documents, add comments, then resolve one-by-one with LLM assistance.
|
|
|
65
65
|
## v0.4.0 - Visual Enhancements ✅
|
|
66
66
|
|
|
67
67
|
- [x] Highlight commented text in document (moved to v0.1.0)
|
|
68
|
-
- [x] Syntax highlighting for code blocks (
|
|
68
|
+
- [x] Syntax highlighting for code blocks (shiki, server-side)
|
|
69
69
|
- [x] Click highlight → scroll to margin note
|
|
70
70
|
- [x] Click margin note → scroll to highlighted text
|
|
71
71
|
- [x] Mermaid diagram rendering
|
|
@@ -82,13 +82,36 @@ Review documents, add comments, then resolve one-by-one with LLM assistance.
|
|
|
82
82
|
- [ ] Filter by category
|
|
83
83
|
- [ ] Category in export format
|
|
84
84
|
|
|
85
|
-
## v0.6.0 - Multi-file Support
|
|
85
|
+
## v0.6.0 - Multi-file Support (Partial ✅)
|
|
86
86
|
|
|
87
87
|
- [ ] Glob pattern support (`readit docs/*.md`)
|
|
88
|
-
- [
|
|
89
|
-
- [
|
|
88
|
+
- [x] Multiple file arguments (`readit file1.md file2.md`)
|
|
89
|
+
- [x] Directory scanning (`readit <dir>`)
|
|
90
|
+
- [x] `readit open <files...>` to add files to running server
|
|
91
|
+
- [x] File tab navigation (TabBar.svelte)
|
|
92
|
+
- [x] Per-file comment storage
|
|
90
93
|
- [ ] Bulk export across files
|
|
91
94
|
|
|
95
|
+
## v0.7.0 - Shell Integration & Editor Plugins ✅
|
|
96
|
+
|
|
97
|
+
- [x] Zsh integration with `@` file autocomplete (fzf-powered, Forge Code-style)
|
|
98
|
+
- [x] `@<TAB>` launches fzf picker for markdown files
|
|
99
|
+
- [x] `@partial<TAB>` pre-filters fzf query
|
|
100
|
+
- [x] Syntax highlighting for `@*.md` patterns in command line
|
|
101
|
+
- [x] Standard compdef completion for subcommands and options
|
|
102
|
+
- [x] Bash and Fish completion scripts via `readit completion`
|
|
103
|
+
- [x] Neovim plugin (`nvim-readit/`)
|
|
104
|
+
- [x] Server lifecycle management (start/stop/discover)
|
|
105
|
+
- [x] `:ReaditOpen`, `:ReaditStop`, `:ReaditStatus`, `:ReaditReload`, `:ReaditList` commands
|
|
106
|
+
- [x] Configurable keymaps (`<leader>r` prefix by default)
|
|
107
|
+
- [x] `:checkhealth readit` support
|
|
108
|
+
- [x] Auto-cleanup on VimLeavePre
|
|
109
|
+
- [x] Enhanced live reload on file changes
|
|
110
|
+
- [x] Handle `rename` events (Vim/Neovim write-to-temp-then-rename saves)
|
|
111
|
+
- [x] Auto re-establish watcher after rename with retry logic
|
|
112
|
+
- [x] SSE auto-reconnect with exponential backoff
|
|
113
|
+
- [x] Parallel document + comments fetch on reload
|
|
114
|
+
|
|
92
115
|
## Future Considerations
|
|
93
116
|
|
|
94
117
|
- Sticky notes (ペタペタ) - add notes not tied to text selection
|
package/.claude/user-stories.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
**Acceptance Criteria:**
|
|
12
12
|
|
|
13
13
|
- Run `readit document.md` or `readit document.html` and browser opens with rendered content
|
|
14
|
-
-
|
|
14
|
+
- markdown-it for Markdown (server-side rendering with shiki syntax highlighting)
|
|
15
15
|
- Clean light theme with good typography for reading
|
|
16
16
|
|
|
17
17
|
---
|
|
@@ -153,20 +153,20 @@
|
|
|
153
153
|
|
|
154
154
|
---
|
|
155
155
|
|
|
156
|
-
### US-010: Review Multiple Files
|
|
156
|
+
### US-010: Review Multiple Files ✅
|
|
157
157
|
|
|
158
|
-
**As a** reviewer
|
|
159
|
-
**I want to** review multiple Markdown files in one session
|
|
160
|
-
**So that** I can review an entire document set
|
|
158
|
+
**As a** reviewer
|
|
159
|
+
**I want to** review multiple Markdown files in one session
|
|
160
|
+
**So that** I can review an entire document set
|
|
161
161
|
|
|
162
162
|
**Acceptance Criteria:**
|
|
163
163
|
|
|
164
|
-
-
|
|
165
|
-
- File tabs or sidebar navigation
|
|
164
|
+
- ~~`readit docs/*.md` opens multi-file view~~ `readit file1.md file2.md` or `readit <dir>` opens multi-file view
|
|
165
|
+
- File tabs or sidebar navigation (TabBar.svelte)
|
|
166
166
|
- Comments stored per file
|
|
167
167
|
- Bulk export across all files
|
|
168
168
|
|
|
169
|
-
**Status:**
|
|
169
|
+
**Status:** Implemented (multi-file args, directory scanning, `open` command, tab bar UI). Glob patterns not yet supported.
|
|
170
170
|
|
|
171
171
|
---
|
|
172
172
|
|
|
@@ -205,6 +205,61 @@
|
|
|
205
205
|
|
|
206
206
|
---
|
|
207
207
|
|
|
208
|
+
### US-013: Shell Integration with File Autocomplete ✅
|
|
209
|
+
|
|
210
|
+
**As a** CLI user
|
|
211
|
+
**I want to** autocomplete markdown file paths with `@<TAB>` in my shell
|
|
212
|
+
**So that** I can quickly find and open documents without typing full paths
|
|
213
|
+
|
|
214
|
+
**Acceptance Criteria:**
|
|
215
|
+
|
|
216
|
+
- `readit @<TAB>` launches fzf picker for markdown files in cwd
|
|
217
|
+
- `readit @partial<TAB>` pre-filters the picker with "partial" as query
|
|
218
|
+
- Standard Tab completion works for subcommands and options
|
|
219
|
+
- `readit completion zsh|bash|fish` outputs shell-specific setup scripts
|
|
220
|
+
- `eval "$(readit completion zsh)"` installs everything in one line
|
|
221
|
+
|
|
222
|
+
**Status:** Implemented (v0.7.0)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
### US-014: Neovim Plugin ✅
|
|
227
|
+
|
|
228
|
+
**As a** Neovim user
|
|
229
|
+
**I want to** render and review markdown documents directly from my editor
|
|
230
|
+
**So that** I can stay in my editing workflow while reviewing
|
|
231
|
+
|
|
232
|
+
**Acceptance Criteria:**
|
|
233
|
+
|
|
234
|
+
- `:ReaditOpen` starts server and opens current buffer in browser
|
|
235
|
+
- `:ReaditStop` stops the server
|
|
236
|
+
- `:ReaditReload` saves buffer and triggers browser refresh
|
|
237
|
+
- `:ReaditStatus` shows server info
|
|
238
|
+
- Configurable keymaps (default `<leader>r` prefix)
|
|
239
|
+
- Server auto-cleanup on VimLeavePre
|
|
240
|
+
- `:checkhealth readit` verifies dependencies
|
|
241
|
+
|
|
242
|
+
**Status:** Implemented (v0.7.0)
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
### US-015: Live Reload on File Changes ✅
|
|
247
|
+
|
|
248
|
+
**As a** reviewer
|
|
249
|
+
**I want to** see the browser update automatically when I edit the source document
|
|
250
|
+
**So that** I can see my changes reflected in real time
|
|
251
|
+
|
|
252
|
+
**Acceptance Criteria:**
|
|
253
|
+
|
|
254
|
+
- Browser updates within ~200ms of file save
|
|
255
|
+
- Works with Vim/Neovim saves (write-to-temp-then-rename pattern)
|
|
256
|
+
- SSE connection auto-reconnects if server restarts (exponential backoff)
|
|
257
|
+
- Document HTML and comments fetched in parallel for fast reload
|
|
258
|
+
|
|
259
|
+
**Status:** Implemented (enhanced in v0.7.0, base SSE existed since v0.1.0)
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
208
263
|
## Technical Stories
|
|
209
264
|
|
|
210
265
|
### TS-001: CLI Argument Parsing
|
|
@@ -217,18 +272,22 @@
|
|
|
217
272
|
|
|
218
273
|
### TS-002: Server Architecture
|
|
219
274
|
|
|
220
|
-
-
|
|
221
|
-
- `/api/
|
|
222
|
-
- `/api/
|
|
223
|
-
-
|
|
275
|
+
- Bun.serve() serves API + static files
|
|
276
|
+
- `/api/documents` list and add documents
|
|
277
|
+
- `/api/document` fetch individual document HTML and headings
|
|
278
|
+
- `/api/comments` CRUD operations for comments
|
|
279
|
+
- `/api/settings` get/update user settings
|
|
280
|
+
- `/api/heartbeat` SSE for browser connection tracking
|
|
281
|
+
- `/api/document/stream` SSE for document updates (live reload)
|
|
282
|
+
- Development mode proxies to Vite dev server
|
|
224
283
|
- Production mode serves built assets from dist/
|
|
225
284
|
|
|
226
285
|
### TS-003: Build System
|
|
227
286
|
|
|
228
287
|
- Vite for frontend bundling
|
|
229
|
-
-
|
|
230
|
-
- Single `
|
|
231
|
-
- `
|
|
288
|
+
- `bun build` for CLI bundling (target bun, ESM)
|
|
289
|
+
- Single `bun run build` produces complete distributable
|
|
290
|
+
- `bunx readit` works without global install
|
|
232
291
|
|
|
233
292
|
### TS-004: File-Based Comment Storage
|
|
234
293
|
|
|
@@ -246,3 +305,29 @@
|
|
|
246
305
|
|
|
247
306
|
- API endpoints: `GET/POST/PUT/DELETE /api/comments` for CRUD operations
|
|
248
307
|
- Watch file for external changes (optional)
|
|
308
|
+
|
|
309
|
+
### TS-005: Shell Integration Architecture
|
|
310
|
+
|
|
311
|
+
- `shell/_readit` - Standard zsh compdef for subcommands, options, file args
|
|
312
|
+
- `shell/readit.zsh` - Rich widget: `@` prefix triggers fzf markdown file picker
|
|
313
|
+
- Uses `fd` for fast file listing, falls back to `find`
|
|
314
|
+
- fzf with bat/head preview, initial query from text after `@`
|
|
315
|
+
- `readit completion zsh|bash|fish` CLI subcommand outputs setup scripts
|
|
316
|
+
- Bash completion via `complete -F`, Fish via `complete -c`
|
|
317
|
+
|
|
318
|
+
### TS-006: Neovim Plugin Architecture
|
|
319
|
+
|
|
320
|
+
- `nvim-readit/lua/readit/init.lua` - Core: setup, server management, commands, keymaps
|
|
321
|
+
- `nvim-readit/plugin/readit.lua` - Auto-loader on markdown FileType
|
|
322
|
+
- `nvim-readit/lua/readit/health.lua` - `:checkhealth` module
|
|
323
|
+
- Discovers existing servers via `~/.readit/server.json`
|
|
324
|
+
- Starts server with `jobstart()`, attaches files via `POST /api/documents`
|
|
325
|
+
- Communicates with server via curl (non-blocking `jobstart`)
|
|
326
|
+
|
|
327
|
+
### TS-007: File Watcher Resilience
|
|
328
|
+
|
|
329
|
+
- `fs.watch()` with both `"change"` and `"rename"` event handling
|
|
330
|
+
- On rename: retry loop (10 attempts, 200ms apart) to re-establish watcher
|
|
331
|
+
- Debounced re-render (200ms) to avoid thrashing on rapid saves
|
|
332
|
+
- SSE auto-reconnect with exponential backoff (1s -> 30s max)
|
|
333
|
+
- Parallel fetch of document HTML + comments on reload
|
package/AGENTS.md
CHANGED
|
@@ -4,57 +4,61 @@ Instructions for AI coding agents working on this project.
|
|
|
4
4
|
|
|
5
5
|
## Project Context
|
|
6
6
|
|
|
7
|
-
readit is a CLI tool for reviewing Markdown documents with inline comments. The workflow is:
|
|
7
|
+
readit is a CLI tool for reviewing Markdown and HTML documents with inline comments. The workflow is:
|
|
8
8
|
|
|
9
9
|
1. User runs `readit document.md`
|
|
10
|
-
2.
|
|
11
|
-
3.
|
|
10
|
+
2. Server renders Markdown to HTML (markdown-it + shiki for syntax highlighting)
|
|
11
|
+
3. Bun.serve() starts and opens browser with Svelte 5 frontend
|
|
12
12
|
4. User selects text and adds comments
|
|
13
|
-
5. Comments are saved
|
|
13
|
+
5. Comments are saved as `.comments.md` files in `~/.readit/comments/`
|
|
14
14
|
6. User can export comments for AI or apply back to Markdown
|
|
15
15
|
|
|
16
16
|
## Development Commands
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
bun install # Install dependencies
|
|
20
|
+
bun dev # Start development (CLI with --watch)
|
|
21
|
+
bun run dev:client # Start Vite dev server only
|
|
22
|
+
bun run build # Build for production (Vite + CLI)
|
|
23
|
+
bun run test # Run unit tests (Vitest)
|
|
24
|
+
bun run test:e2e # Run e2e tests (Playwright)
|
|
25
|
+
bun run typecheck # TypeScript check
|
|
26
|
+
bun run check # Biome lint + format check
|
|
27
|
+
bun run check:fix # Fix lint + format issues
|
|
28
|
+
bun run format # Format code with Biome
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
## Code Organization
|
|
30
32
|
|
|
31
|
-
- `src/cli
|
|
32
|
-
- `src/server
|
|
33
|
-
- `src/components/` -
|
|
34
|
-
- `src/
|
|
35
|
-
- `src/lib/` - Utility functions
|
|
36
|
-
- `src/
|
|
33
|
+
- `src/cli.ts` - CLI entry point (Commander.js)
|
|
34
|
+
- `src/server.ts` - Bun.serve() server + API routes
|
|
35
|
+
- `src/components/` - Svelte 5 UI components
|
|
36
|
+
- `src/stores/` - Svelte 5 reactive stores (`.svelte.ts`)
|
|
37
|
+
- `src/lib/` - Utility functions, rendering, i18n
|
|
38
|
+
- `src/schema.ts` - TypeScript types
|
|
39
|
+
- `shell/` - Zsh/Bash/Fish completions and `@` file picker widget
|
|
40
|
+
- `nvim-readit/` - Neovim plugin (Lua)
|
|
41
|
+
- `vscode-readit/` - VS Code extension
|
|
37
42
|
|
|
38
43
|
## Testing
|
|
39
44
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- Run `
|
|
45
|
+
- Unit tests are co-located with source files (`*.test.ts`)
|
|
46
|
+
- E2E tests live in `e2e/` (Playwright)
|
|
47
|
+
- Run `bun run test` before committing
|
|
43
48
|
|
|
44
49
|
## Commit Guidelines
|
|
45
50
|
|
|
46
51
|
- Use conventional commits (feat:, fix:, docs:, etc.)
|
|
47
52
|
- Keep commits focused and atomic
|
|
48
|
-
- Run `
|
|
53
|
+
- Run `bun run typecheck && bun run check` before committing
|
|
49
54
|
|
|
50
55
|
## Adding Features
|
|
51
56
|
|
|
52
57
|
1. Check `.claude/user-stories.md` for planned features
|
|
53
|
-
2. Update types in `src/
|
|
54
|
-
3. Create/update
|
|
55
|
-
4. Create/update components
|
|
58
|
+
2. Update types in `src/schema.ts` first
|
|
59
|
+
3. Create/update stores if needed (`src/stores/`)
|
|
60
|
+
4. Create/update Svelte components (`src/components/`)
|
|
56
61
|
5. Add tests
|
|
57
|
-
6. Update CHANGELOG.md
|
|
58
62
|
|
|
59
63
|
## Key Files to Review
|
|
60
64
|
|
package/Makefile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.PHONY: dev build build-client build-server test test-client test-e2e clean
|
|
2
|
+
|
|
3
|
+
# Development: Go server manages Vite child process
|
|
4
|
+
dev:
|
|
5
|
+
cd go && go run ./cmd/readit -- --dev $(ARGS)
|
|
6
|
+
|
|
7
|
+
# Production build: frontend first, then Go embeds it
|
|
8
|
+
build: build-client build-server
|
|
9
|
+
|
|
10
|
+
build-client:
|
|
11
|
+
bunx vite build
|
|
12
|
+
|
|
13
|
+
build-server: build-client
|
|
14
|
+
rm -rf go/internal/server/dist
|
|
15
|
+
mkdir -p go/internal/server/dist
|
|
16
|
+
cp -r dist/. go/internal/server/dist/
|
|
17
|
+
cd go && go build -o ../dist/readit ./cmd/readit
|
|
18
|
+
|
|
19
|
+
# Tests
|
|
20
|
+
test:
|
|
21
|
+
cd go && go test ./...
|
|
22
|
+
|
|
23
|
+
test-client:
|
|
24
|
+
bun run test
|
|
25
|
+
|
|
26
|
+
test-e2e:
|
|
27
|
+
bun run test:e2e
|
|
28
|
+
|
|
29
|
+
clean:
|
|
30
|
+
rm -rf dist go/internal/server/dist
|
|
31
|
+
mkdir -p go/internal/server/dist
|
|
32
|
+
touch go/internal/server/dist/.gitkeep
|