Skip to content

feat(commands): central command registry, command palette & shortcuts cheat-sheet (#721)#738

Merged
svenmalvik merged 2 commits into
mainfrom
feat/command-registry-palette
Jun 14, 2026
Merged

feat(commands): central command registry, command palette & shortcuts cheat-sheet (#721)#738
svenmalvik merged 2 commits into
mainfrom
feat/command-registry-palette

Conversation

@svenmalvik

Copy link
Copy Markdown
Collaborator

What & why

First deliverable for #721 (an epic). Introduces a single source of truth for command → keybinding consumed by both the native menu and the renderer, replacing today's three-places-per-shortcut wiring (menu accelerator + preload whitelist + ad-hoc keydown/on() handler). Adds the two discoverability surfaces the issue asks for: a command palette and a shortcuts cheat-sheet.

Design spec: docs/superpowers/specs/2026-06-14-keyboard-command-registry-design.md (committed here).

Approach

src/shared/commands/catalog.ts is pure data (id, title, category, accelerator, menu placement), importable by main, renderer and tests.

  • Main (app-menu.ts) generates every accelerator menu item from the catalog; each click fires one unified command:run IPC.
  • Renderer (useCommands) dispatches command:run through a tested id → handler map wired to functions that already exist in App.tsx (no new feature logic). The palette calls the same runCommand. Unknown ids no-op with a warning.
  • No renderer global-keydown dispatcher — native menu accelerators already work reliably over the embedded xterm/Monaco. Lowest-risk path.

What you get

  • ⇧⌘P command palette (fuzzy) — distinct from ⌘P file Quick Open.
  • ⇧⌘/ shortcuts cheat-sheet overlay + a read-only Settings → Shortcuts tab.
  • Existing bindings migrated onto the catalog (Settings, Find in Files, panel toggles, favorites, Quick Open) — behavior unchanged.
  • New commands (reusing existing functions): new / next / previous / delete agent, commit, create PR, focus chat / terminal / file-tree, toggle theme.

De-confliction

Keys avoid Electron roles (⌘R, ⇧⌘R, ⌃⌘F, zoom, ⌘W/M/H/Q), Monaco bindings (⌘/, ⇧⌘O, ⌃G) and existing app bindings. The issue suggested ⌘/ for the cheat-sheet; this uses ⇧⌘/ because a native ⌘/ accelerator would globally steal Monaco's comment-toggle.

Deferred to follow-ups (per spec)

Editor tab next/prev/close (⌘W collision), rename/interrupt agent (no existing renderer fn), switch repo/workspace by key, and user-customizable keybindings (the Settings tab is read-only for now).

Testing

  • TDD on the pure units: accelerator-label, agent-cycle, catalog invariants (unique ids, no duplicate accelerators), command-handlers (every id has a handler; routing), CommandPalette (filter/Enter/Escape), and extended app-menu.test.ts (every catalog accelerator present; clicks send command:run).
  • npm run typecheck:web clean; typecheck:node unchanged from baseline (only the pre-existing provisioning error remains).
  • Full renderer + main/app suites: 797 passing. (4 editor suites fail to load locally on the pdf.worker?url symlinked-node_modules artifact — green on CI.)
  • docs/architecture/app.md + preload.md updated for the catalog-driven menu; wiki-lint structural checks PASS.

Closes #721 partially (foundation); follow-up PRs land per-feature coverage and customization.

🤖 Generated with Claude Code

svenmalvik and others added 2 commits June 14, 2026 00:13
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…heet (#721)

Introduce a single source of truth for command → keybinding, consumed by
both the native menu and the renderer, replacing the scattered menu
accelerators + ad-hoc keydown handlers + per-channel IPC.

- src/shared/commands/catalog.ts: the command catalog (id, title, category,
  accelerator, menu placement) — pure data shared by main and renderer.
- app-menu.ts generates every accelerator menu item from the catalog; each
  click fires one unified command:run IPC channel.
- useCommands dispatches command:run via a tested id→handler map wired to the
  existing App.tsx functions; unknown ids no-op with a warning.
- Cmd+Shift+P command palette (fuzzy) and Cmd+Shift+/ shortcuts cheat-sheet,
  plus a read-only Settings → Shortcuts tab.
- Migrate existing bindings (Settings, Find in Files, panel toggles, favorites,
  Quick Open) onto the catalog and add new commands: new/next/prev/delete
  agent, commit, create PR, focus chat/terminal/files, toggle theme.

Keys de-conflicted against Electron roles, Monaco (Cmd+/, Cmd+Shift+O, Ctrl+G)
and macOS conventions. Cmd+/ avoided (Monaco comment-toggle); cheat-sheet uses
Cmd+Shift+/. Editor tab nav, rename/interrupt agent and custom keybindings are
deferred to follow-ups per the design spec.

Docs: update app.md and preload.md for the catalog-driven menu + command:run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@svenmalvik svenmalvik requested a review from a team June 13, 2026 22:30
@svenmalvik svenmalvik merged commit 40ff54c into main Jun 14, 2026
1 check passed
@svenmalvik svenmalvik deleted the feat/command-registry-palette branch June 14, 2026 07:03
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.

Add keyboard shortcuts for almost every feature (central keymap + command palette)

1 participant