Open source · MIT · zero dependencies

RepoLens.

Huge or messy repo? Do not burn tokens mapping it. RepoLens extracts the full map of the codebase — index, dependency graph, routes, DB tables — deterministically, in seconds, without a single LLM call.

repolens — zsh
# one command, zero installs, zero dependencies
$ npx @x-quantum-tech/repolens .
→ docs/repo-map.md // index for humans and LLMs
→ docs/repo-map.json // structured graph + file:line provenance
→ docs/repo-map.html // interactive dashboard, treemap, offline
✓ map generated · LLM tokens spent: 0
— The problem

Every session, the agent
rediscovers the same things.

Every time an AI agent opens a mid-sized codebase, it burns hundreds of thousands of tokens rediscovering facts that do not change between commits: where the routes are, which tables exist, which environment variables matter, which file is the project god file.

RepoLens extracts all of that once, deterministically. Then you point the project's CLAUDE.md or AGENTS.md at the map, and every session starts with the context already loaded — the tokens go to the actual task, not to exploration.

A single file, zero dependencies, Node 18+.
Deterministic: same repo → same map. No hallucinations.
Regenerate on command or pre-commit: the map is code, not prose.
— What it accepts

Any folder,
any file.

RepoLens walks any directory and inventories every file — name, size, location, type. Nothing is excluded up front: it only skips the usual "noise" folders by default (node_modules, .git, dist, build, vendor, __pycache__…), and even those you can override in the config.

Files fall into three levels of treatment, from the most universal to the most targeted.

1

Inventory

On everything, binaries included

Every file counted and mapped by type. Images, video, PDFs, fonts and archives are mapped but never opened.

2

Text (auto)

On any text file

Lines of code (LOC), language, treemap sized by real weight.

3

Deep extraction

On text matched by the extractors

Structured catalogue: routes, tables, env vars, and any pattern you define by regex in the config.

— What you get

Three outputs, one command.

repo-map.md

Index for humans and LLMs

Compact, every entry a clickable file#L<line> link — works on GitHub and in VS Code.

repo-map.json

Structured graph

File tree, import graph, every catalogue row with file · line · link provenance. Ready for RAG and scripting.

repo-map.html

Interactive dashboard

Zoomable treemap, per-language bars, sortable and searchable tables. Self-contained, offline, UI in IT or EN.

— What it extracts

Framework-agnostic,
out of the box.

File tree & treemap

Structure, lines of code and languages, rendered as a squarified treemap.

Import graph

JS/TS/Python: fan-in / fan-out, dependency hubs and god files (≥1500 lines).

HTTP routes

Express, Hono, Koa, Cloudflare Workers, Python decorators — with auth heuristics and file:line.

Database tables

CREATE / ALTER TABLE from SQL files and inline SQL. Schema without a DB connection.

Environment variables

With reference counts and their positions in the code.

HTML pages → API

Which endpoints each page's JS actually calls. Plus npm scripts and Cloudflare wrangler bindings.

The core stays agnostic, your domain plugs in through the config: every custom extractor is a glob + a regex + field names, and every match becomes a catalogue row with automatic file:line provenance — one more tab in the HTML, one more section in the Markdown.

— Not just code

It extracts facts
from any text.

Level 3 runs on regex over text — so not only code. Markdown, YAML, TOML, CSV, .env, JSON, HTML, logs, SQL, OpenAPI, config files: any repeated pattern becomes a catalogue. The built-in extractors cover codebase things (routes, SQL tables, env vars, pages, npm scripts, wrangler bindings), but the ones you write in the config capture any pattern, in any text.

The .json output is already structured data, ready to hand to the AI — or to a RAG pipeline, a dashboard, a script.

Knowledge base / vault

Front-matter and links between notes (an Obsidian vault, say) → navigable catalogue + treemap.

Glossaries / datasets

Terms from a CSV, dictionary keys, repeated rows.

API specs

Endpoints from an openapi.yaml.

Content

Every H1/H2 across your documents, indexed.

Scattered config

Every feature flag, event name and secret name.

Legal documents

Criminal and civil codes, statutes, contracts: articles and clauses become a navigable catalogue, each with file:line for the exact citation.

— What it does not do yet

Honest about the limits.

It does not read inside binaries

PDF, .docx, .xlsx are seen and mapped, but their text is not extracted: that needs a dedicated parser. It will land as an optional plugin, so the "zero dependencies" promise stays intact.

Dependency graph: JS/TS/Python

The import "wiring" covers those languages. Go, Rust and Java would be roughly 15 more lines of regex each.

No semantic embedding

It extracts structure and facts, not meaning. Semantic chunking stays a job for the LLM / RAG downstream.

In one line: RepoLens is a deterministic extractor for any text corpus — ideal for preparing code maps for the AI, and equally documentation, config, data and legal corpora.

— What it is for

Not only
for the agents.

AI agent onboarding

The map replaces exploration: the session starts informed.

Planning refactors

God files and dependency hubs tell you where it hurts.

API inventory & audit

Every route, with method, auth hint and source location.

Human onboarding

Hand a new dev the HTML dashboard instead of a walkthrough.

Docs that do not rot

Regenerate on command: the map is code, not prose.

Drift check in CI

Diff the JSON between commits: new routes, tables or env vars surface in review.

— Open source · MIT

The code is public.

RepoLens is an open source X Quantum Tech tool, released under the MIT licence. One file, zero dependencies. Take it, map your repo, hand it to your agent.

Built by · X Quantum Tech · @x-quantum-tech/repolens on npm