Skip to content

CLI

codegraph is one command with fifteen sub-commands. Every sub-command prints its own options with codegraph <command> --help; the pages below are that output, with the conventions the commands share stated once here.

codegraph <command> [options]

global options:
  -h, --help      Show this help.
  -v, --version   Print the codegraph version.

Conventions

Models load as a union. Every analysis command takes one or more model.jsonl paths and loads them as a single graph, so multi-language analysis is a longer argument list. With no path, a command reads this directory’s <current-dir>-codegraph.jsonl — what the extractor writes here. import is the exception: each path becomes its own store, never a union.

stdout is the artifact; stderr is everything human. Warnings, fold diagnostics and summaries never touch stdout, so a redirect always yields a clean file. There is no ANSI colour, and identical inputs give byte-identical output.

Two views on every graph. --internal-only drops stub (external) entities and every edge touching one. --declared-only keeps only declared facts and drops derived and dynamic-candidate edges. Every report names the view it was computed under.

--json prints the same information as a machine-readable object on stdout.

A sibling model.db — the SQLite analysis store — is built on first use and reused afterwards. --no-cache reads the JSONL directly; it is accepted by analyze, export, navigator, domain-facts and explain.

Exit codes distinguish a broken tool from a broken model: 0 success, 1 an internal bug, 2 a usage error, 3 findings. See Exit codes.

Commands

CommandWhat it does
validateCheck models against their language profile and the graph invariants.
analyzeReport dependencies, cycles, coupling or framework wiring over the loaded models.
importBuild the SQLite analysis store (model.db) beside a model.jsonl.
exportWrite the folded graph as DOT, JSON, CSV or PlantUML.
cityWrite the code city: modules as districts, types as buildings.
navigatorExplore the model: a searchable tree with per-node dependency detail.
domain-factsWrite per-type domain dossiers: joined facts for domain extraction.
explainExplain every operation, type and module with an LLM, bottom-up, into a side-car.
scmMine a repository’s history into a deterministic history.jsonl.
snapshotsExtract a repo at sampled revisions into a temporal store (model.db).
historyReport churn, hotspots and authorship over a mined history.jsonl.
timelineReport an entity’s life across the revisions of a temporal store.
replayBuild the entity-level city replay of a temporal store.
profilesPrint the language profiles core ships.

Reports and formats

analyze --report takes one of:

ReportWhat it answers
depswho depends on whom, with the number of base edges folded into each arrow
cyclesstrongly connected components, each with its tangle score and minimum feedback set; exit 3 when any exist
couplingafferent and efferent coupling (Ca/Ce) and instability, per module or type
wiringframework injection points and their corpus candidates (--framework spring); an inference, labelled as one

export --format takes one of dot, json, csv, plantuml. In DOT and PlantUML a solid edge means every folded base edge is declared and a dashed one contains an inference; stub nodes are dashed and grey (<<stub>> in PlantUML). At --level module the PlantUML element is package, at --level type it is class.

history --report takes one of summary, hotspots, authors, coupling, hidden, deadweight. The last two join a model (--model).

Ports

CommandDefault portDefault host
serve41770.0.0.0
history --serve41770.0.0.0
replay --serve41770.0.0.0

0.0.0.0 is every interface. --host 127.0.0.1 keeps the page on the local machine; --port 0 picks a free port. serve is the one page over a model — the navigator with the city as a tab; history --serve and replay --serve open the standalone city viewer on a replay.

Last updated on