Skip to content

Web: Ctrl+K command palette and keyboard shortcuts - #38

Merged
HelloOjasMutreja merged 2 commits into
mainfrom
feat/web-command-palette
Oct 18, 2026
Merged

HelloOjasMutreja merged 2 commits into
mainfrom
feat/web-command-palette

Conversation

@Dang-ctrl

@Dang-ctrl Dang-ctrl commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #37.

Why

The page now has a lot to do (check, tour, agent replay, re-check, the drawer, seven sections) and a long scroll on a phone. A command palette gets a judge or a user to any of it, or any decision, in one keystroke, and makes the demo faster to drive live.

What

All in web/static/index.html, styled with the existing design system (pressed cards, --saffron selection, kind colours on the group tags):

  • Trigger: Ctrl+K (⌘+K on Mac) toggles a centred palette. A search pill in the header shows "Ctrl K" / "⌘ K"; on phones it is icon only.
  • Commands: Take the tour (tour()), Replay an agent session (scrolls to it and calls replay()), one "Check: …" per entry in EXAMPLES (through runCheck()), "Go to" each section, and toggle sound (clicks the existing #sound button).
  • Entries: every non-rejected ledger entry, filtered on statement, quote, reason, source and ruled-out alternatives. Enter opens it in the entry drawer from Web: open any decision to read it in its original conversation #37 (and swaps the drawer if one is already open).
  • Ranking: with a query, commands matched by name come first, then decisions, then checks that match only on their example text, so "postgres" puts the Postgres decision first.
  • Keyboard: ↑/↓ move and keep the row in view, Enter runs, Esc closes, a click on the scrim closes. Focus goes to the input on open and back to where it was on close.
  • Esc priority: one capture-phase keydown listener, registered once, handles the palette first, so Esc closes the palette, then the native dialog, then the drawer. Ctrl+K does nothing while the correction dialog or the tour is open.
  • "/" still focuses the check input. It moved into the same listener and now also skips when a modifier is held, the dialog or tour is open, or focus is in a select or contenteditable. Ctrl+Enter is unchanged.
  • A11y: role="dialog" + aria-modal, input as combobox with aria-activedescendant, a listbox of options with aria-selected. All labels go in through textContent.
  • Motion and layout: pop-in only under prefers-reduced-motion: no-preference. On phones it is full width with a 16px gutter and no horizontal scroll.
  • Gave the wall section an id (#wallsec) to jump to.

Test plan

  • pytest -q: 61 passed
  • Desktop (1280×800), real key presses: Ctrl+K opens, Esc closes
  • Typed "postgres", then Enter opened the Postgres decision in the drawer
  • Esc order with the drawer open: Ctrl+K, then Esc closed only the palette (focus back on the drawer), and a second Esc closed the drawer
  • "Check: …Postgres to MongoDB" ran a check and showed OVERRULED (recorded fallback, model offline); "Check: …mobile release…" ran a check
  • "Take the tour" started the driver.js tour; Ctrl+K is ignored during the tour
  • "Replay an agent session" scrolled to the replay and started it
  • Clicking the scrim closes the palette
  • "/" focuses the check input without typing a slash
  • Re-check still works: Not a conflict, Ctrl+Enter in the dialog (Ctrl+K ignored while it is open), Re-check, before → after comparison
  • 375px: icon-only trigger opens the palette, which is 16px from each edge; ↓×14 keeps the selection in view; scrollWidth is 375; a "Go to" jump works; the wall card still opens the drawer and Esc returns focus to the card
  • No JS console errors (the only error was the expected 502 from /api/check with the model offline)
  • Not tested on a real Mac (⌘+K) or in Safari

🤖 Generated with Claude Code

Summary by ShipWright

  • Added a Ctrl/⌘+K command palette to web/static/index.html with a search input, listbox of commands and decisions, and a footer of key hints.
  • Added a palette trigger button in the header pills and a palette dialog plus scrim markup.
  • Added a capture-phase keydown listener handling Ctrl/⌘+K, Escape, ArrowUp/Down, Ctrl+Home/End, Enter, and Tab while the palette is open.
  • Replaced the previous global '/' shortcut listener with one that also checks for SELECT elements and contenteditable targets, and skips when the ask dialog is open or a tour is running.

Change: Feature · Merge risk: 🟢 Low · updated on each push

Ctrl+K (Cmd+K on Mac), or the search pill in the header, opens a palette
that filters the page's actions (tour, agent replay, a check per example,
jumps to each section, sound) and every non-rejected decision, which opens
in the entry drawer. Arrow keys, Enter and Esc drive it; Esc closes the
palette before a dialog or the drawer. "/" still jumps to the check input,
now from one capture-phase key handler registered once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shipwright-agent

shipwright-agent Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Shipwright · Approve

Recommendation: approve PR #38 · Tier T1

Next step: ready to merge.

Walkthrough

This PR adds a command palette to the single-page web UI in web/static/index.html, opened via Ctrl/⌘+K or a header button, listing commands and ledger entries that can be filtered and run, along with the CSS and markup for the palette and a consolidated keyboard-shortcut listener.

Area / files Summary
Palette styles
web/static/index.html
Added CSS for the palette, scrim, input, option list, tags, footer, key buttons, and responsive/reduced-motion variants.
Palette markup
web/static/index.html
Added the header palette button, the scrim and dialog elements with search input and listbox, and an id on the wall section.
Palette logic and shortcuts
web/static/index.html
Added command and entry item builders, filtering and rendering, open/close/run functions, and a capture-phase keydown listener for palette and '/' shortcuts.

Estimated review effort: 3 (Moderate) · ~20 minutes
Change: Feature
Merge risk: 🟢 Low · tier T1

Review

11 findings are in the Shipwright check instead of an inline comment.

✅ Full review input coverage: 12/12 changed files · 4 review shard(s) · 653 changed lines.

Open the Shipwright check for full evidence and the audit bundle. Use /shipwright rerun to verify again.

@shipwright-agent shipwright-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShipWright reviewed this commit. See the ShipWright summary comment in the conversation for the walkthrough and findings.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@shipwright-agent shipwright-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShipWright reviewed this commit. See the ShipWright summary comment in the conversation for the walkthrough and findings.

@HelloOjasMutreja
HelloOjasMutreja merged commit f60cadd into main Oct 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants