A Changes tab in the bottom panel (ui/src/components/vcs/changes/): the project's changed files from git.status in Staged, Changes and Untracked groups, re-read on start, project open, gitChanged and vcs.refresh (serialised). A checkbox per file and per group stages or unstages through git.stage / git.unstage (a staged rename passes both paths); Space stages, Enter or a double-click runs vcs.showDiff when provided, else opens the file. A message box with Amend and Commit (also Mod+Enter) runs flushDirty() first, cancels when a save fails, then git.commit and toasts the short hash. All git calls go through runWaiting. UI commands vcs.openChanges (Mod+Alt+G), vcs.commit (Mod+K, focuses the message box) and vcs.refresh in a new Git menu group; gitChanged added to EngineEventPayload. 19 Vitest tests; palette, menu and catalog tests follow the new commands. Docs: architecture, gaps G8, Git parity row 4% (est.), ui/tooling checklists, roadmap M4 row, ROADMAP depth ~5.4% and log, README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
2.8 KiB
TypeScript
42 lines
2.8 KiB
TypeScript
/**
|
|
* 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: "editor.reveal", labelKey: "command.editor.reveal" },
|
|
{ id: "editor.complete", labelKey: "command.editor.complete", menuPath: "Edit/Complete Code" },
|
|
{ id: "editor.quickDocumentation", labelKey: "command.editor.quickDocumentation", menuPath: "Edit/Quick Documentation", defaultShortcut: "Mod+I" },
|
|
{ id: "editor.parameterInfo", labelKey: "command.editor.parameterInfo", menuPath: "Edit/Parameter Info" },
|
|
{ id: "find.open", labelKey: "command.find.open", menuPath: "View/Find in Files…", defaultShortcut: "Mod+Alt+F" },
|
|
{ id: "goto.classOpen", labelKey: "command.goto.classOpen", menuPath: "Go/Class…", defaultShortcut: "Mod+Alt+C" },
|
|
{ id: "goto.fileOpen", labelKey: "command.goto.fileOpen", menuPath: "Go/File…", defaultShortcut: "Mod+P" },
|
|
{ id: "goto.symbolOpen", labelKey: "command.goto.symbolOpen", menuPath: "Go/Symbol…", defaultShortcut: "Mod+T" },
|
|
{ id: "menu.open", labelKey: "command.menu.open", defaultShortcut: "Alt+M" },
|
|
{ id: "palette.open", labelKey: "command.palette.open", menuPath: "View/Command Palette", defaultShortcut: "Mod+Shift+P" },
|
|
{ id: "problems.open", labelKey: "command.problems.open", menuPath: "View/Problems", defaultShortcut: "Mod+Alt+P" },
|
|
{ id: "settings.open", labelKey: "command.settings.open", menuPath: "View/Settings…", defaultShortcut: "Mod+," },
|
|
{ id: "terminal.open", labelKey: "command.terminal.open", menuPath: "View/Terminal", defaultShortcut: "Mod+Shift+T" },
|
|
{ id: "view.toggleProjectTree", labelKey: "command.view.toggleProjectTree", menuPath: "View/Project", defaultShortcut: "Mod+1" },
|
|
{ id: "vcs.commit", labelKey: "command.vcs.commit", menuPath: "Git/Commit…", defaultShortcut: "Mod+K" },
|
|
{ id: "vcs.openChanges", labelKey: "command.vcs.openChanges", menuPath: "Git/Changes", defaultShortcut: "Mod+Alt+G" },
|
|
{ id: "vcs.refresh", labelKey: "command.vcs.refresh", menuPath: "Git/Refresh Changes" },
|
|
{ id: "view.toggleStructure", labelKey: "command.view.toggleStructure", menuPath: "View/Structure", defaultShortcut: "Mod+2" },
|
|
];
|