arch-checker
Objective
Detect and remediate illegal dependency edges with the smallest safe code change.
Workflow
- •Run
npm run arch:check. - •Identify the exact illegal edge from the error output (
from -> to). - •Apply the smallest remediation:
- •Move adapter/integration code upward to a higher layer.
- •Extract reusable primitives downward into
src/sharedwhen truly cross-layer. - •Replace direct import with an existing allowed interface.
- •Re-run
npm run arch:check. - •Re-run
npm run test -- tests/unit/architecture/dependencyBoundaries.test.ts. - •If imports changed materially, run
npm run check.
Remediation Patterns
- •
sharedimportingcoreorbot:- •Move business/runtime dependency out of
shared. - •Keep only generic utilities, types, and neutral primitives in
shared.
- •Move business/runtime dependency out of
- •
coreimportingbot:- •Move Discord-specific code into
bot. - •Pass data via core-facing interfaces instead of bot concrete modules.
- •Move Discord-specific code into
- •Intentional new edge:
- •Update
src/shared/architecture/dependencyBoundaries.ts. - •Update
docs/architecture/OVERVIEW.md. - •Record migration context in the repository issue tracker when partial.
- •Update
Guardrails
- •Preserve user-facing behavior.
- •Prefer moving code over weakening rules.
- •Do not relax boundaries without explicit architecture intent.
Output Contract
- •Report failing edge(s), concrete fix, and verification commands run.
- •Include whether policy files were updated or intentionally unchanged.