Skip to content

krowxx/callmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Graph CLI

code-graph is a lightweight command-line tool that inspects a git repository and emits a YAML description of the project hierarchy and function call relationships. The tool prioritizes accuracy by combining git-aware file discovery with Tree-sitter-based parsing and reuses Blarify's language coverage and reference resolution pipeline so the same languages are supported out of the box.

Why

  • Git native – only committed files are analyzed via git ls-files, so transient build artifacts are ignored without custom ignore rules.
  • Tree-sitter powered – language-specific grammar support enables precise parsing of source structure.
  • Portable YAML – the resulting manifest can be consumed by any downstream tooling that understands YAML (e.g. graphing pipelines, documentation generators).

Installation

npm install -g @sourcegraph/scip-python
npm install -g @sourcegraph/scip-typescript
pip install -e .

Usage

Run from anywhere inside a git repository:

code-graph > call-graph.yaml

Key options:

  • --root PATH – optional explicit path to the repository (defaults to current directory).
  • --output FILE – write the YAML graph to a file instead of stdout.
  • --skip-name / --skip-extension – extend the ignore lists if you need to filter additional assets.

Requirements

  • A git repository (only tracked files are analysed via git ls-files).
  • The CLI shells out to Blarify, which in turn relies on multilspy to spin up the right Language Server Protocol processes. Ensure the machine can launch the corresponding LSP servers for the languages in your project (Python, TypeScript/JavaScript, Go, Java, C#, Ruby, PHP, etc.).
  • Optional but recommended: install the SCIP indexers (npm install -g @sourcegraph/scip-python @sourcegraph/scip-typescript) to speed up reference resolution when working with Python or TypeScript/JavaScript codebases.

Development

pip install -e ".[dev]"
pytest

Output Format

The generated YAML document contains:

  • nodes: every folder, file, class, function, and method discovered, with ids, names, relative paths, and optional line numbers.
  • edges: relationships between nodes, including contains, defines, and calls links.

This format is easy to diff, transform, or feed into custom visualisation/back-end systems.

Roadmap

  • Expose knobs for switching between SCIP and LSP modes explicitly.
  • Surface richer graph metadata (e.g., cyclomatic complexity, module grouping).

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages