| name | add-command |
| description | Registers a new Spectra UI command in the command palette and optional keyboard shortcut with undo support. Use when adding menu actions, palette entries, shortcuts, or execute_command MCP targets in src/ui/commands/. |
Add UI Command
- Implement in
src/ui/register_commands.cpp
- Register with
CommandRegistry (unique dot-notation ID, label)
- Optional default binding in
src/ui/shortcut_manager.cpp
- Test:
tests/unit/test_command_registry.cpp
- Build; verify in palette (Ctrl+K) or MCP
list_commands / execute_command
Conventions
- IDs:
spectra.view.zoom_fit, spectra.file.export_png
- Labels: short, action-oriented
- State-changing commands →
UndoManager
- Group by category in palette
Verify: spectra-mcp execute_command with your command_id.