Skip to content

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

ArgumentMeaningDefault
<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

OptionMeaningDefault
--report <deps|cycles|coupling|wiring|entrypoints|outbound|reach>Which analysis to run.deps
--boundaries FILEThe codegraph.boundaries/1 file (or an M23 stack table) entrypoints, outbound and reach apply; required by those three, refused by the others.—
--insights FILEThe 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|IDreach: 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 Nreach: stop N hops from the start.no bound
--level <type|module>Fold the graph to this level before reporting.module
--internal-onlyDrop stub (external) entities and every edge touching one.—
--declared-onlyKeep only declared facts; drop derived and dynamic-candidate edges.—
--no-cacheRead the model.jsonl directly; never build or reuse a sibling model.db.—
--top NShow only the N highest-ranked rows.—
--jsonPrint the same information as a machine-readable JSON object on stdout.—
-h, --helpShow 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

Exit codes · model.db · CLI conventions

Last updated on