npm.io
1.2.0 • Published 1 year agoCLI

claude-code-graph

Licence
MIT
Version
1.2.0
Deps
10
Size
284 kB
Vulns
0
Weekly
0
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

Claude Code Graph

License: MIT

Claude Code with intelligent code graphs for large codebases

Claude Code Graph enhances Claude Code with live structural analysis of your codebase. It builds and maintains graphs of your code's architecture, dependencies, and relationships - giving Claude deep contextual understanding of even the largest projects.

Quick Start

Prerequisites

Make sure you have Claude Code installed first:

npm install -g @anthropic-ai/claude-code
Installation
  1. Install Claude Code Graph globally:

    npm install -g claude-code-graph
  2. Navigate to your project and start coding:

    cd your-project/
    ccg start

That's it! The first run will automatically:

  • Initialize graph structures
  • Build code analysis graphs
  • Start the live update daemon
  • Launch Claude Code with graph intelligence

What It Does

Claude Code Graph provides Claude with:

  • Dependency Analysis: Understand how files and modules relate to each other
  • Call Graph Mapping: Track function calls and inheritance chains across languages
  • AST Structure: Deep understanding of code syntax and semantics
  • Architecture Overview: High-level view of your codebase organization
  • Live Updates: Graphs stay current as you code
Supported Languages
  • JavaScript/TypeScript: Module dependencies via madge
  • Python: Call graphs via pyan3, import analysis
  • C/C++: Include dependencies, symbol analysis
  • Universal: AST parsing with tree-sitter for all languages

Commands

Command Description
ccg start Launch Claude Code with graph intelligence (auto-setup)
ccg doctor Check system health and dependencies
ccg status Show current graph and daemon status
ccg build Manually rebuild all graphs
ccg daemon start/stop Manage live graph update daemon
ccg init Initialize graphs in new project (manual setup)

Advanced Setup

Manual Workflow (if needed)
# 1. Initialize in your project
ccg init

# 2. Check dependencies 
ccg doctor

# 3. Build graphs
ccg build

# 4. Start daemon for live updates
ccg daemon start

# 5. Launch Claude Code
ccg start
Dependencies

Required:

  • Node.js 18+
  • Python 3.8+
  • madge (for JS/TS analysis)

Optional (improves analysis):

  • tree-sitter-cli: npm install -g tree-sitter-cli
  • pyan3: pip install pyan3
  • Python packages: pip install watchdog networkx psutil aiofiles

Check with: ccg doctor

Performance

Claude Code Graph is optimized for large codebases:

  • Smart Filtering: Skips node_modules, build directories, etc.
  • File Limits: Processes up to 500 files for tree-sitter, 200 for C++, 50 for Python
  • Incremental Updates: Only processes changed files via daemon
  • Caching: Intelligent caching for faster subsequent runs

For projects with 1000+ files, initial graph building takes 2-5 minutes instead of 30+ minutes.

Project Structure

your-project/
├── .graph/                 # Graph data (auto-created)
│   ├── js.json            # JavaScript/TypeScript modules  
│   ├── py.dot             # Python call graph
│   ├── cpp.json           # C++ dependencies
│   ├── ts.json            # Tree-sitter AST
│   ├── metrics.json       # Graph statistics
│   └── daemon.lock        # Daemon status
├── .gitignore             # Updated to exclude .graph/
└── your code...

Development

# Clone the repo
git clone https://github.com/aibozo/claude-code.graph.git
cd claude-code-graph

# Install dependencies
npm install

# Build tools
npm run build

# Install globally for testing
npm install -g .

# Run tests
npm test

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and test thoroughly
  4. Submit a pull request

License

MIT License - see LICENSE.md for details.

Issues & Support


Made with for better AI-assisted coding