Repository navigation
fix(web): apply [keybindings] remaps to the page's own hunk.web.* commands - #1338
benvinegar wants to merge 12 commits into
Conversation
The browser review page used the theme accent for pressed toggles, checked segments, the active panel tab, every note card, and the minimap viewport as well as for the selected hunk and file. An "on" control now uses a neutral raised fill, so the accent marks only where the reviewer is and what has keyboard focus. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The browser review page's toolbar was two rows of text buttons and wrapped to three at 800px. It is now one 44px row: layout, refresh, copy link, and the pane toggles are icon buttons, viewed progress is a ring, and the line and review toggles plus the theme picker live in a View menu that shows each shortcut. Adds the inline SVG icon module the rest of the page builds on. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…able The toolbar's Commands button named its key with a literal. It now reads the palette command's chord from the page's command table, the same source the help overlay and the palette use, so no control states a key of its own. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… row Four readability fixes on the browser review page. Line and file counts group their digits (+25,048 −47) with tabular figures. The command palette groups commands under section headings when the query is empty and shows shortcuts as key caps. Split view states "N unchanged lines" once per gap instead of once per column. The remaining text-glyph icons (close, disclosure, gap chevrons) use the icon module. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… ticks The browser review page's minimap was 44px of full-strength green and red, which turned into a barcode on a changeset of similar files. It is now 16px wide: one faint neutral block per file, thin ticks where the changes are (split red and green where a cell holds both), and viewed files drawn at lower strength. Note pips, agent marks, and the selected hunk keep the accent. Click and drag behavior is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tions
In the browser review stream every note and reply was its own box with
text buttons, and agents and people looked the same. A thread is now one
card: each message has an avatar, the author's name, a role chip, a
relative time, and its location in words ("line 13", "lines 14–16"),
with reply, edit, and delete as icon buttons and one Reply row at the
foot. The active note gets the accent ring back, moved in place as the
selection changes.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…y path A file header in the browser review stream now dims the directory and bolds the file name, states what kind of change it is in a chip (new, deleted, renamed with no content changes, binary, too large) instead of printing "+0 −0" and a sentence row, and gains a chevron that collapses any file, a copy-path button, and a button-like Viewed control whose shortcut hint comes from the keymap. Files with nothing to draw become header-only rows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t right The source-boundary gate scans for `from "…"` to find module specifiers, and a class name ending in `from` followed by a quote matched it. The old-path span is now `file-path-previous`, and the helper's field is `previous` to match. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The browser review page's sidebar encoded review state in terse glyphs: `*2` for notes, `✓` for viewed, `Δ` for changed since viewed. A note count is now a comment mark with the number, a viewed file dims and gets a green check, a file changed since viewed gets a refresh mark, and a folder shows how much of it is viewed (`1/40`). The header shows the file count, and Tree / Flat is an icon radiogroup. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e panel closed
The browser review page opened its side panel by default to say how big
a changeset is. A one-line strip above the stream now carries the size
badge, a sentence naming what most of the change is ("Mostly
data/huge.json (+24,999 −1). Without it: 46 files, +49 −46."), the
non-zero file roles, and a button to the Overview. The side panel starts
closed at every width and opens on Notes when the review has any. The
Overview tab drops zero rows and says what "Meaningful" leaves out.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…and copy notes The browser review page gains a bar along the bottom: viewed progress (moved from the toolbar), a button to the next unviewed file, the keys a reviewer uses most, the note count, and a button that copies the review's notes as Markdown. Every key shown is read from the resolved keymap by command id, so a remap in the user's config shows here as it does in the terminal, and an unbound command shows no hint. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rowser page A `[keybindings]` entry for a `hunk.web.*` command never reached the browser review page: the host resolved the table against the shared catalog alone, dropped the entry as an unknown id, and published only catalog ids in the review's keymap, so the page fell back to its own default (and the terminal reported an unknown command). The page's command declaration moves to `core/run/webLocalCommandCatalog.ts`, where the host can read it. The host folds the remappable page commands beside the catalog when it resolves the keymap a review publishes, so a remap, an unbind, a first binding of a command that ships unbound, and the exclusivity rule all apply to them. Terminal surfaces read only the names, to accept an entry without binding anything. The page binds every remappable page command through the resolved keymap and keeps its shipped chords only for a keymap that carries no entry for the id. The Ctrl/Cmd dialog chords (`hunk.web.commandPalette`, `hunk.web.goToFile`) stay fixed; an entry for either is reported as not remappable instead of as an unknown command. No default binding changes, and the session wire fixture is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
[Medium impact] The PR changes key configuration behavior in browser reviews and terminal screens. The PR appears safe to merge, with a non-blocking fix needed for page commands assigned to Findings
Fix with agent prompt### Issue 1
packages/hunk/src/app/review/sharedState.ts:101-102
**Slash remaps still open filter.** With `"hunk.web.toggleViewed" = "/"`, the host now publishes `/` and removes the default `V`. But `ReviewApp` adds `/` back to the empty `hunk.review.focusFilter` entry. Catalog commands run before page commands, so `/` focuses the filter instead of marking the file viewed, even though the hints advertise it. Account for the page's filter shortcut when resolving these bindings, and add a regression test for this case.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe host now resolves browser-only command shortcuts and sends them to the review page, including commands that ship without a key.
benvinegar explicitly deferred reporting conflicts between user-assigned page and catalog shortcuts because publishing those warnings needs a separate change. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Config[User keybindings] --> Host[Host resolves catalog and page commands]
Host --> State[Published review keymap]
State --> Page[Page keyboard, hints, palette, and help]
Config --> Terminal[Terminal resolves its own commands]
Terminal --> Skip[Page-only entries bind nothing]
Reviews (1) · Last reviewed commit: "fix(web): deliver [keybindings] remaps o..." · Reviewed by Greptile |
| ...WEB_LOCAL_COMMAND_KEY_DEFAULTS, | ||
| ], |
There was a problem hiding this comment.
Slash remaps still open filter. With
"hunk.web.toggleViewed" = "/", the host now publishes / and removes the default V. But ReviewApp adds / back to the empty hunk.review.focusFilter entry. Catalog commands run before page commands, so / focuses the filter instead of marking the file viewed, even though the hints advertise it. Account for the page's filter shortcut when resolving these bindings, and add a regression test for this case.
Knowledge Base Used: Browser review client
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/hunk/src/app/review/sharedState.ts
Line: 101-102
Comment:
**Slash remaps still open filter.** With `"hunk.web.toggleViewed" = "/"`, the host now publishes `/` and removes the default `V`. But `ReviewApp` adds `/` back to the empty `hunk.review.focusFilter` entry. Catalog commands run before page commands, so `/` focuses the filter instead of marking the file viewed, even though the hints advertise it. Account for the page's filter shortcut when resolving these bindings, and add a regression test for this case.
**Knowledge Base Used:** [Browser review client](https://app.greptile.com/-/switch-tenant?tenant=modem&next=%2Fcustom-context%2Fknowledge-base%2Fmodem-dev%2Fhunk%2F-%2Fdocs%2Fbrowser-review-client.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.c8ae4e8 to
d7ef8f2
Compare
Problem
A
[keybindings]remap of one of the browser review page's own commands never reached the page. Withthe page still showed and obeyed the default
V, and the terminal reportedKeybinding for unknown command "hunk.web.toggleViewed" ignored.docs/keybindings.mdsaid the page reads the same[keybindings]table, which was true for catalog commands only.Cause: the host resolved
[keybindings]against the shared catalog alone (resolveCommandKeys), so ahunk.web.*entry was dropped as an unknown id, and the keymap published in the review's shared state carried catalog ids only. The page declared its own commands inweb/commands/webLocalCommands.ts, whichcore/andapp/may not import, and fell back to their shipped chords.Approach
core/run/webLocalCommandCatalog.ts(import-free, registered in the browser's closed command-module set insource-boundaries.test.ts).web/commands/webLocalCommands.tskeeps the Ctrl/Cmd chord matcher and labels and re-exports the table, so page imports are unchanged.buildReviewPresentationDefaultsfolds the remappable page commands beside the catalog in the sameresolveCommandKeyscall and publishes them in the samepresentation.keymap. A remap, an unbind (false), a first binding of a command that ships unbound, and the exclusivity rule all apply to them by the existing resolver, with no page-side re-derivation.runLocalthe palette uses. The shipped chords remain only as the fallback for a keymap that carries no entry for the id: the catalog defaults before the shared state arrives, and a session built before this change registered with a newer daemon.Decisions worth a look
hunk.web.toggleHideViewed,toggleMinimap,togglePreview, the two copy-link commands,useSessionTheme,filesAsTree/filesAsList). Accepting those ids on the host without binding them on the page would have left the same kind of silent gap this PR closes, and the docs already describedtoggleHideViewedas "unbound".hunk.web.commandPaletteandhunk.web.goToFileare outside the shared chord grammar the page binds. They are not in the keymap. An entry for either is now reported asKeybinding for "hunk.web.commandPalette" ignored • its shortcut is fixed and cannot be remappedinstead of as an unknown command (a newfixedCommandNamesoption on the resolver)."hunk.web.toggleViewed" = "w"takeswfrom line wrapping in the page; the terminal keepswfor line wrapping, since the entry binds nothing there. Documented.Non-goals
Record<string, string[]>) is unchanged and is not part ofsession-wire.v22.json;wire.snapshot.test.tspasses without aHUNK_SESSION_DAEMON_VERSIONbump.Why core
Keybinding resolution is host behavior shared by every review surface; the page must not re-resolve config. The only new shared piece is the page-command table's location.
Tests
core/run/webLocalCommandCatalog.test.ts: every page id is underhunk.web.*and outside every terminal command set; remappable and fixed partition the table.ui/lib/keymap.test.ts: an inactive command's chord stays with the active command that holds it by default; a fixed command's entry is reported and the rest applies.app/review/sharedState.test.ts(host resolution): page commands publish with shipped chords; a remap, unbind, and first binding fold in; exclusivity in both directions and both spellings (V/shift+v); a fixed id never enters the keymap.ui/AppHost.interactions.test.tsx: in the terminal,"hunk.web.toggleViewed" = "q"raises no notice andqstill quits; a fixed id is reported.ui/status,ui/documentstests: page ids join the "inactive names raise no notice" loops.web/panel/panelCommands.test.ts,web/palette/paletteEntries.test.ts: the remapped key runs the command and the default does not; an unbound command binds once given a key; palette and help label from the resolved keymap.ui/lib/appCommands.test.ts: the new page-command table indocs/keybindings.mdis held to the declaration, ids and default keys.test/web/review-keybindings.e2e.ts: the expected-failure case from feat(web): add a review bar with progress, next unviewed, key hints, and copy notes #1337 now passes withtest.fail()removed, extended to check the help overlay; a new case binds a command that ships unbound.Commands run (macOS, Darwin 25.6.0; Bun 1.4.4):
bun run typecheckbun run lintbun run format:checkbun run deps:checkbun test ./test/review-conformancebun run build:web && bun run test:webbun run testbun run testfails on this machine on the base branch too. On a clean checkout ofclaude/web-ui-09-review-bar(c8ae4e8): 5841 pass, 55 fail. On this branch: the same 55 names fail and nothing else, apart fromfilesystemSource.observe.test.ts, a native file-watch test that fails 0, 1, or 2 cases across three consecutive reruns of the file alone. The 55 are environmental: 44 are extension tests that pick up a globally installed extension from this machine's real~/.config/hunk/extensions(Can't resolve './constants.js' in …/installed/hunk-diff-context/src), 8 are the known macOS/varvs/private/varpath comparisons, and 3 are file-watch and daemon-launcher timing tests. None touch keybindings.Not run:
bun run test:integrationandbun run test:tty-smoke(no terminal rendering, layout, or interaction change; the terminal change is that four surfaces recognize more ids as another surface's). Linux and Windows not tested locally.Visual check
In a real Chromium session started with
"hunk.web.toggleViewed" = "x"and"hunk.web.toggleHideViewed" = "H": the review bar's hint readsx viewed, the selected file's Viewed checkbox showsx, pressingxchecks it, and the help overlay's Browser section listsx mark the selected file viewed, or clear its markandH hide or show viewed files. Screenshots were captured locally.Known limitation / follow-up
A conflict that exists only in the page (a page command and a catalog command both given the same chord in
[keybindings]) is resolved first-wins on the host, as documented, but nobody reports it: the terminal skips page ids before conflict detection, and the host drops the issues from the keymap it publishes (it did before this change too). Surfacing page-keymap issues, in the page or on the headless runner's stderr, is a separate change.This PR description was generated by Claude Code using Claude Fable 5.2