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.4.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.4-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

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

Hashes for pyrepomap-0.1.4.tar.gz
Algorithm Hash digest
SHA256 aad07fc316e314baed03c2ea4ceb26e2a5f779ab82261cfe87ba517f9086bb6b
MD5 2ca19e329ca93edb64f3c8da2236d132
BLAKE2b-256 4d541af608bddc07c21eb8f4e8b7c46a3e6fc64dc51b3cd4ffbdbd4c37bd5232

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrepomap-0.1.4.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.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

Hashes for pyrepomap-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 772771baf2088212059c7cf039e7257ca540182905bdf80b342ceaf8fb5119e4
MD5 57143ce315af9b589869b1c33ffe4f76
BLAKE2b-256 db7f493e7dc8dbaac942d7ab10b49476406c770d46167f588fcf03d4b894f279

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrepomap-0.1.4-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