analyze
Report dependencies, cycles, coupling, framework wiring, or the entry points, outbound calls and reach a boundaries file finds.
Synopsis
codegraph analyze [model.jsonl...] [--report <deps|cycles|coupling|wiring|entrypoints|outbound|reach>] [--boundaries FILE] [--insights FILE] [--from entries|ID] [--via <facts|candidates|dispatch>] [--max-depth N] [--level <type|module>] [--internal-only] [--declared-only] [--no-cache] [--top N] [--json]Arguments
| Argument | Meaning | Default |
|---|---|---|
<model.jsonl...> | One or more model.jsonl paths, loaded together as ONE union (decision 5). With no path, the model the extractor writes in this directory. | <current-dir>-codegraph.jsonl |
Options
| Option | Meaning | Default |
|---|---|---|
--report <deps|cycles|coupling|wiring|entrypoints|outbound|reach> | Which analysis to run. | deps |
--boundaries FILE | The codegraph.boundaries/1 file (or an M23 stack table) entrypoints, outbound and reach apply; required by those three, refused by the others. | — |
--insights FILE | The insights store whose type concepts the file’s concepts rules read, opened read-only; missing or refused there, a usage error. Read only when the file holds a concepts rule. | <model>.insights.db beside the first model; none there: those rules are not evaluated, and the report says why |
--from entries|ID | reach: walk from every classified entry point, or from one entity id. Required by reach. | — |
--via <facts|candidates|dispatch> | reach: the inferences the walk takes, each adding to the one before. | facts |
--max-depth N | reach: stop N hops from the start. | no bound |
--level <type|module> | Fold the graph to this level before reporting. | module |
--internal-only | Drop stub (external) entities and every edge touching one. | — |
--declared-only | Keep only declared facts; drop derived and dynamic-candidate edges. | — |
--no-cache | Read the model.jsonl directly; never build or reuse a sibling model.db. | — |
--top N | Show only the N highest-ranked rows. | — |
--json | Print the same information as a machine-readable JSON object on stdout. | — |
-h, --help | Show this help. | — |
The three boundary reports read the base graph, never a fold: --level, --internal-only, --declared-only and --top are refused with them, as --from, --via and --max-depth are with any report but reach. What each prints, and the file they read: Boundaries.
Exit codes
0 ok · 1 internal error (a bug) · 2 usage error · 3 findings.
3 when the load was not clean, and — for --report cycles — whenever any strongly connected component exists. A CI job gating on cycles checks for exactly this code.
Example
$ codegraph analyze fixtures/java/expected/model.jsonl --report cycles --level type
cache: fixtures/java/expected/model.db
fold(type): 177 base edges aggregated into 78; 11 dropped (an endpoint has no type container in this view); 10 entities unplaceable.
2 dependency cycle(s) at type level under view all — exiting 3 (findings).
codegraph analyze — cycles
models: fixtures/java/expected/model.jsonl
level: type
view: all (nothing filtered — stubs and inferred edges included)
layer: every edge kind folded to type level
cycles: 2 strongly connected components, ranked by component size descending, ties by weight then first member
tangle: 40.0% overall — feedback weight 2 of 5 cyclic references (minimum feedback set)
self-dependencies after folding: 12
Trimmed after the summary block; the component listing follows.
See also
Last updated on