Repository navigation
feat(web): command palette backed by a single command registry (#224) - #233
Merged
Merged
Conversation
Every user action is now described once in a command catalog (useAppCommands) and consumed three ways: - useGlobalShortcuts becomes a thin dispatcher: guard order only; which key does what lives in the registry. Key specs carry tri-state modifiers so the per-key Shift handling of the old handler is preserved bit-exact, and the subscription-time capture keeps the original staleness profile (the double-Ctrl+R quirk still pinned). - ShortcutsModal renders its table from the registry, so a shortcut can no longer be advertised without being bound (#56 drift). - New CommandPalette (Ctrl+Shift+P, status-bar Commands button): fuzzy-filtered commands with recents (localStorage), quick-open over the loaded files, disabled commands listed dimmed with their reason, fixed-height layout, useModalA11y semantics. Supporting moves: the launch-with-arguments dialog leaves ContextMenu as LaunchArgsDialog (reachable from the palette too), Copy Directory gets a real handler, fileProperties gains fileExtension/parentDirectory reuse. The fuzzy matcher scores the best alignment via a small DP — a greedy leftmost pass ranked 'camera barcode scanner' above 'Switch theme' for the query 'theme', and matched long paths as accidental subsequences (paths now only match literally). Web suite 405 -> 489 tests; tsc clean; dist rebuilt. Verified in a real browser: open/run/recents, quick-open ordering, shortcuts sheet, legacy focus shortcuts, args dialog, both themes. Closes #224
…et (#224) The command palette lists every command together with its binding, so a separate shortcuts sheet repeated the same registry view one click away. Removes ShortcutsModal, its status-bar button and the showShortcuts state; '?' and Ctrl+/ become alternative bindings of view.commandPalette (open-only, never a toggle). Nothing is lost at the point of use: the workflow gate buttons already embed their own Y/S/N/Enter key hints (WorkflowRunnerModal KeyHint), which was the only content the modal had that the palette does not. Web suite 489 -> 485 tests (the modal's five replaced by a palette-bindings test); tsc clean; dist rebuilt.
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 does this PR do?
Implements the command palette (#224, closed by the second commit's follow-up). Every user action is now described once in a command catalog (
useAppCommands) and consumed three ways:useGlobalShortcutsbecomes a thin dispatcher — it owns only the order of the guards (Escape → modal guard → pre-guard focus helpers → control/input guards → registry lookup); which key does what lives in the registry. 45 commands total.CommandPalette(Ctrl+Shift+P, plus a visible Commands button in the status bar): fuzzy-filtered commands grouped by registry group, a Recent section persisted inlocalStorage(profiles-recent-commands), quick-open of the loaded files by name, disabled commands listed dimmed with their reason (never hidden), fixed-height layout,useModalA11yfocus/Escape semantics.ShortcutsModalis removed (second commit): the palette lists every command together with its binding, so a separate shortcuts sheet repeated the same registry view one click away.?andCtrl+/keep working as alternative bindings of the palette command. The modal's only unique content — the workflow-gate Y/S/N/↵ keys — is already embedded in the gate buttons (WorkflowRunnerModal'sKeyHint), so nothing is lost at the point of use.Supporting moves: the launch-with-arguments dialog leaves
ContextMenuas a reusableLaunchArgsDialog(reachable from the palette too), "Copy Directory" gets a real App handler instead of inline clipboard code, andfileExtension/parentDirectoryconsolidate intoutils/fileProperties.Behaviour preservation
true/false/undefined) so the old handler's per-key Shift handling is preserved bit-exact: Shift still disambiguates L/K/T/B, and Ctrl+Shift+K stays free.A matcher bug the App-level tests caught
The first fuzzy scorer used greedy leftmost alignment: for the query
themeit ranked "Open the camera barcode scanner" above "Switch theme", and matched long paths as accidental subsequences (readme→…dist-info/METADATA). Rewritten as a small best-alignment dynamic program; relative paths now only match literally; the Commands/Files sections are ordered by their best score. Regression tests pin both cases.Closes #224
Type of change
Pre-commit checklist
vitest, 485 tests / 37 files) andtsc -bis cleanAGENTS.mdtree change needed (no new directories; web tests stay colocated)dist/rebuilt and committed per CONTRIBUTINGTesting
utils/commands.test.ts(key matching incl. tri-state modifiers, no-clash guard, best-alignment fuzzy scoring, ranking/recency, file scoring),useAppCommands.test.tsx(catalog guarantees: unique ids, truthful disabled states, every binding displayable, no key claimed twice; each key → its callback with exact original arguments; navigation computes; context-menu anchor math),CommandPalette.test.tsx(18 component tests),useRecentCommands.test.ts,App.commandPalette.test.tsx(7 App-level wiring tests against the fully mocked API client), plus a rewrittenuseGlobalShortcuts.test.tsx(dispatcher guards + staleness profile).profiles --server-only): palette open/run/recents in both themes, quick-open ordering after the relevance fix, shortcuts via?, legacy focus shortcuts, context-menu → args-dialog flow, status-bar button. Verification server stopped afterwards.Screenshots
Verified in a real browser in both themes (dark and light): grouped commands with the active row highlighted, key hints in each row and in the footer (
↑↓ Move · Enter Run · Esc Close), disabled commands dimmed with their reason, Recent section on reopen.