refactor(#2384): leaf dispatch table + runCommand collapse (ADR-2346 P4) (#2392)

* refactor(#2384): leaf dispatch table + runCommand collapse (ADR-2346 P4)

Cutover all 55 remaining case arms from runCommand's switch to
HOST_COMMAND_ROUTERS. runCommand now contains only its default case
(~40 lines): the three-layer dispatch (capability → overlay → host table)
plus the unknown-command diagnostic. The 73-case switch is dissolved.

Each case body was relocated verbatim to a module-scope route*Command
function via a brace-matching extractor; inner break; statements (from
_dispatchNonFamily early-exit patterns) were converted to return;
(5 arms affected); loop break; statements preserved.

Closes #2384

* chore: retrigger CI
This commit is contained in:
Tom Boucher
2026-07-17 18:29:28 -04:00
committed by GitHub
parent d91e32b3ce
commit 81f7ab4df1
21 changed files with 1206 additions and 1314 deletions

View File

@@ -167,6 +167,19 @@ describe('HOST_COMMAND_ROUTERS registry', async () => {
'config-ensure-section', 'config-set', 'config-set-model-profile',
'config-get', 'config-new-project', 'config-path', 'migrate-config',
'research-store', 'research-plan',
// P4 all remaining leaf commands (ADR-2346 P4)
'agent', 'smart-entry', 'check', 'find-phase', 'commit', 'check-commit',
'commit-to-subrepo', 'pr-subrepo', 'verify-summary', 'template', 'task',
'frontmatter', 'eval', 'verification', 'generate-slug', 'current-timestamp',
'project-instruction-file', 'list-todos', 'list-seeds', 'verify-path-exists',
'quick-tasks-append', 'normalize-test-command', 'dispatch-should-flatten',
'agent-skills', 'skill-manifest', 'history-digest', 'phases',
'assumption-delta', 'requirements', 'gap-analysis', 'milestone', 'progress',
'uat', 'stats', 'todo', 'scaffold', 'loop', 'phase-plan-index',
'state-snapshot', 'summary-extract', 'websearch', 'workstream', 'worktree',
'docs-init', 'learnings', 'teams-status', 'detect-custom-files',
'from-gsd2', 'prompt-budget', 'update-context', 'classify-confidence',
'package-legitimacy', 'effort', 'user-story', 'drift-guard',
];
for (const cmd of allHostCommands) {
assert.ok(