Skip to main content

repo2brief

Understand an unfamiliar codebase in 10 minutes. Point it at a repo and get one shareable page: where to start reading, an architecture map, an interactive dependency graph, entry points, hotspots and a glossary of the project's own vocabulary.

uvx repo2brief .                 # writes repo2brief-<name>.html, no install needed
repo2brief . --open              # ...and opens it
repo2brief . -s                  # the brief in your terminal, no file
repo2brief . -f md               # BRIEF.md with a Mermaid architecture diagram (renders on GitHub)

repo2brief on Flask: architecture map and module graph

Live example, generated from Flask: docs/flask-brief.html and docs/flask-BRIEF.md.

What you get

Section What it tells you
Start here A reading order: the README, how the program starts, the most depended-on modules, then one file per area
Architecture map Directories as bubbles sized by code, arrows for "imports from"; click one to filter the graph
Module graph Force-directed import graph; node size = how much of the code depends on it; click a module for its symbols and who imports it; search box
Run it Entry points (pyproject scripts, package.json bin/main, __main__ blocks, conventional names) and the documented commands (make, npm run, pytest)
Hotspots Files that change often and are big or central, with main author and bus factor (from git log)
Contributors How many people have committed (all-time, name variants merged by e-mail, bots counted separately), how many in the last 90 days, and a table of who does what: commits, share, active period, lines changed and the areas they work in. E-mail addresses are never printed
Glossary Domain words that recur in names and docstrings, with where they live and what they mean
Stack Languages by lines of code, most-used third-party packages

No network, no LLM, no API key: it is static analysis (Python ast; regexes or, optionally, real tree-sitter parsers for the other languages) and git log. Python 3.10+, standard library only (tree-sitter is an optional extra). A typical repo takes well under a second.

Options

Option Effect
PATH Repository or sub-directory to analyze (default .); point it at services/api inside a monorepo
-f html|md|both Output format (default html)
-o PATH, -o - Output file; - writes to stdout. With -f both, the name without extension
-s, --summary-only Print the brief in the terminal and write no file (--open still shows the page)
--json Machine-readable JSON (with -s: just the summary)
--sections LIST Only some parts: start, architecture, graph, run, hotspots, contributors, glossary, stack
--title TEXT HTML page title
--open Open the page in your browser
-q, --quiet Print nothing but the result
--include-tests, --include-examples Tests and examples//docs/ code are left out by default so the graph shows the product, not its scaffolding
--max-files N Analyze at most N source files, sampled evenly (default 3000); the page says when it sampled
--parser auto|regex|tree-sitter Source reader for non-Python files (default auto: tree-sitter if repo2brief[parsers] is installed)
--diff REF PR view: what this checkout changes compared with REF (branch, tag or commit; uses the merge-base). Lists new/removed modules and imports, new dependencies between areas, new third-party packages, touched hotspots and how many other modules import the changed code. Works with -f md, -s, --json; e.g. repo2brief --diff main -f md -o PR-BRIEF.md
--summarize, --llm, --llm-model, --llm-dry-run Optional AI-written overview and area descriptions (see below). Off by default
--exclude GLOB Leave matching files out (repeatable): --exclude '**/generated/**' --exclude '*.pb.go'
--config PATH, --no-config, --init-config Use a settings file, ignore all of them, or write a commented repo2brief.yml here
--no-emails Leave contributors' e-mail addresses out of the output (worth using before sharing the page publicly)
--no-cache, --clear-cache Re-analyze instead of reusing the stored result for this commit; delete all stored results
--no-git Skip git history (no hotspots, contributors or bus factor)

Languages

Language Support
Python Imports (absolute, relative, from pkg import submodule, src/ layouts), classes, functions, docstrings, __main__ blocks
JavaScript / TypeScript import/export/require/dynamic import(), relative paths with extension and index probing, .js specifiers that point at .ts files
Java / Kotlin import (including wildcards and static imports), same-package references (no import needed in Java), classes and Kotlin top-level functions, main and @SpringBootApplication, Maven/Gradle commands, Android/Spring/Ktor detection
Go Packages resolved through go.mod (a package is represented by its main file), exported types and functions, package main, third-party modules
Rust mod declarations, use trees (crate::, super::, self::, workspace crates), public items, main.rs, Cargo.toml metadata
Everything else Counted in the language breakdown; no import graph yet. Extractors are small, see extract/

Parsers

By default repo2brief uses tree-sitter when the extra is installed and regexes otherwise (--parser auto). --parser regex forces the dependency-free path; --parser tree-sitter fails with a clear message if repo2brief[parsers] is missing. The terminal summary says which parser read how many files. On real repos (okhttp, ripgrep) the two agree on almost everything; tree-sitter mainly removes links that came from comments. Python always uses the standard-library ast.

Configuration

Keep a project's options in a file instead of on the command line:

repo2brief --init-config        # writes a commented repo2brief.yml
# repo2brief.yml
format: both
include_tests: false
max_files: 5000
emails: false
exclude:
  - "**/generated/**"
  - "*.pb.go"
llm:
  enabled: false

