feat(commands): central command registry, command palette & shortcuts cheat-sheet (#721)#738
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
First deliverable for #721 (an epic). Introduces a single source of truth for
command → keybindingconsumed by both the native menu and the renderer, replacing today's three-places-per-shortcut wiring (menu accelerator + preload whitelist + ad-hockeydown/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.tsis pure data (id,title,category,accelerator,menuplacement), importable by main, renderer and tests.app-menu.ts) generates every accelerator menu item from the catalog; each click fires one unifiedcommand:runIPC.useCommands) dispatchescommand:runthrough a testedid → handlermap wired to functions that already exist inApp.tsx(no new feature logic). The palette calls the samerunCommand. Unknown ids no-op with a warning.What you get
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
accelerator-label,agent-cycle,cataloginvariants (unique ids, no duplicate accelerators),command-handlers(every id has a handler; routing),CommandPalette(filter/Enter/Escape), and extendedapp-menu.test.ts(every catalog accelerator present; clicks sendcommand:run).npm run typecheck:webclean;typecheck:nodeunchanged from baseline (only the pre-existing provisioning error remains).pdf.worker?urlsymlinked-node_modulesartifact — green on CI.)docs/architecture/app.md+preload.mdupdated for the catalog-driven menu;wiki-lintstructural checks PASS.Closes #721 partially (foundation); follow-up PRs land per-feature coverage and customization.
🤖 Generated with Claude Code