Add a new module that builds a structural map of the repository by parsing
source files with tree-sitter, building a cross-file reference graph
weighted by IDF, ranking files with PageRank, and rendering a
token-budgeted summary of the most important files and their signatures.
Stage 1 — Core module (src/context/repoMap/):
Symbol extraction via web-tree-sitter WASM, IDF-weighted reference graph
via graphology, PageRank ranking, token-budgeted rendering via js-tiktoken
cl100k_base, disk cache with mtime invalidation. Supports TypeScript,
JavaScript, and Python. 10 tests.
Stage 2 — RepoMap tool (src/tools/RepoMapTool/):
buildTool wrapper registered in src/tools.ts. Read-only, concurrency-safe.
Supports focus_files, focus_symbols, and max_tokens parameters. 9 tests.
Stage 3 — Integration:
Auto-injection into session context behind REPO_MAP feature flag (off by
default). /repomap slash command with --tokens, --focus, --stats, and
--invalidate flags. User-facing docs in docs/repo-map.md. 13 tests.
With the flag off, the system context is byte-identical to previous behavior.
Dependencies: web-tree-sitter, tree-sitter-wasms, graphology,
graphology-pagerank, graphology-operators, js-tiktoken
Tests: 32 new, 621 total passing, 0 failures.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>