All checks were successful
ci/woodpecker/push/ci Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2.5 KiB
2.5 KiB
P8-010 Scratchpad — Gateway Phase 2: CommandRegistryService + CommandExecutorService
Objective
Implement gateway-side command registry system:
CommandRegistryService— owns canonical command manifest, broadcasts on connectCommandExecutorService— routescommand:executesocket eventsCommandsModule— NestJS wiring- Wire into
ChatGatewayandAppModule - Register core commands
- Tests for CommandRegistryService
Key Findings from Codebase
CommandDef shape (from packages/types/src/commands/index.ts)
scope: 'core' | 'agent' | 'skill' | 'plugin' | 'admin'(NOTcategory)args?: CommandArgDef[]— array of arg defs, each withname,type,optional,values?,description?- No
aliasesrequired (it's listed but optional-ish... wait, it IS in the interface) aliases: string[]— IS present
SlashCommandResultPayload requires conversationId
- The task spec shows
{ command, success, error }withoutconversationIdbut actual type requires it - Must include
conversationIdin all return values
CommandManifest has skills: SkillCommandDef[]
- Must include
skillsarray in manifest
userId extraction in ChatGateway
client.data.userholds the user object (set inhandleConnection)client.data.user.idor similar for userId
AgentModule not imported in ChatModule
- ChatGateway imports AgentService via DI
- ChatModule doesn't declare imports — AgentModule must be global or imported
Worktree branch
- Branch:
feat/p8-010-command-registry - Working in:
/home/jwoltje/src/mosaic-mono-v1/.claude/worktrees/agent-ac85b3b2
Plan
- Create
apps/gateway/src/commands/command-registry.service.ts - Create
apps/gateway/src/commands/command-executor.service.ts - Create
apps/gateway/src/commands/commands.module.ts - Modify
apps/gateway/src/app.module.ts— add CommandsModule - Modify
apps/gateway/src/chat/chat.module.ts— import CommandsModule - Modify
apps/gateway/src/chat/chat.gateway.ts— inject services, add handler, emit manifest - Create
apps/gateway/src/commands/command-registry.service.spec.ts
Progress
- Create CommandRegistryService
- Create CommandExecutorService
- Create CommandsModule
- Update AppModule
- Update ChatModule
- Update ChatGateway
- Write tests
- Run quality gates
- Commit + push + PR
Risks
- CommandDef
argsshape mismatch from task spec — must use actual type SlashCommandResultPayload.conversationIdis required — handle missing conversationId