Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ronaldjdev/forge/llms.txt
Use this file to discover all available pages before exploring further.
chain builds the complete multi-layer dependency graph for your project. It maps every import relationship across all four architectural layers — platform, features, shared, and infra — then computes a topological sort (the safe build and migration order), detects global dependency cycles, and identifies isolated components that have no inbound or outbound connections. Use chain before migrating a feature (to understand what it depends on), when diagnosing excessive coupling, or any time you need to reason about the full dependency topology of the system.
Usage
What chain Analyzes
chain performs a comprehensive dependency analysis across all layers:
Intra-layer dependencies
Dependencies within each layer: components inside
platform/ that depend on each other, use cases that reference domain entities, adapters that reference application services.Cross-layer dependencies
Dependencies between layers: which features consume which platform components, which adapters use which infra implementations, which cross-feature imports exist (valid or in violation of R8).
Topological ordering
The safe build order derived from the dependency graph — components with no dependencies first, then components that depend only on already-listed components. Critical for understanding migration sequencing.
Global dependency cycles
Circular dependency chains anywhere in the graph (regardless of layer). Cycles make the topological sort undefined and are reported as R9 ERROR violations.
Illegal dependency chains
Sequences of individually allowed edges that together violate architectural intent — for example, a path from a feature to infra that passes through a shared component, effectively smuggling a prohibited dependency.
Isolated components
Components that have no inbound or outbound edges — neither consumed by anything nor consuming anything. Often indicates dead code or a component that was scaffolded but never wired.
Output
The--json output contains a structured dependency graph object:
| Field | Description |
|---|---|
nodes | All components found, with their layer type |
edges | Every dependency edge, tagged as allowed or violation with the violated rule |
topologicalOrder | Safe build/migration order — components with no dependencies appear first |
cycles | Array of cycle chains; empty array means the graph is acyclic |
isolated | Components with no inbound or outbound edges |
Relationship to inspect
chain is not a standalone tool in isolation — it feeds directly into Forge’s architecture audit. The dependency data computed by chain contributes to two inspect scoring categories:
- Dependencies (15 pts): valid vs. invalid edge ratio, direction violations, cycle detection
- Graph (20 pts): overall graph health, risk score, and rule violations surfaced by the graph engine
chain executes as step 5 so that every subsequent operation — including inspect and inscribe — has up-to-date dependency data.
Dependency Rules Quick Reference
The following dependency directions are allowed in the graph:chain output: