Skip to content

FleetPanda/codegraph

Repository files navigation

Codegraph

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?

Features

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

Installation

pip install codegraph

Quick Start

Analyze a repository:

codegraph analyze /path/to/repo --serve

Open http://localhost:8000 to explore the interactive graph.

Usage

CLI

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

Web UI

Open the web UI to:

  • 🔎 Search for functions/classes
  • 📈 Explore call graphs
  • 🔗 Trace data flow paths
  • 💾 Export subgraphs

Architecture

Tree-sitter ParserSymbol ResolutionCall GraphData FlowGraphAPIWeb UI

Components

  • 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

Supported Languages

  • JavaScript / TypeScript
  • Python
  • Ruby
  • Go
  • (More coming)

Development

git clone https://github.com/yourusername/codegraph.git
cd codegraph
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black .

# Type check
mypy codegraph

Contributing

Contributions welcome! See CONTRIBUTING.md

License

MIT

About

Multi-language code dependency analysis with semantic search and Supabase integration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors