code-graph-analysis
Static code analysis tool that builds call graphs and assesses the impact/blast radius of code changes. Powered by tree-sitter for multi-language parsing and NetworkX for graph operations.
Supported Languages
Python, TypeScript, JavaScript, Java, Go, Rust, C, C++, C#, Ruby, PHP, Kotlin, Swift
Installation
For interactive graph visualization, install the optional viz extra:
Usage
Analyze a codebase
Parse a repository and build its call graph:
code-graph-analysis analyze /path/to/repo
The graph is saved to .code-graph-analysis/graph.pkl inside the target repo by default. Use -o to specify a custom output path.
Impact analysis
Show the blast radius of a symbol — what breaks if you change it:
code-graph-analysis impact MyClass.my_method
Options:
-d upstream|downstream — direction of traversal (default: upstream)
--depth N — max traversal depth (default: 3)
Symbol context
Get a 360-degree view of a symbol — callers, callees, and relationships:
code-graph-analysis context MyClass.my_method
Visualize
Open an interactive graph visualization in the browser:
code-graph-analysis visualize
Options:
--no-files — hide File nodes to reduce clutter
--no-defines — hide DEFINES edges
--no-open — save HTML without opening the browser
-o path.html — custom output path
Requires the viz extra (pip install ".[viz]").
Stats
Print graph statistics:
code-graph-analysis stats
Development
pip install ".[dev]"
pytest
License
See LICENSE for details.