Computes module coupling metrics using the indexed dependency graph. Measures afferent coupling (incoming dependencies), efferent coupling (outgoing dependencies), and instability ratio. Uses existing graph edges — no re-parsing required.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
uri | string | Yes | — | File or directory path to analyze |
includeExternal | boolean | No | false | Include external/third-party dependencies in the analysis |
depth | number | No | 2 | How many levels of transitive dependencies to follow |
summary | boolean | No | false | Return a condensed summary instead of full breakdown |
What's the coupling profile for src/services/auth/?
Returns afferent/efferent counts and instability for the auth service module.
Show me coupling metrics for the entire src/ directory with a summary.
Uses summary: true to get a ranked overview of all modules by coupling.
Analyze coupling for src/api/ including external dependencies. I want to see how much we depend on third-party packages.
Sets includeExternal: true to include imports from node_modules, crates.io dependencies, pip packages, etc.
Show coupling for src/core/engine.rs with depth 3. I want to see the full dependency chain.
Follows dependencies three levels deep to reveal hidden transitive coupling.
For each module analyzed:
Ce / (Ca + Ce), ranging from 0.0 (maximally stable) to 1.0 (maximally unstable)Instability interpretation:
| Score | Meaning |
|---|---|
| 0.0 | Fully stable — many depend on it, it depends on nothing |
| 0.0–0.3 | Stable — changing it affects many consumers |
| 0.3–0.7 | Balanced |
| 0.7–1.0 | Unstable — depends on many, few depend on it |
| 1.0 | Fully unstable — depends on others, nobody depends on it |
depth: 1 for a quick overview, increase to 3 or more when investigating specific dependency chainsstellarion_codebase_health to see coupling in the context of overall project health