Skip to main content

code-graph

A deterministic dependency graph for Laravel, Django, FastAPI, Flask, NestJS, Next.js, Express, Nuxt, Flutter, Rust, C and C++ codebases, so you (and your AI agent) can see everything a change touches before you make it.

Ask "what depends on this table, connection, config key or method?" and get every caller, route, command and page that reaches it, each hop backed by file:line evidence. It runs locally on your source files. Answers are exact, deterministic and reproducible: the graph is built from parsers and the type checker, with no LLM in the graph. BloodHound-style: you walk real paths instead of grepping names.

Status: beta. Laravel (PHP), Django, FastAPI / Starlette and Flask (Python), TypeScript/JavaScript (Nuxt/Vue, NestJS, Next.js, Express/Fastify/Koa/Hono), Flutter (Dart), Rust, C and C++ are supported natively; other languages can be imported through SCIP.

Documentation

code-graph docs — install, CLI, MCP, architecture, schema, languages and limitations.

Install

cg is a user-level tool (no sudo, no checkout). The PyPI package is cg-code-graph; the commands are cg and cg-mcp.

pipx install cg-code-graph    # or: uv tool install cg-code-graph
#   or the script (also installs exact-mode tools with --with c,rust,...):
#     curl -fsSL https://raw.githubusercontent.com/cyberchronos00/code-graph/main/install.sh | sh
#   or the latest commit: uv tool install git+https://github.com/cyberchronos00/code-graph
cg doctor                     # what indexes exact / heuristic on this machine

Update with uv tool upgrade cg-code-graph, pipx upgrade cg-code-graph or install.sh --update. Caches live under ~/.cache/codegraph; cg clean removes them. Windows, options and per-language toolchains: install.

Quickstart

Clone the repo for the bundled sample apps (a Laravel API and a Nuxt web app). Python 3.11+. PHP 8.2+ and Composer for the Laravel sample; Node.js 20+ for the TypeScript samples.

git clone https://github.com/cyberchronos00/code-graph.git && cd code-graph
mkdir -p out
cg index examples/bookstore-api --name bookstore-api --gates examples/bookstore.gates.json --db out/api.db
cg index examples/bookstore-web --name bookstore-web --db out/web.db
cg link --backend out/api.db --frontend out/web.db \
        --backend-name bookstore-api --frontend-name bookstore-web --db out/graph.db

cg reaches connection:warehouse table:warehouse_stock --db out/graph.db
cg impact StockService::reserve --db out/graph.db
cg path page:/reports/:id table:orders --db out/graph.db
cg plan check preorders --plans-dir examples/plans --db out/graph.db

A workspace .cg.yaml can list several apps, including checkouts outside that directory, and cg index builds one combined graph. cg link --repo merges graphs you already indexed. Other samples in examples/ (Nest, Next, Express, Django, Flutter, Rust, C, C++) index the same way. Queries, MCP (cg-mcp --db out/graph.db) and cg serve are in the docs.

Preview

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

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

More recordings (setup, visual view, agent over MCP): docs/media/.

Metadata

Release files for cg-code-graph 0.13.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.13.0
File Size Uploaded
cg_code_graph-0.13.0.tar.gz 1.6 MB Details

Built distribution (wheel)

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

Total release size: 3.0 MB

Release files / cg_code_graph-0.13.0.tar.gz

Download URL cg_code_graph-0.13.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
4c627eccafe088e05ee5ba4ba8554e65e159f979fe1977dfd9ec7ae349eb6dee
BLAKE2b-256 checksum
How to use checksums
c1dd86b8f93f7568f80befe3df4c31b6b9abe7d154564b79bfb6dd81deab2bd1
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 5, 2026.

Transparency log

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

Download URL cg_code_graph-0.13.0-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
af8531da3bc6d3f28c7fd65064c319a44315e77ef28ed1dbc873e288bf74b47c
BLAKE2b-256 checksum
How to use checksums
148abdc819cbef0bce590c0444565ed9dbf4d8a5cece147b2455dc4f31252d3d
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 5, 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