code-graph
See everything a change affects before you make it: a local, deterministic dependency graph of routes, calls, tables and config, with file:line evidence for every hop.
For you and your AI agent (CLI + MCP). No LLM in the graph.
Docs · Quick start · CLI · MCP · Changelog
Quick start
pipx install cg-code-graph # or: uv tool install cg-code-graph
cg index . --db out/graph.db # prints starter queries for your repo
cg install --host cursor # or claude, codex, vscode, …: registers the MCP server and a "use cg first" agent rule
cg reaches table:orders --db out/graph.db # any table, connection or config key
Try it on a bundled sample, link a frontend to a backend, or connect an agent over MCP: Quick start guide. Other install options (install.sh, Windows, exact-mode toolchains): Install.
cg reaches table:store_books on the bundled Django sample:
dependents: 18 nodes (code: 6, entry points: 9, other: 3)
== RUNTIME (reached from http_route / ... / queue_job / listener): 5 functions/methods
catalog.api.create_book depth=1 conf=resolved http_route(1)
path: function:catalog.api.create_book
-WRITES_TABLE[resolved @ catalog/api.py:27]-> table:store_books
catalog.signals.review_saved depth=3 conf=resolved listener(1)
path: function:catalog.signals.review_saved
-DISPATCHES[exact @ catalog/signals.py:12]-> job:catalog.tasks.recompute_rating
-HANDLED_BY[exact @ catalog/tasks.py:13]-> function:catalog.tasks.recompute_rating
-READS_TABLE[resolved @ catalog/tasks.py:14]-> table:store_books
Supported languages
| Language | Frameworks and facts | Calls | Docs |
|---|---|---|---|
| Django (+ DRF, django-ninja), FastAPI / Starlette, Flask, Celery | exact (stdlib ast) |
Python | |
| Nuxt / Vue, NestJS, Next.js, Astro, Express, Fastify, Koa, Hono, Elysia, React Router / Remix | exact (TypeScript compiler API) | TS frameworks | |
| Laravel (routes, route attributes, middleware, queues, broadcasting, outbound HTTP) | exact (nikic/php-parser; needs PHP 8.2+) | PHP | |
| Flutter | exact (Dart analyzer; needs the Dart SDK) | Platforms | |
| Android, Kotlin Multiplatform, Spring | heuristic; exact with scip-java (opt-in) | Kotlin | |
| Spring (routes, guards, beans, tables, clients) | heuristic; exact with scip-java (opt-in) | Java | |
| iOS / SwiftPM | heuristic; exact with the Swift index store (opt-in) | Swift | |
crates / modules, entry points, FFI, #[cfg] / #if gates |
heuristic; exact with rust-analyzer / scip-clang | Rust, C and C++ |
Go and others: import a SCIP index with cg index --scip FILE. Run cg doctor to see exact / heuristic per language on your machine.
What you get
reaches,impact,path: every caller, route, job and page that reaches a table, config key or method.cg affected --base main: the tests and entry points a change reaches (--quietfeeds your test runner).- Across repos:
cg linkmatches client HTTP calls (frontends and Laravel / Guzzle backends) to server routes, and checks request keys (Laravel FormRequest, Elysia schemas, Nuxt / TypeScript bodies). - Route guards:
cg routes --writes --unguardedlists routes that write with no auth guard. Laravel checks inside the action count as inline guards unless--strict. - Security views:
cg surfacelists the inbound / outbound attack surface and findings (hardcoded credentials, plaintext protocols, unverified webhooks, unguarded handlers, listeners on all interfaces, disabled TLS / SSH verification, plaintext gRPC, exposed IPC, outbound URLs built from request input) as text, JSON or SARIF, with--fail-onfor CI. - MCP server (
cg-mcp) so agents query the graph instead of grepping. One server can serve many graphs (graphsplus an optionalgraphargument); a single--dbstays one graph. See MCP. - Visual view (
cg serve) and plan checks (cg plan check) for planned changes.
Docs
Install · Quick start · CLI · MCP · Configuration · Architecture · Limitations
Changelog · Contributing · Security · MIT License
More recordings: docs/media.
Metadata
Release files for cg-code-graph 0.23.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cg_code_graph-0.23.1.tar.gz | 2.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cg_code_graph-0.23.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.7 MB
Release files / cg_code_graph-0.23.1.tar.gz
| Download URL | cg_code_graph-0.23.1.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e82676feadb38fc1adfe972e0f8d315e66183eb67ea0ae25aa29a66ad5324925
|
|
BLAKE2b-256 checksum How to use checksums |
49daf5448b00a9031ff814d4264b5169e85fb1c74409c3ab6381a16a8f77df7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / cg_code_graph-0.23.1-py3-none-any.whl
| Download URL | cg_code_graph-0.23.1-py3-none-any.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ab0bf390c25dbbdd705881e5150da59ee069dba5839a5ddcc4c321c06d4b82a
|
|
BLAKE2b-256 checksum How to use checksums |
d74bda00203460eb39d44225bb998f3061d6fad165a9eaa28432ae2becb2ad0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log