Settings are read from ~/.config/repo2brief/config.yml, then repo2brief.yml or .repo2brief.yml in the analysed folder or a parent (up to the git root), then --config PATH; each layer overrides the one before, and command-line flags override everything (--no-config skips all files). Keys: format, title, output, open, quiet, include_tests, include_examples, max_files, parser, git, emails, cache, sections, exclude, and llm: {enabled, provider, model}. Unknown keys and bad values are reported with the file name. A file can only turn options on; to switch one off for a single run, use --no-config or edit the file. API keys are refused in the file on purpose: use ANTHROPIC_API_KEY / OPENAI_API_KEY. Exclude patterns are gitignore-style: no / matches a file name anywhere, a trailing / means a folder, ** crosses folders. A small YAML subset is built in; if PyYAML is installed it is used instead.

Optional AI prose

export ANTHROPIC_API_KEY=...            # or OPENAI_API_KEY (+ OPENAI_BASE_URL for Ollama, vLLM, LM Studio...)
repo2brief --summarize                  # adds an overview paragraph and plainer area descriptions
repo2brief --llm-dry-run                # print exactly what would be sent; sends nothing
repo2brief --summarize --llm openai --llm-model llama3   # any OpenAI-compatible server, including a local one

Everything works without it; this is the only feature that can contact a network, and only when you pass --summarize. What is sent is a compact outline: the README excerpt, area names, file paths, the first line of module docstrings, public symbol names, entry points and framework names. No source code and no e-mail addresses. The text is labelled "AI-written" in the HTML, Markdown and terminal output, and if the call fails you get the normal brief with a warning. Default model for Anthropic is claude-haiku-5-5 (override with --llm-model or REPO2BRIEF_MODEL).

Reviewing a branch

repo2brief --diff main          # HTML page: repo2brief-<name>-diff.html
repo2brief --diff main -s       # short terminal version
repo2brief --diff origin/main -f md -o PR-BRIEF.md   # paste into a PR description

The base is exported with git archive into a temp folder and analysed with the same extractors as your checkout, so the comparison is like for like and your working tree is never touched. Uncommitted edits to tracked files and new files count as part of the change.

Caching

On a clean git checkout (nothing modified, staged or untracked under the folder) the finished analysis is stored per commit in ~/.cache/repo2brief (or $XDG_CACHE_HOME, or $REPO2BRIEF_CACHE_DIR), so running it again on the same commit is near-instant; the output says when it reused one. The key also covers every option and the repo2brief version, and a dirty working tree is never cached. Nothing is ever written inside your repository.

How it works

git ls-files (or a filtered walk) finds the files; extractors pull out imports, symbols and doc comments; imports are resolved to files in the repo; PageRank over the import graph says which modules everything leans on; directories become architecture clusters; git log --numstat adds churn and ownership; a TF-IDF-style score finds the glossary terms.

Limits (read before trusting a graph)

  • Dynamic imports, plugin registries, dependency injection and generated code are invisible to static analysis.
  • Without the parsers extra, JavaScript, Java, Kotlin, Go and Rust are read with regexes: unusual syntax can be missed and a class name mentioned only in a comment can add a false link. With it (pip install "repo2brief[parsers]") they are parsed with tree-sitter, which ignores comments and strings; files a grammar cannot parse fall back to the regexes. Webpack/Vite aliases that are not in a tsconfig/jsconfig are not resolved (except @/ and ~/).
  • Java/Kotlin same-package links come from capitalized names that match a sibling class, so a class named like a common word can add a false link.
  • "Hotspots" and "bus factor" reflect the last 3000 non-merge commits and count commits, not effort.
  • The glossary is heuristic. Expect a few generic words.

Development

pip install -e ".[dev]"
ruff check . && pytest

Roadmap

  • Python and JavaScript/TypeScript extractors, ranking, clusters, git signals, glossary
  • HTML, Markdown (Mermaid) and terminal output; --json; --sections
  • Java, Kotlin, Go and Rust extractors
  • C#, PHP, Ruby, Swift extractors
  • Optional LLM pass for prose summaries (bring your own key)
  • Cache keyed by commit hash for instant re-runs
  • tsconfig / jsconfig paths and baseUrl aliases (including extends)

Contributing

Issues and PRs welcome. A new language is one module in src/repo2brief/extract/ that returns a Module (imports, symbols, doc) plus a resolver in resolve.py.

License

MIT

Metadata

Release files for repo2brief 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repo2brief 0.3.0
File Size Uploaded Provenance Actions
repo2brief-0.3.0.tar.gz 451.4 kB With provenance Details for repo2brief-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for repo2brief 0.3.0
File Interpreter ABI Platform Actions
repo2brief-0.3.0-py3-none-any.whl Python 3 none any Details for repo2brief-0.3.0-py3-none-any.whl

Total release size: 526.3 kB

Release files / repo2brief-0.3.0.tar.gz

Download URL repo2brief-0.3.0.tar.gz
Size 451.4 kB
Tags Source
SHA-256 checksum
How to use checksums
373478ea8da5dce99c16daea5a58e9377322b32ca75d0dea417b650a0d755187
BLAKE2b-256 checksum
How to use checksums
6a072f7c77886bba107c2f1bb534a6577805667ce156f9b5849d5f5132472d89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / repo2brief-0.3.0-py3-none-any.whl

Download URL repo2brief-0.3.0-py3-none-any.whl
Size 75.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfc07c717dac1714f5008fd2bebdd8ab0db7532758db6fd8ad4fe37d40f6dd99
BLAKE2b-256 checksum
How to use checksums
bd50ba9e50ab5df803392a0154b8a8aa7a803af92353a81d592bdb1ca7526e52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for repo2brief 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for repo2brief-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page