What does it look like?
codegraph city gson.jsonl --serve
Packages are districts, nested like the packages they are. Classes are buildings whose height and footprint follow the metrics you choose: lines of code and member count by default, cyclomatic complexity when the extractor measured it. Dependencies are arcs from roof to roof.
A dependency the model inferred is drawn desaturated, so it can never pass for a fact. Red is reserved for the edges whose cut would break a cycle. Unmeasured buildings are drawn at the minimum and labelled unmeasured rather than faked.
Read the tutorial on reading a cityWhat exactly depends on what?
codegraph navigator gson.jsonl --serve
A searchable tree of modules, types and members. Select anything and read its incoming and outgoing dependencies classified by role, with the member that carries each one, its provenance, and the file and span where it happens. The dependency graph, the cycle report and the coupling ranking are one tab away.
Read the tutorial on the navigatorHow did it get this way?
codegraph scm ~/src/gson
codegraph snapshots ~/src/gson --jar codegraph-java.jar --tags
codegraph replay --store gson.db --history gson-history.jsonl --serve
Hotspots, ownership and co-change come from git alone. Sample a repository at its tags into a temporal store and replay the city through the years: buildings rise at birth and sink at death, change heat and age ride the colours, and files that always change together are joined by a dashed arc the declared graph cannot explain.
The join runs the other way too: declared dependencies that history never exercised together are reported as dead weight.
Read the tutorial on replaying historyWhat does it mean?
codegraph explain gson.jsonl --src gson/src/main/java --estimate
codegraph explain gson.jsonl --src gson/src/main/java --max-calls 50
A language model explains the leaf operations first, then their callers, then the types and the packages that own them. Each prompt carries the explanations already written for what the unit depends on, so every summary rests on parts already explained, and mutually dependent units are explained as one.
We estimate tokens and cost before a single call is made, and a re-run redoes only what changed. On the reference corpus a full run was 68 calls and about six cents. Explanations live in a side-car file; the model itself is never touched.
Read the tutorial on explanationsWhy the picture can be trusted
Facts and inferences never share an edge.
Every edge carries a provenance: declared, derived, dynamic-candidate or generated. A dependency read from the source is a different thing from one inferred from a framework annotation, and every report, picture and export keeps the two apart. --declared-only gives you the facts alone.
Every claim points at a line.
Entities and edges carry a source anchor. When the navigator says one class depends on another through a given method, it shows the file and the span where that happens.
No build is required.
The Java extractor runs Spoon without a classpath. What it cannot resolve becomes an explicit stub whose edges are kept, and stubs are decided by what the corpus declares, never by guessing from a package name.
The outputs are boring on purpose.
Standard output is the artifact and standard error is for humans. Identical input gives byte-identical output, so a model diffs in a repository. Exit codes tell a bug in codegraph apart from a finding about your code, so a pipeline can gate on either.
Read why facts and inferences never mixSixty seconds to a city
git clone https://gitlab.com/jgrodziski/codegraph.git && cd codegraph
pnpm install && pnpm -r build
(cd extractors/java && ./mvnw -B package)
java -jar extractors/java/target/codegraph-java.jar \
--src ~/src/gson/gson/src/main/java --out gson.jsonl
./bin/codegraph validate gson.jsonl
./bin/codegraph city gson.jsonl --serve --host 127.0.0.1
On gson this takes about a minute end to end, most of it the clone. The city opens on port 4177; the navigator, on 4178. Both bind every interface unless you say otherwise, which is why the last line does.
The first tutorial walks through every stepWhat it does not do
Two languages today: Java and C#.
Nine language profiles exist on paper; the shipped extractors are Spoon for Java and Roslyn for C#. A Clojure adapter is next, and the interchange contract is published so an extractor in any language can conform.
No build means imperfect resolution.
Without a classpath some references stay unresolved and become stubs. A stub is honest, but it is still a gap. Keep one package to one source root per run.
Explanations cost money and need a network.
It is the only command that does. The plan and the estimate come first, and a cap on calls is one flag away.
Not a linter.
Codegraph reports structure, coupling and cycles. It does not judge style and it does not find bugs.
Read what extraction without compiling costs