Skip to content

refactor(daemon): cut the last edges into the CLI schema layer (#2543) - #2562

Merged
thymikee merged 2 commits into
refactor/2543-command-registry-vocabularyfrom
refactor/2543-daemon-command-surface
Sep 14, 2026
Merged

refactor(daemon): cut the last edges into the CLI schema layer (#2543)#2562
thymikee merged 2 commits into
refactor/2543-command-registry-vocabularyfrom
refactor/2543-daemon-command-surface

Conversation

@thymikee

@thymikee thymikee commented Sep 13, 2026

Copy link
Copy Markdown
Member

Summary

Stacked on #2561. Cuts the daemon's last two src/cli-schema/ edges and, per review, makes command defaults a single source.

  • registry.ts now owns a COMMAND_DEFAULTS table typed on CommandFlags plus applyCommandDefaults. 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 and cli.ts closure are unchanged.
  • Removed the apps facet default, CommandSchema.defaults, and the earlier command-defaults module + parity guard. DEFAULT_APPS_FILTER collapses into resolveAppsFilter's provider fallback and stops being a public export.
  • session-action-recorder reads recordedFlagKeys from flag-registry; command-schema's now-unconsumed re-export is removed.
  • R10 now rejects any daemon import of 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 is scripts/mutation/ownership.test.ts (gestures.test.tsscroll-edge-state reachability), which fails identically on origin/main — pre-existing and unrelated to this change.

@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.52 MB 4.52 MB +477 B
Package (unpacked) 4.52 MB 4.52 MB +477 B
Package (download) 1.33 MB 1.33 MB +638 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.1 ms 26.9 ms +0.8 ms
CLI --help 76.4 ms 75.9 ms -0.5 ms

@thymikee

Copy link
Copy Markdown
Member Author

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.

@thymikee
thymikee added this pull request to stack #2563 September 13, 2026 17:01
…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.
@thymikee
thymikee force-pushed the refactor/2543-daemon-command-surface branch from e0e093c to 9ff38c2 Compare September 13, 2026 17:05
@thymikee

Copy link
Copy Markdown
Member Author

Addressed in 9ff38c2351.

One COMMAND_DEFAULTS table typed on CommandFlags now lives in registry.ts and serves both callers; the facet copy is gone. Chose registry.ts over a new module per your hint: the registry is already in both the CLI parser's and the daemon's eager closure, and it already declares every other command default as a literal (the defaultValue descriptors), so the table adds a literal rather than a new import — the registry entry stays 72 modules and cli.ts stays 295 (verified: eager-closure-budgets 600/600, and a probe importing the contracts/device facade into registry.ts grew 8 entries, so the literal is required, not just convenient).

DEFAULT_APPS_FILTER was only ever consumed by the facet + the fallback, so it collapses into resolveAppsFilter as a private const and drops out of the contracts/device facade rather than lingering as an unused export. Parity guard deleted — with one source there is nothing to keep in lockstep. CLI/daemon default parity now rests on both calling the same function (covered by the parser test, the daemon request-scope test, and a new registry unit test).

@thymikee

Copy link
Copy Markdown
Member Author

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.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 13, 2026
@thymikee
thymikee merged commit d77eff4 into main Sep 14, 2026
18 checks passed
@thymikee
thymikee deleted the refactor/2543-daemon-command-surface branch September 14, 2026 09:27
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-14 09:27 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant