- Add parseSlashCommand() with regex-based parser for /cmd [args] format - Add CommandRegistry with local-only commands (help, stop, cost, status, clear) and gateway manifest support - Add short alias resolution: /n→new, /m→model, /t→thinking, /a→agent, /s→status, /h→help, /pref→preferences - Add executeHelp() and executeStatus() local command handlers - Extend Message.role union with 'system' for in-TUI system messages - Handle commands:manifest socket event to update registry from gateway - Wire InputBar to intercept /commands before sending to socket - Render system messages as dimmed ⚙ prefix without avatar chrome - Expose addSystemMessage() and socketRef from useSocket hook Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.6 KiB
1.6 KiB
P8-009: TUI Phase 1 — Slash Command Parsing
Task Reference
- Issue: #162
- Branch: feat/p8-009-tui-slash-commands
Scope
- New files: parse.ts, registry.ts, local/help.ts, local/status.ts, commands/index.ts
- Modified files: use-socket.ts, input-bar.tsx, message-list.tsx, app.tsx
Key Observations
- CommandDef in @mosaic/types does NOT have
categoryfield — will omit from LOCAL_COMMANDS - CommandDef.args is
CommandArgDef[] | undefined, not{ usage: string }— help.ts args rendering needs adjustment - Message role union currently: 'user' | 'assistant' | 'thinking' | 'tool' — adding 'system'
- InputBar currently takes
onSubmit: (value: string) => void— need to add slash command interception - app.tsx passes
onSubmit={socket.sendMessage}directly — needs command-aware handler
Assumptions
- ASSUMPTION:
categoryfield not in CommandDef type — will skip category grouping in help output, or add it only to registry (not to CommandDef type) - ASSUMPTION: For the
argsfield display in help, will useCommandArgDef.nameandCommandArgDef.description - ASSUMPTION:
commands:manifestevent type may not be in ServerToClientEvents — will handle via socket.on with casting if needed
Status
- Create commands directory structure
- Implement parse.ts
- Implement registry.ts
- Implement local/help.ts
- Implement local/status.ts
- Implement commands/index.ts
- Modify use-socket.ts
- Modify input-bar.tsx
- Modify message-list.tsx
- Modify app.tsx
- Run quality gates
- Commit + Push + PR + CI