@erdemtuna/doc-review 0.7.0 → 0.8.0
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/README.md +12 -5
- package/package.json +3 -2
- package/src/SKILL.md +27 -5
- package/src/anchor-text.js +45 -0
- package/src/chrome-client.js +1272 -252
- package/src/chrome-session.js +70 -0
- package/src/chrome.css +278 -329
- package/src/chrome.html +81 -35
- package/src/cli.js +13 -5
- package/src/comment-anchor.js +22 -0
- package/src/comment-target.js +77 -0
- package/src/icons.js +251 -0
- package/src/paths.js +5 -1
- package/src/positioning.js +107 -0
- package/src/review-mode.js +59 -0
- package/src/sdk.js +792 -69
- package/src/serialize.js +0 -14
- package/src/server.js +15 -4
- package/src/state.js +20 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Doc Review
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Review HTML, Markdown, and localhost pages, edit when you choose, leave contextual comments, and send all feedback to your AI agent at once.
|
|
4
4
|
|
|
5
5
|
[Read the original Human Review launch post](https://creatoreconomy.so/p/use-my-human-review-skill-to-edit-html-markdown-visually)
|
|
6
6
|
|
|
@@ -51,9 +51,15 @@ Review a page running on localhost:
|
|
|
51
51
|
/doc-review (localhost URL)
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Doc Review opens
|
|
54
|
+
Doc Review opens in **View** (`Editing off, comments enabled`) so links, buttons, summaries, tabs, and application controls work normally. The centered mode selector switches to **Edit** (`Direct editing on`) when you want to change content directly. Commenting stays available in both modes.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Select text, or hover or focus an element, then use the nearby comment icon. `Ctrl+Alt+M` (`Cmd+Option+M` on macOS) opens a comment for the current selection. Press Enter to submit or Shift+Enter for a new line. On desktop the composer stays beside its target, or pins to the effective top or bottom scrolling edge when that target leaves view. **Back to selection** reveals the target without changing the draft. The full-width sheet is used only at the narrow responsive breakpoint.
|
|
57
|
+
|
|
58
|
+
**Comments** is the single toolbar entry point for the closed-by-default review drawer. Its feedback inventory scrolls independently while the overall note and **Send to agent** controls remain fixed. Submitting a comment creates its normal highlight and increments the count, but keeps the card closed until you activate its mark or choose **Jump to**. Focus returns to the exact element or selection you reviewed.
|
|
59
|
+
|
|
60
|
+
Aligned cards show **Edit**, **Close**, and **More**; drawer cards show **Jump to**, **Edit**, and **More**. Delete lives only in **More** and requires an inline confirmation. Quote hints preserve both the beginning and ending of long selections. Editing has explicit **Save** and **Cancel** controls: Enter saves, Shift+Enter adds a line, Escape cancels, and moving focus never autosaves. A draft follows its comment between aligned and drawer cards and keeps its caret through target movement.
|
|
61
|
+
|
|
62
|
+
For writable HTML files, Edit saves direct changes automatically. Markdown and localhost remain editable feedback-only surfaces: their rendered HTML is never written over the source, so click Send and let the agent apply those edits.
|
|
57
63
|
|
|
58
64
|
File and rendered Markdown reviews run with authored scripts and inline handlers
|
|
59
65
|
blocked, an opaque iframe origin, and no popup or download permission. Their
|
|
@@ -89,8 +95,8 @@ complete acknowledgement command is included in each response's `next_step`.
|
|
|
89
95
|
- **Resize images** by dragging their corner, and **move images** by dragging them to a new spot.
|
|
90
96
|
- **Rearrange the page** — hover any block and drag the handle on its left edge to move the whole block somewhere else.
|
|
91
97
|
- **Paste images** from your clipboard — file reviews save them beside the document; localhost reviews stage them for the agent to place in the app source.
|
|
92
|
-
- **Select a phrase and leave a comment**
|
|
93
|
-
- **Comment on an image, chart, or section**
|
|
98
|
+
- **Select a phrase and leave a comment** from the contextual icon, or press Ctrl+Alt+M / Cmd+Option+M.
|
|
99
|
+
- **Comment on an image, chart, control, or section** from its hover or keyboard-focus affordance without taking over its normal click.
|
|
94
100
|
- **Remove elements** without explaining the deletion in chat.
|
|
95
101
|
- **Command-click links** to review multiple pages without losing your feedback.
|
|
96
102
|
- **Send every edit and comment at once** instead of writing a long chat message.
|
|
@@ -107,6 +113,7 @@ Doc Review works well for editing AI-generated plans, updating landing pages, re
|
|
|
107
113
|
- [`SKILL.md`](src/SKILL.md) teaches Claude Code, Codex, and other agents how to use Doc Review.
|
|
108
114
|
|
|
109
115
|
Everything runs on your computer. Doc Review doesn’t require an account, cloud service, database, or API key.
|
|
116
|
+
Comment geometry remains local, transient presentation data and is never written to review state or sent to the agent. After the agent acknowledges the exact delivered `batch_id`, the comments carried by that batch disappear; newer comments and corrections remain.
|
|
110
117
|
|
|
111
118
|
## Upstream project
|
|
112
119
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erdemtuna/doc-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Review and edit agent-generated files and localhost pages in the browser, then send the whole batch back to your agent.",
|
|
5
5
|
"author": "Peter Yang",
|
|
6
6
|
"homepage": "https://github.com/erdemtuna/doc-review#readme",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@playwright/test": "^1.62.1",
|
|
52
|
-
"jsdom": "^29.1.1"
|
|
52
|
+
"jsdom": "^29.1.1",
|
|
53
|
+
"lucide-static": "^1.34.0"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"marked": "^18.0.7"
|
package/src/SKILL.md
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: doc-review
|
|
3
|
-
description: Open an HTML file, Markdown file, or localhost page in
|
|
3
|
+
description: Open an HTML file, Markdown file, or localhost page in a View-first browser review so the user can optionally edit, leave contextual comments, and send all feedback back to you. Use after writing or updating something the user will read — specs, plans, reports, newsletter drafts, landing pages, slide decks, and locally running web pages.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# doc-review
|
|
7
7
|
|
|
8
|
-
The user reviews your HTML, Markdown, or localhost page in a real browser
|
|
9
|
-
|
|
8
|
+
The user reviews your HTML, Markdown, or localhost page in a real browser. It starts in View,
|
|
9
|
+
where normal page controls work. They can switch to Edit, comment explicitly in either mode,
|
|
10
|
+
and send the whole batch at once.
|
|
10
11
|
|
|
11
12
|
Markdown files open rendered. Their quotes and edits reference the rendered text,
|
|
12
13
|
and the file itself is never touched — apply every change to the Markdown source,
|
|
13
14
|
keeping its formatting syntax.
|
|
14
15
|
|
|
16
|
+
Comments open from a contextual icon after a text selection or an element hover/focus.
|
|
17
|
+
The keyboard shortcut is Ctrl+Alt+M, or Cmd+Option+M on macOS. Enter submits the
|
|
18
|
+
comment and Shift+Enter adds a new line. On desktop the composer stays attached
|
|
19
|
+
to its target or pins to the effective top or bottom clipping edge; Back to
|
|
20
|
+
selection reveals an offscreen target without changing the draft.
|
|
21
|
+
|
|
22
|
+
Comments is the single toolbar entry point. The drawer inventory scrolls
|
|
23
|
+
independently while the overall note and Send to agent controls remain fixed.
|
|
24
|
+
Submitting creates the normal target mark and count but leaves the card closed
|
|
25
|
+
until the user explicitly activates the mark or chooses Jump to. Focus returns
|
|
26
|
+
to the reviewed element or selection. Aligned cards expose Edit, Close, and
|
|
27
|
+
More; drawer cards expose Jump to, Edit, and More. Delete is available only
|
|
28
|
+
through More and an inline confirmation. Long quote hints preserve both ends.
|
|
29
|
+
|
|
30
|
+
Existing-comment editing uses explicit Save and Cancel controls and never saves
|
|
31
|
+
on blur. Enter saves, Shift+Enter inserts a line, and Escape cancels. The draft,
|
|
32
|
+
focus, and caret follow the comment between aligned and drawer cards and survive
|
|
33
|
+
target movement. Closing an aligned card only hides its active presentation.
|
|
34
|
+
Acknowledging the exact delivered batch removes only the comments that batch
|
|
35
|
+
carried; newer comments and corrections survive.
|
|
36
|
+
|
|
15
37
|
## The loop
|
|
16
38
|
|
|
17
39
|
1. Write or update the HTML or Markdown file, or start the local page being reviewed.
|
|
@@ -139,5 +161,5 @@ guessing from the DOM:
|
|
|
139
161
|
<div data-container="Metrics callout">…</div>
|
|
140
162
|
```
|
|
141
163
|
|
|
142
|
-
`data-block` names a region for the edit list. `data-container` also
|
|
143
|
-
|
|
164
|
+
`data-block` names a region for the edit list. `data-container` also gives the block a
|
|
165
|
+
stable label for its hover/focus comment affordance.
|
package/src/anchor-text.js
CHANGED
|
@@ -113,3 +113,48 @@ export function tidy(text, limit = 0) {
|
|
|
113
113
|
if (!limit || flat.length <= limit) return flat;
|
|
114
114
|
return `${flat.slice(0, limit - 1).trimEnd()}…`;
|
|
115
115
|
}
|
|
116
|
+
|
|
117
|
+
function graphemes(text) {
|
|
118
|
+
if (typeof Intl?.Segmenter === "function") {
|
|
119
|
+
const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
120
|
+
return [...segmenter.segment(text)].map(({ segment }) => segment);
|
|
121
|
+
}
|
|
122
|
+
// Array.from is deterministic and, unlike string slicing, never splits a
|
|
123
|
+
// surrogate pair. Older engines may split a multi-code-point grapheme.
|
|
124
|
+
return Array.from(text);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function nearbyHeadBoundary(parts, ideal) {
|
|
128
|
+
for (let index = ideal; index >= Math.max(1, ideal - 8); index -= 1) {
|
|
129
|
+
if (/^\s$/u.test(parts[index - 1])) return index - 1;
|
|
130
|
+
}
|
|
131
|
+
return ideal;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function nearbyTailBoundary(parts, ideal) {
|
|
135
|
+
for (let index = ideal; index < Math.min(parts.length - 1, ideal + 8); index += 1) {
|
|
136
|
+
if (/^\s$/u.test(parts[index])) return index + 1;
|
|
137
|
+
}
|
|
138
|
+
return ideal;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Collapse whitespace and preserve both ends of a long quote. `limit` counts
|
|
143
|
+
* grapheme clusters, including the ellipsis.
|
|
144
|
+
*/
|
|
145
|
+
export function tidyMiddle(text, limit = 0) {
|
|
146
|
+
const flat = String(text == null ? "" : text)
|
|
147
|
+
.replace(/\s+/g, " ")
|
|
148
|
+
.trim();
|
|
149
|
+
if (!limit) return flat;
|
|
150
|
+
const parts = graphemes(flat);
|
|
151
|
+
if (parts.length <= limit) return flat;
|
|
152
|
+
if (limit <= 1) return "…";
|
|
153
|
+
|
|
154
|
+
const available = limit - 1;
|
|
155
|
+
const idealHead = Math.ceil(available * 0.6);
|
|
156
|
+
const idealTailStart = parts.length - (available - idealHead);
|
|
157
|
+
const headEnd = nearbyHeadBoundary(parts, idealHead);
|
|
158
|
+
const tailStart = nearbyTailBoundary(parts, idealTailStart);
|
|
159
|
+
return `${parts.slice(0, headEnd).join("").trimEnd()}…${parts.slice(tailStart).join("").trimStart()}`;
|
|
160
|
+
}
|