Multi-language code dependency and data flow analysis using Tree-sitter.
Codegraph analyzes your codebase to build an interactive graph of:
- Function/class definitions and calls - See how code flows
- Data flow - Trace data from source to sink
- Module dependencies - Understand cross-repo relationships
- Impact analysis - What breaks if I change this?
- 🌍 Multi-language - JavaScript, TypeScript, Python, Ruby, Go (via Tree-sitter)
- 📊 Interactive visualization - Explore your code graph in a web UI
- 🔍 Data flow analysis - Trace how data moves through code
- 🚀 Multi-repo support - Analyze multiple repositories together
- 📦 JSON export - Export graphs for downstream tools
pip install codegraphAnalyze a repository:
codegraph analyze /path/to/repo --serveOpen http://localhost:8000 to explore the interactive graph.
# Analyze a repository
codegraph analyze /path/to/repo
# Analyze multiple repositories
codegraph analyze /repo1 /repo2 /repo3
# Export to JSON
codegraph analyze /path/to/repo --output graph.json
# Start web UI
codegraph analyze /path/to/repo --serve --port 8080
# Search for a function
codegraph search /path/to/repo "functionName"
# Trace data flow
codegraph dataflow /path/to/repo "source" "sink"Open the web UI to:
- 🔎 Search for functions/classes
- 📈 Explore call graphs
- 🔗 Trace data flow paths
- 💾 Export subgraphs
Tree-sitter Parser → Symbol Resolution → Call Graph → Data Flow → Graph → API → Web UI
- Parser - Extract code structure using Tree-sitter queries
- Analysis - Build symbol table, call graphs, data flow
- Graph - In-memory graph representation (networkx)
- API - FastAPI server with search, analysis endpoints
- UI - React + Cytoscape.js for visualization
- JavaScript / TypeScript
- Python
- Ruby
- Go
- (More coming)
git clone https://github.com/yourusername/codegraph.git
cd codegraph
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black .
# Type check
mypy codegraphContributions welcome! See CONTRIBUTING.md
MIT