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:
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"]}
{"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
- Parse source files using tree-sitter to extract definitions and references
- Build a graph of file interdependencies
- Rank using PageRank algorithm to identify most important code
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrepomap-0.1.4.tar.gz.
File metadata
- Download URL: pyrepomap-0.1.4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aad07fc316e314baed03c2ea4ceb26e2a5f779ab82261cfe87ba517f9086bb6b
|
|
| MD5 |
2ca19e329ca93edb64f3c8da2236d132
|
|
| BLAKE2b-256 |
4d541af608bddc07c21eb8f4e8b7c46a3e6fc64dc51b3cd4ffbdbd4c37bd5232
|
Provenance
The following attestation bundles were made for pyrepomap-0.1.4.tar.gz:
Publisher:
python-publish.yml on cdpath/repomap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrepomap-0.1.4.tar.gz -
Subject digest:
aad07fc316e314baed03c2ea4ceb26e2a5f779ab82261cfe87ba517f9086bb6b - Sigstore transparency entry: 771018916
- Sigstore integration time:
-
Permalink:
cdpath/repomap@4eaf3b08c65da785d94064417d3a3d33bbc06273 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/cdpath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4eaf3b08c65da785d94064417d3a3d33bbc06273 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyrepomap-0.1.4-py3-none-any.whl.
File metadata
- Download URL: pyrepomap-0.1.4-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
772771baf2088212059c7cf039e7257ca540182905bdf80b342ceaf8fb5119e4
|
|
| MD5 |
57143ce315af9b589869b1c33ffe4f76
|
|
| BLAKE2b-256 |
db7f493e7dc8dbaac942d7ab10b49476406c770d46167f588fcf03d4b894f279
|
Provenance
The following attestation bundles were made for pyrepomap-0.1.4-py3-none-any.whl:
Publisher:
python-publish.yml on cdpath/repomap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrepomap-0.1.4-py3-none-any.whl -
Subject digest:
772771baf2088212059c7cf039e7257ca540182905bdf80b342ceaf8fb5119e4 - Sigstore transparency entry: 771018919
- Sigstore integration time:
-
Permalink:
cdpath/repomap@4eaf3b08c65da785d94064417d3a3d33bbc06273 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/cdpath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4eaf3b08c65da785d94064417d3a3d33bbc06273 -
Trigger Event:
release
-
Statement type: