Skip to main content

Tree-sitter based repository map generator - extract and visualize code structure

Project description

repomap

Tree-sitter based repository map generator - extract and visualize code structure using PageRank.

Installation

From source (using uv)

git clone https://github.com/cdpath/repomap
cd repomap
uv tool install .

From source (using pip)

git clone https://github.com/cdpath/repomap
cd repomap
pip install .

Usage

Generate a Repo Map

# Basic usage
repomap ./src

# Filter by language
repomap ./src --language python

# Exclude directories
repomap ./src --exclude tests

# Save to file
repomap ./src -o map.md

# Adjust output size
repomap ./src --tokens 8192

Generate a Call Graph

# Generate call graph from entry point
repomap ./src --graph graph.png --entry main.py

# Limit traversal depth  
repomap ./src --graph graph.png --entry main.py --depth 2

# JSON output (FASTEN adjacency list format)
repomap ./src --graph graph.json --entry main.py

# Focus on files matching a pattern (shows matching files + their neighbors)
repomap ./src --graph graph.dot --focus core

Example call graph:

repomap call graph

JSON formats:

Filename Format
graph.json Simple adjacency list
graph.fasten.json FASTEN format

Simple JSON:

{"cli.py": ["core.py", "graph.py"], "core.py": ["ranking.py"]}

FASTEN JSON:

{"product": "myproject", "graph": {"internalCalls": [["cli.py", "core.py"]]}, ...}

Options

--output, -o FILE       Save repo map to file
--graph, -g FILE        Generate call graph (.png, .svg, .pdf, .dot, .json)
--entry FILE            Entry point file - filter to reachable files only
--depth N               Max depth from entry point (default: unlimited)
--min-refs N            Min references for symbol inclusion (default: 1)
--focus PATTERN         Focus graph on files matching pattern
--exclude, -e PATTERN   Exclude paths matching pattern
--language, -l LANG     Filter by language (python, javascript, etc.)
--tokens, -t TOKENS     Max tokens for repo map (default: 4096)
--verbose, -v           Enable verbose output

Default Excludes

Common directories are automatically excluded: .venv, node_modules, __pycache__, .git, dist, build, etc.

Supported Languages

30+ languages via tree-sitter: Python, JavaScript, TypeScript, Java, Go, Rust, C/C++, C#, Ruby, and more.

How It Works

  1. Parse source files using tree-sitter to extract definitions and references
  2. Build a graph of file interdependencies
  3. Rank using PageRank algorithm to identify most important code
  4. Render as tree-structured markdown or visual call graph

Example Repo Map Output

core.py:
│class RepoMap:
│    def __init__(...)
│    def get_repo_map(...)

ranking.py:
│def get_ranked_tags(...)
│def _get_tags_cached(...)

Attribution

Derived from aider's repomap by Paul Gauthier. See NOTICE.

License

Apache 2.0 - see LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrepomap-0.1.3.tar.gz (188.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrepomap-0.1.3-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file pyrepomap-0.1.3.tar.gz.

File metadata

  • Download URL: pyrepomap-0.1.3.tar.gz
  • Upload date:
  • Size: 188.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyrepomap-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4d8651cb5234b29efe519bce895cf06204bf6dcafd506937cdfe4149400301a3
MD5 3ccef06d976ae2fb7f52a22675fcdb8a
BLAKE2b-256 64e669cf7a6c8843db8238adf647b243c384ac06ebf761ba725df2f3e28d8ff7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrepomap-0.1.3.tar.gz:

Publisher: python-publish.yml on cdpath/repomap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrepomap-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pyrepomap-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyrepomap-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 984c2896fc16918a07b7966ded838038f33b38f2e4fde4182e5ebc492db7cbfa
MD5 2ffbff843053e698b8a59648532cffbd
BLAKE2b-256 5a20f5387f32ba0241c599153d803c1be619da60ac8e835728226ad312d60a8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrepomap-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on cdpath/repomap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page