Skip to main content

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.

PyPI Downloads Python 3.11+ License: MIT Docs

Docs · Quick start · CLI · MCP · Changelog

cg visual view: the graph around the warehouse connection, a selected node with its evidence paths and source, then the planned-change overlay for the preorders plan

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

Terminal demo: cg indexes the bundled Laravel and Nuxt sample apps, links them, then runs reaches, path, impact and plan check

Supported languages

Language Frameworks and facts Calls Docs
Python Django (+ DRF, django-ninja), FastAPI / Starlette, Flask, Celery exact (stdlib ast) Python
TypeScript JavaScript Nuxt / Vue, NestJS, Next.js, Astro, Express, Fastify, Koa, Hono exact (TypeScript compiler API) TS frameworks
PHP Laravel (routes and middleware, queues, broadcasting) exact (nikic/php-parser; needs PHP 8.2+) PHP
Dart Flutter exact (Dart analyzer; needs the Dart SDK) Platforms
Kotlin Android, Kotlin Multiplatform heuristic; exact with scip-java (opt-in) Kotlin
Swift iOS / SwiftPM heuristic; exact with the Swift index store (opt-in) Swift
Rust C C++ crates / modules, entry points, FFI, #[cfg] / #if gates heuristic; exact with rust-analyzer / scip-clang Rust, C and C++

Go, Java 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 (--quiet feeds your test runner).
  • Frontend ↔ backend: cg link matches client HTTP calls to server routes across repos.
  • Route guards: cg routes --writes --unguarded lists routes that write with no auth guard.
  • MCP server (cg-mcp) so agents query the graph instead of grepping.
  • 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.17.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cg-code-graph 0.17.0
File Size Uploaded
cg_code_graph-0.17.0.tar.gz 1.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for cg-code-graph 0.17.0
File Interpreter ABI Platform
cg_code_graph-0.17.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.2 MB

Release files / cg_code_graph-0.17.0.tar.gz

Download URL cg_code_graph-0.17.0.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
f25f933ad0c97dbf11026273710c2313de34bb4cfc87c5611bafc4234eec2936
BLAKE2b-256 checksum
How to use checksums
3d132c01a06df40bef5f331f98d58c0c06902d74738e60a01c3c6fc10ed55034
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 6, 2026.

Transparency log

Release files / cg_code_graph-0.17.0-py3-none-any.whl

Download URL cg_code_graph-0.17.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6fbcfb7ba1de0fde185c37fb294d85ad61d56d73774dc7051cb2dc84a3aec6f2
BLAKE2b-256 checksum
How to use checksums
42f8ad2a2b6070ba405f4c8dc7b36fd2222396c83edf7946964d6b53f1de9aaf
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 6, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page