M1.8: command palette, global keymap, UI commands

- Engine: ui.registerCommands (validated, replaces the previous set),
  UI commands in listCommands with ui: true and labelKey, running one
  through the engine emits uiCommand {id, params}.
- Frontend: ui/src/commands/ (keymap by key code, fuzzy ranking, Pinia
  commands store with handlers, recents and error toasts), the command
  palette (Mod+Shift+P), UI commands palette.open, settings.open (Mod+,,
  disabled until M1.9b) and view.toggleProjectTree (Mod+1). The editor's
  shortcuts.ts moved into the global keymap.
- Tests: engine and control-channel tests for registration and
  uiCommand, Vitest for keymap, ranking, store, palette and App wiring.
- Docs: architecture, ui-parity, target-app-parity, gaps, roadmap,
  ROADMAP, README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-16 16:59:43 +02:00
parent 2f8fef876b
commit 184b8a3468
33 changed files with 2282 additions and 233 deletions

View file

@ -0,0 +1,27 @@
/**
* UI commands: commands the frontend runs itself. They are registered with
* the engine (`ui.registerCommands`) so `listCommands`, the palette, the
* keymap and agents see them; running one through the engine comes back as
* a `uiCommand` event. Components supply the behaviour with
* `useCommandsStore().provide(id, handler)`; a UI command nobody provides
* is disabled.
*/
/** A UI command as registered with the engine. */
export interface UiCommandSpec {
/** Command id, `area.action` in camelCase. */
id: string;
/** Catalog key of the label. */
labelKey: string;
/** Menu path with `/` separators. */
menuPath?: string;
/** Default shortcut in Lutra notation. */
defaultShortcut?: string;
}
/** The frontend's UI commands. */
export const UI_COMMANDS: readonly UiCommandSpec[] = [
{ id: "palette.open", labelKey: "command.palette.open", defaultShortcut: "Mod+Shift+P" },
{ id: "settings.open", labelKey: "command.settings.open", defaultShortcut: "Mod+," },
{ id: "view.toggleProjectTree", labelKey: "command.view.toggleProjectTree", defaultShortcut: "Mod+1" },
];