chore(voyage): release v5.0.3 — annotation UX matches the claude-code-100x reference

The operator pointed at ~/repos/claude-code-100x/claude-code-100x/build-site.js
as the annotation reference from the start. v4.2/v4.3 built a bespoke
playground instead. v5.0.0 deleted it. v5.0.1 pointed at /playground
document-critique (Claude-leads, wrong direction). v5.0.2 was operator-led
but too thin (line-click + freeform note, no intent). v5.0.3 finally
matches the reference.

scripts/annotate.mjs rewritten:
  - Markdown rendered as proper article HTML (h1/p/li/ul/table/blockquote/pre)
    instead of line-numbered raw lines.
  - Pencil-toggle annotation mode in the topbar, default ON.
  - Select text OR click any element → form popover at cursor.
  - Three intent buttons: Fiks (red) / Endre (orange) / Spørsmål (blue).
  - Comment textarea. Save (Cmd+Enter), Cancel (Esc).
  - Section context auto-detected from nearest h1/h2.
  - Sidebar panel: annotations grouped by section, intent badges,
    snippet quotes, delete buttons, click-to-scroll with flash highlight.
  - Copy Prompt: structured markdown export with intent labels.
  - localStorage persistence keyed on absolute artifact path
    (voyage-annotate:v2: prefix to avoid colliding with v5.0.2 state).

Tests: 12 (up from 10), all passing. npm test: 518 / 516 pass / 0 fail / 2 skipped.

Reference: ~/repos/claude-code-100x/claude-code-100x/build-site.js
lines 1431–2255 (annotation UI section).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-05-13 15:08:20 +02:00
commit 9ba8b682ef
11 changed files with 974 additions and 491 deletions

View file

@ -1,6 +1,6 @@
# trekplan — Brief, Research, Plan, Execute, Review, Continue
![Version](https://img.shields.io/badge/version-5.0.2-blue)
![Version](https://img.shields.io/badge/version-5.0.3-blue)
![License](https://img.shields.io/badge/license-MIT-green)
![Platform](https://img.shields.io/badge/platform-Claude%20Code-purple)
@ -503,7 +503,7 @@ Both arguments are required. No interactive prompt — headless-safe.
---
## Reviewing and annotating artifacts (v5.0.2)
## Reviewing and annotating artifacts (v5.0.3)
`/trekbrief`, `/trekplan`, and `/trekreview` each end by running
`scripts/annotate.mjs` against the just-written `.md` and printing the
@ -528,40 +528,56 @@ the tab and reopen the same file.
```
You run `open` (or click the `file://` link in your terminal), the HTML
opens in your default browser. In the browser:
opens in your default browser. The annotation UX is modelled on
`claude-code-100x/build-site.js`:
- **Left:** the artifact, rendered with line numbers. Hover any line — the
gutter shows a `+`. Click — an inline textarea appears under that line.
Write your note, hit Save (or `⌘Enter`). The line gets a colored left
border + a number badge showing the annotation count on that line.
- **Right (sidebar):** every annotation you've made, sorted by line. Each
card shows the line reference (click to scroll), the target text
snippet, and your note text. Click the note to edit it, click `✕` to
delete. A **Clear all** button at the top wipes the slate.
- **Bottom:** a structured prompt that updates live with every note. A
**Copy Prompt** button. Click — your clipboard now has the prompt.
- **Topbar:** pencil-toggle button — annotation mode default ON. Click
to turn off (then you read the article normally, follow links, etc.).
A second button opens the sidebar panel.
- **Article body:** the artifact rendered as a proper article — headings,
paragraphs, lists, tables, code blocks, blockquotes. Hover any element
in mode and it highlights. To anchor on a specific phrase, **select
the text first**, then click. Otherwise the whole element becomes the
anchor.
- **Form popover** appears at the cursor with:
- **Section** (auto-detected from the nearest h1/h2 above).
- **Anchored to** — the exact text you selected, or the element's
first ~200 chars if you didn't select.
- **Three intent buttons:** **Fiks** (something is wrong — fix it),
**Endre** (change the wording / content), **Spørsmål** (an open
question — clarify or answer). Colored: red / orange / blue.
- **Comment** textarea (optional but helpful).
- **Cancel** / **Save**. Save stays disabled until you pick an intent.
Shortcut: `⌘Enter` to save, `Esc` to cancel.
- **Annotated elements** get an amber highlight + a number badge in the
margin showing how many annotations target that element.
- **Sidebar panel** (Show annotations) — every annotation grouped by
section, in document order. Each card shows the intent badge
(colored), the anchored snippet (mono-quote), the comment text, and a
delete button. Click a card to scroll the article to that element and
flash it.
- **Copy Prompt** at the foot of the panel — assembles every annotation
into one structured markdown prompt and copies it to your clipboard.
- **Clear all** wipes every annotation (after confirm).
- **Persistence:** every annotation is saved to browser `localStorage`
keyed on the artifact's absolute path. Refresh the tab or close the
browser and re-open — your notes are still there.
keyed on the artifact's absolute path (`voyage-annotate:v2:<abs path>`).
Refresh the tab or close the browser and re-open — your work is there.
You write your notes, click Copy Prompt, paste back into Claude. Claude
revises the `.md` freehand from your notes. **The operator drives every
annotation.** Claude never pre-generates suggestions in this flow.
You select / click, pick intent, write comment, repeat. When you're
done, Copy Prompt, paste back into this chat. Claude revises the `.md`
freehand from your notes. **The operator drives every annotation.**
Claude never pre-generates suggestions in this flow.
> **What v5.0.2 changed from v5.0.1.** v5.0.0 added a read-only HTML
> render that didn't afford annotation. v5.0.1 deleted that and pointed
> operators at `/playground document-critique` — but the `document-critique`
> template pre-generates **Claude's** suggestions and asks the operator to
> approve/reject them. That's "Claude leads, operator reacts" — the
> opposite of what was asked for. v5.0.2 ships `scripts/annotate.mjs`, a
> self-contained zero-dependency operator-annotation HTML generator. The
> operator clicks lines, writes their own notes, copies a structured prompt
> with every note. No Claude-generated suggestions in the loop.
>
> **Still removed from v5.0.0 onward:** the v4.2/v4.3 bespoke playground SPA,
> `/trekrevise`, Handover 8 (annotation → revision), the supporting `lib/`
> modules, and the Playwright e2e suite. See [CHANGELOG.md](CHANGELOG.md)
> § v5.0.0, § v5.0.1, and § v5.0.2.
> **What v5.0.3 changed from v5.0.2.** v5.0.2 was operator-led but the UX
> was too thin — click a line, type a freeform note, save. The reference
> the operator pointed at (`~/repos/claude-code-100x/claude-code-100x/build-site.js`)
> already had the right pattern: pencil-toggle, selection capture, three
> intent categories, popover form, structured markdown export. v5.0.3
> rebuilds `scripts/annotate.mjs` against that reference. v5.0.0 / v5.0.1
> / v5.0.2 are all superseded; only the v5.0.0 removals (bespoke
> playground SPA, `/trekrevise`, Handover 8, supporting `lib/` modules,
> Playwright e2e + devDeps) stay. See [CHANGELOG.md](CHANGELOG.md)
> § v5.0.0 → § v5.0.3.
---