Skip to main content

X-ray any codebase in one command — interactive dependency graph, blast radius, health grade, security scan, and hotspot map in a single HTML file.

Project description

🔍 repolens

X-ray any codebase in one command

One line in, one file out — an interactive architecture map, blast-radius explorer, health grade, security scan, and hotspot report for any repo, local or on GitHub.

PyPI Python License: MIT CI

uvx repolens-kit facebook/react    # ← that's the whole setup

or try it online, no install: lens.bigwinner.work — paste any public repo

repolens interactive report — blast radius mode with file inspector

One-liners

uvx repolens-kit .                 # analyze the repo you're standing in (zero install)
uvx repolens-kit pallets/flask     # analyze any GitHub repo by shorthand
uvx repolens-kit https://github.com/fastapi/fastapi
pipx run repolens-kit .            # same, via pipx
pip install repolens-kit && repolens .  # installs the `repolens` command

Every run prints a rich terminal summary and writes a single self-contained HTML file — D3 inlined, zero external requests, works offline, safe to email or attach to a PR. Your code never leaves your machine.

repolens terminal output

What you get

🕸️ Interactive dependency graph Force-directed map of every file. Four color modes — folder, architectural layer, churn, blast. Click any node for its imports, dependents, functions, and owners.
💥 Blast radius "If I change this file, what breaks?" Transitive-dependent analysis answers it per file, in the terminal and the graph.
🏥 Health grade (A–F) Cycles, coupling, oversized files, disconnected code, and security findings — with a transparent penalty breakdown, never a black-box number.
🔐 Security scan Committed private keys, AWS/GitHub/Slack tokens, hardcoded secrets, SQL built by string-glue, eval/exec, unsafe deserialization, disabled TLS verification. Findings in test/docs paths are automatically demoted.
🔥 Hotspots & ownership Per-file commit churn and top contributors mined from git history — know what's volatile and who to ask.
Circular dependencies Strongly-connected components across the import graph (Tarjan), with the actual file chains.
🗺️ Code map Treemap of lines-of-code by folder, language donut, largest-impact and most-changed bar charts.
📤 JSON export --json dumps the entire model — pipe it into CI gates, dashboards, or your own tooling.
Code map treemap, language donut, hotspots and blast radius charts

How the analysis works

repolens parses source with per-language extraction (30+ languages: Python, TypeScript/JavaScript, Go, Rust, Java, Kotlin, C/C++, C#, Ruby, PHP, Swift, Elixir, and more), then resolves imports to files inside the repo to build a real dependency graph:

  • Python: from X import name expands to submodules, src/-layout packages resolve, if TYPE_CHECKING: blocks and function-body (deferred) imports are excluded — so the cycles it reports are cycles that actually bite at import time.
  • JS/TS: relative paths, index.* resolution, require/dynamic import().
  • Ambiguous names are settled by ranking (package roots beat stray same-named fixtures) instead of being dropped.

On top of the graph: blast radius (reverse-reachability per file), SCC cycle detection, layer classification, hub/coupling metrics, and a security ruleset tuned for precision. Everything is heuristic and fast — ~1 second for a 1,000-file repo — built for orientation, not for replacing a compiler.

Usage

repolens [target] [options]

target                 local path, owner/repo, or GitHub URL (default: .)

-o, --output FILE      HTML report path (default: <name>-repolens.html)
    --json [FILE]      dump the full analysis model as JSON (stdout if no FILE)
-x, --exclude PATTERN  extra exclude glob, repeatable (e.g. -x 'docs/**')
    --max-files N      cap analyzed files (default: 6000)
    --no-open          don't auto-open the report in a browser
    --no-html          terminal summary only
-q, --quiet            no terminal summary

As a library

from repolens import analyze

report = analyze("path/or/owner/repo")
print(report["health"]["grade"], report["repo"]["edges"])

In CI

pip install repolens-kit
repolens . --no-open --no-html --json report.json
python -c "import json,sys; sys.exit(json.load(open('report.json'))['health']['score'] < 70)"

Privacy

  • Local analysis never touches the network.
  • GitHub targets are shallow-cloned with your own git (and deleted afterward) — no tokens collected, no telemetry, nothing phoned home.
  • The HTML report inlines D3, so opening it makes zero external requests.

Credits

repolens is a from-scratch Python reimagining of CodeFlow by Braedon Saunders — a lovely browser-only codebase visualizer. Same mission (stop guessing, start seeing), rebuilt as an installable CLI with a resolvable import graph, honest health scoring, git mining, and offline single-file reports.

License

MIT — see LICENSE.

Stop guessing. Start seeing.

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

repolens_kit-0.2.1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

repolens_kit-0.2.1-py3-none-any.whl (134.1 kB view details)

Uploaded Python 3

File details

Details for the file repolens_kit-0.2.1.tar.gz.

File metadata

  • Download URL: repolens_kit-0.2.1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for repolens_kit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d6d51036ce26ac5e4596c5bba719497893e2773b26f793177008f7beac883358
MD5 26a7f91512137b9f99fabad2a0f233b1
BLAKE2b-256 fd4a7581897bad5cc281003286629914a121a8c801d4e6c791dcc1ef75d5b88e

See more details on using hashes here.

File details

Details for the file repolens_kit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: repolens_kit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 134.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for repolens_kit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a60a167da3275e2620700e88ddde1cdf7aec6502f9de87c920b71b585ba95a8
MD5 6308f281653c74abf6101a8e215885c9
BLAKE2b-256 47c076c4c6a1c2adf7e274ea2b7c68ed99820b461d4066897ac39668a5e28cb4

See more details on using hashes here.

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