Problem
aidd_docs/memory/architecture.md documents a strict 3-layer flow: Infrastructure → Application → Domain, dependencies flow inward only. But 14 of 15 files in src/application/commands/ (e.g. doctor.ts:2, status.ts:2, restore.ts:2, marketplace.ts:7, plugin.ts:6, setup.ts:11, ai.ts:6, framework.ts:7) call createDeps()/createMenuDeps() imported directly from infrastructure/deps.js inside the action handler.
Why this needs a decision, not just a fix
It's systemic (100% of applicable command files) and consistent, and the leak stops at the wiring boundary — use-cases and domain never import infrastructure. That reads as a deliberate composition-root-in-commands pattern, not erosion. But it contradicts the architecture doc's own diagram with no documented exception, and it blocks unit-testing a command's action handler without constructing real/mocked infra.
Options
- Build the deps object once in
src/cli.ts and pass it into each registerXCommand(program, deps), so commands stop importing infrastructure directly.
- Amend
architecture.md to explicitly document commands as an allowed composition-root exception to the inward-only rule.
Acceptance criteria
Found by an architecture audit of cli/ — full report: cli/aidd_docs/tasks/2026_07/2026_07_22_audit/architecture.md.
Problem
aidd_docs/memory/architecture.mddocuments a strict 3-layer flow:Infrastructure → Application → Domain, dependencies flow inward only. But 14 of 15 files insrc/application/commands/(e.g.doctor.ts:2,status.ts:2,restore.ts:2,marketplace.ts:7,plugin.ts:6,setup.ts:11,ai.ts:6,framework.ts:7) callcreateDeps()/createMenuDeps()imported directly frominfrastructure/deps.jsinside the action handler.Why this needs a decision, not just a fix
It's systemic (100% of applicable command files) and consistent, and the leak stops at the wiring boundary — use-cases and domain never import infrastructure. That reads as a deliberate composition-root-in-commands pattern, not erosion. But it contradicts the architecture doc's own diagram with no documented exception, and it blocks unit-testing a command's action handler without constructing real/mocked infra.
Options
src/cli.tsand pass it into eachregisterXCommand(program, deps), so commands stop importing infrastructure directly.architecture.mdto explicitly document commands as an allowed composition-root exception to the inward-only rule.Acceptance criteria
src/application/commands/imports frominfrastructure/directlyarchitecture.mdstates the exception explicitly, with the reasoning aboveFound by an architecture audit of
cli/— full report:cli/aidd_docs/tasks/2026_07/2026_07_22_audit/architecture.md.