@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/README.md
CHANGED
|
@@ -6,9 +6,6 @@ A CLI tool to review Markdown and HTML documents with inline comments. Add margi
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
9
|
Inspired by [difit](https://github.com/yoshiko-pg/difit).
|
|
13
10
|
|
|
14
11
|
## Requirements
|
|
@@ -30,12 +27,100 @@ readit <file> --host 0.0.0.0 # Custom host (default: 127.0.0.1)
|
|
|
30
27
|
readit <file> --no-open # Don't auto-open browser
|
|
31
28
|
readit <file> --clean # Clear existing comments
|
|
32
29
|
|
|
33
|
-
readit list
|
|
34
|
-
readit show <file>
|
|
30
|
+
readit list # List all files with comments
|
|
31
|
+
readit show <file> # Show comments for a file
|
|
32
|
+
readit open <files...> # Add files to running server
|
|
33
|
+
readit completion zsh # Output shell integration script
|
|
35
34
|
```
|
|
36
35
|
|
|
37
36
|
Select text to add comments. Comments appear as margin notes. Copy all comments formatted for AI with a single click.
|
|
38
37
|
|
|
38
|
+
## Shell Integration
|
|
39
|
+
|
|
40
|
+
readit provides rich shell completions and an `@` file picker for zsh, bash, and fish.
|
|
41
|
+
|
|
42
|
+
### Zsh (recommended)
|
|
43
|
+
|
|
44
|
+
Add to your `~/.zshrc`:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
eval "$(readit completion zsh)"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This gives you:
|
|
51
|
+
|
|
52
|
+
- **`@` file picker** -- type `readit @` and press Tab to open an fzf-powered markdown file picker with preview. Type `readit @test` + Tab to pre-filter to files matching "test".
|
|
53
|
+
- **Standard completion** -- Tab-complete subcommands (`open`, `list`, `show`, `completion`), options (`--port`, `--clean`), and markdown file paths.
|
|
54
|
+
- **Syntax highlighting** -- `@file.md` tokens are highlighted in cyan (requires [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting)).
|
|
55
|
+
- **`ri` alias** -- shorthand for `readit`.
|
|
56
|
+
|
|
57
|
+
Optional dependencies for the best experience: [fzf](https://github.com/junegunn/fzf), [fd](https://github.com/sharkdp/fd), [bat](https://github.com/sharkdp/bat).
|
|
58
|
+
|
|
59
|
+
### Bash
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
eval "$(readit completion bash)"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Fish
|
|
66
|
+
|
|
67
|
+
```fish
|
|
68
|
+
readit completion fish | source
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Neovim Plugin
|
|
72
|
+
|
|
73
|
+
The `nvim-readit` plugin lets you open markdown files in readit directly from Neovim. Edits in Neovim are reflected in the browser automatically via live reload.
|
|
74
|
+
|
|
75
|
+
### Installation (lazy.nvim)
|
|
76
|
+
|
|
77
|
+
```lua
|
|
78
|
+
{
|
|
79
|
+
dir = "path/to/readit/nvim-readit", -- or install from repo
|
|
80
|
+
ft = "markdown",
|
|
81
|
+
opts = {},
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Commands
|
|
86
|
+
|
|
87
|
+
| Command | Keymap | Description |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `:ReaditOpen` | `<leader>ro` | Open current buffer in readit |
|
|
90
|
+
| `:ReaditReload` | `<leader>rr` | Save and reload in browser |
|
|
91
|
+
| `:ReaditStop` | `<leader>rq` | Stop the readit server |
|
|
92
|
+
| `:ReaditStatus` | `<leader>ri` | Show server status |
|
|
93
|
+
| `:ReaditList` | `<leader>rl` | Pick from files with comments |
|
|
94
|
+
| `:ReaditOpenFile <path>` | -- | Open a specific file |
|
|
95
|
+
|
|
96
|
+
### Configuration
|
|
97
|
+
|
|
98
|
+
```lua
|
|
99
|
+
require("readit").setup({
|
|
100
|
+
bun_path = "bun", -- Path to bun executable
|
|
101
|
+
port = 0, -- 0 = auto-select free port
|
|
102
|
+
host = "127.0.0.1",
|
|
103
|
+
auto_open = true, -- Open browser on :ReaditOpen
|
|
104
|
+
keymap_prefix = "<leader>r", -- Change keymap prefix
|
|
105
|
+
})
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Run `:checkhealth readit` to verify your setup.
|
|
109
|
+
|
|
110
|
+
## Live Reload
|
|
111
|
+
|
|
112
|
+
readit watches open documents for changes and automatically refreshes the browser. This works with any editor:
|
|
113
|
+
|
|
114
|
+
- **Standard saves** -- detected via `fs.watch()` change events.
|
|
115
|
+
- **Vim/Neovim/Emacs saves** -- these editors write to a temp file then rename. readit detects rename events and re-establishes the file watcher automatically.
|
|
116
|
+
- **SSE auto-reconnect** -- if the browser loses its connection to the server, it reconnects with exponential backoff.
|
|
117
|
+
|
|
118
|
+
No configuration needed. Open a file with `readit`, edit it in any editor, and the browser updates within ~200ms.
|
|
119
|
+
|
|
120
|
+
## VS Code Extension
|
|
121
|
+
|
|
122
|
+
The `vscode-readit` extension provides a side-by-side preview panel inside VS Code. See [vscode-readit/](vscode-readit/) for details.
|
|
123
|
+
|
|
39
124
|
## Development
|
|
40
125
|
|
|
41
126
|
```bash
|
package/biome.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.4.
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
|
|
3
3
|
"vcs": {
|
|
4
4
|
"enabled": true,
|
|
5
5
|
"clientKind": "git",
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
"style": {
|
|
20
20
|
"noNonNullAssertion": "off"
|
|
21
21
|
},
|
|
22
|
-
"correctness": {
|
|
23
|
-
"useExhaustiveDependencies": "warn"
|
|
24
|
-
},
|
|
22
|
+
"correctness": {},
|
|
25
23
|
"complexity": {
|
|
26
24
|
"noForEach": "off",
|
|
27
25
|
"noImportantStyles": "off"
|
|
@@ -37,9 +35,7 @@
|
|
|
37
35
|
"useSemanticElements": "warn",
|
|
38
36
|
"useFocusableInteractive": "warn"
|
|
39
37
|
},
|
|
40
|
-
"security": {
|
|
41
|
-
"noDangerouslySetInnerHtml": "warn"
|
|
42
|
-
}
|
|
38
|
+
"security": {}
|
|
43
39
|
}
|
|
44
40
|
},
|
|
45
41
|
"css": {
|
|
@@ -65,5 +61,19 @@
|
|
|
65
61
|
"!!**/test-results"
|
|
66
62
|
],
|
|
67
63
|
"ignoreUnknown": true
|
|
68
|
-
}
|
|
64
|
+
},
|
|
65
|
+
"overrides": [
|
|
66
|
+
{
|
|
67
|
+
"includes": ["**/*.svelte"],
|
|
68
|
+
"linter": {
|
|
69
|
+
"rules": {
|
|
70
|
+
"correctness": {
|
|
71
|
+
"noUnusedImports": "off",
|
|
72
|
+
"noUnusedVariables": "off",
|
|
73
|
+
"noUnusedFunctionParameters": "off"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
69
79
|
}
|