@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/bunfig.toml
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Performance Baseline
|
|
2
|
+
|
|
3
|
+
Captured: 2026-03-27
|
|
4
|
+
Machine: Darwin 25.3.0 (Apple Silicon)
|
|
5
|
+
Runtime: Bun
|
|
6
|
+
Build: production (`bun run build`)
|
|
7
|
+
|
|
8
|
+
## E2E Metrics (Playwright, Chromium)
|
|
9
|
+
|
|
10
|
+
### Initial Load
|
|
11
|
+
|
|
12
|
+
| Tier | Lines | Comments | FCP | DCL | All Highlights Painted | Highlights Found |
|
|
13
|
+
|------|-------|----------|-----|-----|------------------------|------------------|
|
|
14
|
+
| medium | 1,000 | 100 | 112ms | 74ms | **886ms** | 100 |
|
|
15
|
+
| large | 3,000 | 200 | 368ms | 22ms | **3,247ms** | 193 |
|
|
16
|
+
|
|
17
|
+
### Interactions
|
|
18
|
+
|
|
19
|
+
| Metric | Tier | Result |
|
|
20
|
+
|--------|------|--------|
|
|
21
|
+
| Add comment (time to new highlight) | medium | **98ms** |
|
|
22
|
+
| Text selection (median of 5) | medium | **9ms** |
|
|
23
|
+
| Tab switch (medium → medium-b, 100 → 100 comments) | medium | **414ms** |
|
|
24
|
+
|
|
25
|
+
### Scroll Performance
|
|
26
|
+
|
|
27
|
+
| Tier | Total Scroll Time | Long Tasks (>50ms) | P50 | P95 | P99 |
|
|
28
|
+
|------|-------------------|-------------------|-----|-----|-----|
|
|
29
|
+
| medium (1000 lines, 100 comments) | 8,953ms | 0 | 0ms | 0ms | 0ms |
|
|
30
|
+
| large (3000 lines, 200 comments) | 25,912ms | 3 | 106ms | 121ms | 121ms |
|
|
31
|
+
|
|
32
|
+
## Bundle Size
|
|
33
|
+
|
|
34
|
+
| Asset | Raw | Gzipped |
|
|
35
|
+
|-------|-----|---------|
|
|
36
|
+
| Main JS (index-*.js) | 667 KB | 206 KB |
|
|
37
|
+
| Total dist/assets/ | 6.5 MB | — |
|
|
38
|
+
| CSS (index-*.css) | 45 KB | — |
|
|
39
|
+
| CLI (cli.js) | 51 KB | — |
|
|
40
|
+
|
|
41
|
+
### Top chunks by size
|
|
42
|
+
|
|
43
|
+
| Chunk | Size | Purpose |
|
|
44
|
+
|-------|------|---------|
|
|
45
|
+
| index-DCIQ7W07.js | 652 KB | Main app bundle |
|
|
46
|
+
| chunk-XZSTWKYB.js | 426 KB | Mermaid core |
|
|
47
|
+
| cytoscape.esm.js | 424 KB | Mermaid dependency |
|
|
48
|
+
| katex.js | 250 KB | Math rendering (mermaid) |
|
|
49
|
+
| prism.js | 146 KB | Syntax highlighter |
|
|
50
|
+
| architectureDiagram.js | 143 KB | Mermaid architecture |
|
|
51
|
+
| chunk-7R4GIKGN.js | 124 KB | Mermaid support |
|
|
52
|
+
| esm.js | 112 KB | Mermaid support |
|
|
53
|
+
|
|
54
|
+
## Vitest Bench (Server-side Operations)
|
|
55
|
+
|
|
56
|
+
> Run with: `bun run bench`
|
|
57
|
+
|
|
58
|
+
### Anchor Resolution
|
|
59
|
+
|
|
60
|
+
| Benchmark | ops/sec | Mean | p99 |
|
|
61
|
+
|-----------|---------|------|-----|
|
|
62
|
+
| findAnchor — exact, medium doc | 340,789 | 0.003ms | 0.006ms |
|
|
63
|
+
| findAnchor — exact, large doc | 348,679 | 0.003ms | 0.006ms |
|
|
64
|
+
| findAnchorNormalized — large doc | 10,414 | 0.096ms | 0.406ms |
|
|
65
|
+
| findAnchorFuzzy — mutated text, large doc | 163 | **6.13ms** | 6.41ms |
|
|
66
|
+
| findAnchorWithFallback — 1 comment | 101 | **9.86ms** | 10.27ms |
|
|
67
|
+
| findAnchorWithFallback — 10 comments | 39 | **25.66ms** | 26.10ms |
|
|
68
|
+
| findAnchorWithFallback — 50 comments | 3 | **313.30ms** | 640.60ms |
|
|
69
|
+
|
|
70
|
+
### Comment Storage
|
|
71
|
+
|
|
72
|
+
| Benchmark | ops/sec | Mean | p99 |
|
|
73
|
+
|-----------|---------|------|-----|
|
|
74
|
+
| parseCommentFile — 1 comment | 881,595 | 0.001ms | 0.003ms |
|
|
75
|
+
| parseCommentFile — 10 comments | 165,610 | 0.006ms | 0.009ms |
|
|
76
|
+
| parseCommentFile — 50 comments | 34,588 | 0.029ms | 0.045ms |
|
|
77
|
+
| serializeComments — 1 comment | 2,011,903 | 0.0005ms | 0.001ms |
|
|
78
|
+
| serializeComments — 10 comments | 286,303 | 0.004ms | 0.005ms |
|
|
79
|
+
| serializeComments — 50 comments | 59,027 | 0.017ms | 0.029ms |
|
|
80
|
+
| computeHash — 300 lines | 169,082 | 0.006ms | 0.009ms |
|
|
81
|
+
|
|
82
|
+
### Margin Layout
|
|
83
|
+
|
|
84
|
+
| Benchmark | ops/sec | Mean | p99 |
|
|
85
|
+
|-----------|---------|------|-----|
|
|
86
|
+
| well-spaced — 1 comment | 6,192,537 | 0.0002ms | 0.0002ms |
|
|
87
|
+
| well-spaced — 10 comments | 942,048 | 0.001ms | 0.002ms |
|
|
88
|
+
| well-spaced — 50 comments | 167,170 | 0.006ms | 0.009ms |
|
|
89
|
+
| clustered — 10 comments | 932,383 | 0.001ms | 0.002ms |
|
|
90
|
+
| clustered — 50 comments | 165,792 | 0.006ms | 0.009ms |
|
|
91
|
+
| with input zone — 50 comments | 143,787 | 0.007ms | 0.010ms |
|
|
92
|
+
|
|
93
|
+
### Export
|
|
94
|
+
|
|
95
|
+
| Benchmark | ops/sec | Mean |
|
|
96
|
+
|-----------|---------|------|
|
|
97
|
+
| formatComment — single | 17,270,891 | 0.00006ms |
|
|
98
|
+
| generatePrompt — 10 comments | 927,600 | 0.001ms |
|
|
99
|
+
| generatePrompt — 50 comments | 189,187 | 0.005ms |
|
|
100
|
+
|
|
101
|
+
### Highlight System (DOM Operations) — *the optimization target*
|
|
102
|
+
|
|
103
|
+
| Benchmark | ops/sec | Mean | p99 |
|
|
104
|
+
|-----------|---------|------|-----|
|
|
105
|
+
| findTextPosition — 1 comment | 61,802 | 0.016ms | 0.033ms |
|
|
106
|
+
| findTextPosition — 10 comments | 17,713 | 0.057ms | 0.116ms |
|
|
107
|
+
| findTextPosition — 50 comments | 4,555 | 0.220ms | 0.634ms |
|
|
108
|
+
| getDOMTextContent — medium doc | 40,004 | 0.025ms | 0.055ms |
|
|
109
|
+
| getDOMTextContent — large doc | 17,498 | 0.057ms | 0.222ms |
|
|
110
|
+
| collectTextNodes — medium doc | 41,437 | 0.024ms | 0.070ms |
|
|
111
|
+
| collectTextNodes — large doc | 21,645 | 0.046ms | 0.113ms |
|
|
112
|
+
| **applyBatch + clear — 10 highlights, medium** | **2,308** | **0.433ms** | **2.156ms** |
|
|
113
|
+
| **applyBatch + clear — 50 highlights, large** | **660** | **1.515ms** | **5.350ms** |
|
|
114
|
+
|
|
115
|
+
## Key Bottlenecks (from analysis)
|
|
116
|
+
|
|
117
|
+
1. **All Highlights Painted** is the critical metric: 886ms (medium), 3,247ms (large)
|
|
118
|
+
- Dominated by: react-markdown parse → React reconcile → rAF → TreeWalker → Worker → TreeWalker → DOM surgery
|
|
119
|
+
2. **Tab switch** (414ms) is highlight re-application on a new document
|
|
120
|
+
3. **Large doc scroll** shows 3 long tasks (106-121ms) — likely margin note position recalculation or highlight intersection
|
|
121
|
+
4. **Bundle**: 667KB main + lazy mermaid (1MB+) means slow cold loads on constrained networks
|
|
122
|
+
|
|
123
|
+
## Optimization Targets
|
|
124
|
+
|
|
125
|
+
| Change | Metric to Watch | Current | Goal |
|
|
126
|
+
|--------|----------------|---------|------|
|
|
127
|
+
| Server-side MD rendering | FCP, All Highlights Painted | 886ms / 3,247ms | <100ms / <500ms |
|
|
128
|
+
| CSS Custom Highlight API | All Highlights Painted, Add Comment | 886ms / 98ms | <100ms / <20ms |
|
|
129
|
+
| Eliminate SPA waterfall | FCP | 112ms / 368ms | <30ms |
|
|
130
|
+
| Drop heavy client deps | Bundle size (main JS) | 667KB | <50KB |
|