refactor(daemon): cut the last edges into the CLI schema layer (#2543) - #2562
refactor(daemon): cut the last edges into the CLI schema layer (#2543)#2562thymikee wants to merge 2 commits into
Conversation
Size Report
Startup median (7 runs, lower is better):
|
|
Current defaulting behavior is preserved on e0e093c, but the ownership requirement in #2543 is not: src/commands/management/app.ts:109 still declares the apps-filter default, and packages/command-registry/src/command-defaults.ts:9 declares it again. The parity test detects drift but leaves two declarations to maintain. Please make one defaults table typed on CommandFlags serve both callers and remove the facet copy. The CLI already loads the registry and the facet that imports DEFAULT_APPS_FILTER, so placing the table/application function in an already-loaded registry module is a concrete alternative to adding a new module to its eager closure. Verify the closure budget and CLI/daemon default parity after that change. The new daemon boundary check is otherwise sound; no current runtime divergence was found. CI was still finishing its last smoke check at review time. |
…I-schema edges The daemon resolved routes through the command registry but still reached two symbols across the layer boundary — recordedFlagKeys and applyCommandDefaults — both imported from src/cli-schema/command-schema.ts, and the apps filter default was declared a second time in the apps facet. The registry is now the single source of command defaults: a COMMAND_DEFAULTS table typed on CommandFlags plus applyCommandDefaults sit in registry.ts, where every other command default (the defaultValue descriptors) is already declared. The CLI parser and the daemon request scope both import it from @agent-device/command-registry/registry, the one module already in both callers' eager closure. Registry and CLI closure are unchanged: the table adds a literal, not a new import, so no entry grows. The apps facet default and CommandSchema.defaults go away; DEFAULT_APPS_FILTER collapses into resolveAppsFilter's provider fallback and stops being a public export. session-action-recorder reads the recorded-flag vocabulary straight from @agent-device/command-registry/flag-registry, and removing that import also drops command-schema's now-unconsumed recordedFlagKeys re-export. Part of #2545 / #2543.
R10 (scripts/layering/daemon-modularity) now rejects any daemon import of src/cli-schema/, value or type. The last two value edges into command-schema.ts are gone, so a total boundary is available, and an explicit rule beats a rank that would let the next daemon module reach the CLI schema layer again. Part of #2545 / #2543.
e0e093c to
9ff38c2
Compare
|
Addressed in One
|
|
The duplicate defaults are resolved in 9ff38c2: CLI and daemon now use the same registry-owned table. No remaining findings in this follow-up; checks are green and this is ready for human review. |
Summary
Stacked on #2561. Cuts the daemon's last two
src/cli-schema/edges and, per review, makes command defaults a single source.registry.tsnow owns aCOMMAND_DEFAULTStable typed onCommandFlagsplusapplyCommandDefaults. The CLI parser and the daemon request scope both import it from@agent-device/command-registry/registry— the one module already in both callers' eager closure. The table adds a literal (registry already declares every other default as a literal), not a new import, so the registry entry andcli.tsclosure are unchanged.CommandSchema.defaults, and the earliercommand-defaultsmodule + parity guard.DEFAULT_APPS_FILTERcollapses intoresolveAppsFilter's provider fallback and stops being a public export.session-action-recorderreadsrecordedFlagKeysfromflag-registry;command-schema's now-unconsumed re-export is removed.src/cli-schema/(value or type).Validation
Head
9ff38c2351(stacked on #2561). Green:check:layering(234/234, incl. the new R10 boundary),typecheck,eager-closure-budgets(600/600),check:production-exports(parity 68),check:mcp-metadata,check:command-docs,lint,format, and the affected unit suites (command-registry, cli-schema, cli parser, daemon request/management, MCP parity).check:affected's only failure isscripts/mutation/ownership.test.ts(gestures.test.ts→scroll-edge-statereachability), which fails identically onorigin/main— pre-existing and unrelated to this change.