# Command System — Usage
How renderer and main code uses the command system. For the model and
architecture, see [README.md](./README.md).
## Public entry (renderer)
Import from the barrel only:
```ts
import { CommandContextMenu, CommandShortcut, CommandTooltip, useCommandHandler } from '@renderer/features/command'
```
Do not import subpaths such as `@renderer/features/command/presentation` from business
code. Keeping a narrow public API lets the runtime change without rewriting call
sites.
The renderer domain (`src/renderer/features/command/`) is intentionally not under
`components/` — most files are runtime plumbing rather than generic UI. It owns no
business state: business surfaces contribute only the minimal context keys and
handlers they are responsible for.
## Boundaries
- Shared command metadata, keybindings, menu contributions, and context‑expression
parsing live in `src/shared/command`.
- Main‑process command execution, native menu creation, and global shortcuts
belong to main services.
- Renderer business components must **not** parse shortcut preferences, format
shortcut labels, or resolve menu contributions directly — use the primitives
below.
## Registering handlers
`CommandProvider` resolves a keypress to a `CommandId`; components supply the
behavior:
```ts
useCommandHandler('topic.create', handleCreateTopic, { enabled: canCreateTopic })
```
For the same command, the most recently mounted **enabled** handler wins; when it
unmounts, the previous enabled handler becomes active again. A command with no
registered handler never resolves (so the keypress falls through untouched).
> While an editable target (``, `