refactor(core): move the command descriptor registry into its own workspace package

Merged
TH
2mo ago
+390-263

Summary

src/core/command-descriptor/, src/command-catalog.ts, src/core/wait-positionals.ts and src/core/parse-timeout.ts imported nothing from root src/, yet were the daemon's largest root coupling. They move as git renames into a new private package @agent-device/command-registry (deps: contracts, selectors), one subpath per module pointing straight at the moved file; no index.ts, no re-export at the old path. Every consumer — daemon, commands, mcp, cli, cli-schema, core, root, client, ai-sdk, scripts, tests — switches to the owning specifier; contracts is untouched. Six descriptor tests that import root src/ stay there, which a package may not do; the rest move unchanged. The __OWNER_FILES__ declaration moves with its only consumer.

Rebased onto dcd8b65, so it carries #2347's code-signature walker and #2346's daemon-request.ts / session-state.ts split. One test pins that the daemon code graph reaches this package, and two doc comments are corrected off their pre-#2347 figures.

Rename-only proof — git diff -M90% --stat origin/main...HEAD: 42 renames, all 12 moved sources at 92–100%.

Closes #2336.

Validation

pnpm check:affected --run on this tree: format, lint, typecheck, layering, di-seams, fallow, mcp-metadata, build, package, integration-node, macos-coverage green. vitest-related: 9746 passed, 3 failed — the chmod 0500 tests that fail identically at origin/main here, since uid 0 ignores the mode.

Daemon → root src/ value edges 148 → 112 (−36, ceiling 118), from pnpm depgraph. CLI help byte-identical to its base: 82 sections, one sha256.

Signature walk, measured against pre-#2347 main: 620 → 1,461 modules, 12 of them this package; cold walk ~90ms; and the CLI hot path — the cached per-invocation signature — 2.9ms → 7.5ms.

🤖 Generated with Claude Code

https://claude.ai/code/session_016DkNZCMWtm1KUbseKANADi