Skip to content

feat(commands): §11e step 2 — registry + per-verb handler files (#264)#1333

Merged
itskai-dev merged 1 commit into
mainfrom
feat/commands-registry-step2
May 4, 2026
Merged

feat(commands): §11e step 2 — registry + per-verb handler files (#264)#1333
itskai-dev merged 1 commit into
mainfrom
feat/commands-registry-step2

Conversation

@itskai-dev

Copy link
Copy Markdown
Collaborator

Summary

Closes §11e step 2 of reflectt-cloud/docs/COMMAND_PLUGIN_SKILL_ARCHITECTURE.md. Replaces drain.ts's inline if/else dispatch with a registry lookup so adding a new verb is one entry in registry.ts plus one file in handlers/. Behavior-zero.

Changes

File What
src/commands/types.ts new — PendingCommand, CommandContext, CommandHandler
src/commands/registry.ts new — COMMAND_REGISTRY mapping cmd.type → handler
src/commands/handlers/context-sync.ts new — relocated from drain.ts
src/commands/handlers/run-approve.ts new — relocated from drain.ts
src/commands/drain.ts refactor — dispatch via COMMAND_REGISTRY with existing unknown-skip ack fallback; ~200 LOC → ~80 LOC

Net diff: +206 / -136.

Locks honored (kai msg-1777932028252 + link msg-1777932030625)

  • ✅ same poll cadence (10s active / 60s idle)
  • ✅ same ack contract (ack / complete / fail)
  • ✅ same unknown-skip semantics (skip + ack-complete with reason: 'unknown_type')
  • ✅ no auth / intake churn
  • ✅ no new verbs — the two existing verbs (context_sync, run_approve) become the first two registry entries
  • ✅ §11e steps 3 (routes/canvas) and 4 (routes/chat) explicitly out of scope

Proof bar

  • ✅ typecheck green (tsc --noEmit, exit 0)
  • ✅ 244/244 test files pass (2647 tests, 1 skipped)
  • ⏳ canonical staging command-queue smoke (poll → ack-complete on context_sync, ack-fail path) — post-merge

🤖 Generated with Claude Code

Replaces drain.ts's inline if/else dispatch with a registry lookup so
adding a new verb is one entry in registry.ts plus one file in
handlers/. Behavior-zero per kai+link locks (msg-1777932028252 /
msg-1777932030625):
  - same poll cadence
  - same ack contract
  - same unknown-skip semantics
  - no auth / intake churn
  - no new verbs (the two existing verbs become the first two registry
    entries — no scope creep)

New files:
  src/commands/types.ts                     — PendingCommand, CommandContext, CommandHandler
  src/commands/registry.ts                  — COMMAND_REGISTRY (context_sync, run_approve)
  src/commands/handlers/context-sync.ts     — relocated from drain.ts
  src/commands/handlers/run-approve.ts      — relocated from drain.ts

drain.ts is now ~80 LOC (down from ~200): poll + error tracking + dispatch
via registry with the existing unknown-skip ack fallback. Net diff +206/-136.

Closes §11e step 2 of reflectt-cloud/docs/COMMAND_PLUGIN_SKILL_ARCHITECTURE.md.
Step 3 (routes/canvas extraction) and step 4 (routes/chat extraction) are
explicitly out of scope for this PR.

Proof:
  - typecheck green
  - 244/244 test files pass (2647 tests, 1 skipped)
  - canonical staging command-queue smoke planned post-merge (poll, ack-complete, ack-fail)
@itskai-dev
itskai-dev merged commit dd48bb2 into main May 4, 2026
11 checks passed
@itskai-dev
itskai-dev deleted the feat/commands-registry-step2 branch May 4, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant