This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
just check # build, test, vet, lint, module verification
go test -run TestParseGoFile ./... # focused test
go test -short ./... # skip integration tests
go test -bench=. -benchmem ./... # benchmarksRun just --list for the repository-owned build recipes. Standard Go commands
remain valid for focused checks.
The public repomap package owns repository analysis. The Kong CLI lives in
internal/cli/; its entry point is cmd/repomap/main.go.
-
ScanFiles (
scanner.go) — discovers source files viagit ls-files(fallback: directory walk). Skips vendor, node_modules, build artifacts, files over 50 KB, and binary files. Language detection usesLanguageFor()inlanguage.go. -
parseFiles (
parse_dispatch.go) — parallel Go + non-Go parsing:- Go:
ParseGoFile(parser_go.go) always usesgo/ast; commands that need semantic relationships additionally useinternal/goanalysis - Non-Go: tiered fallback: tree-sitter → ctags → regex
- Tree-sitter grammars:
parser_ts_*.go(C/C++, Java, Python, Rust, TypeScript/JS, Web) - Regex fallback:
parser_generic.go,parser_cfamily.go,parser_web.go - Availability is reported by
TreeSitterAvailable()andCtagsAvailable()
- Tree-sitter grammars:
- Go:
-
RankFiles (
ranker.go) — combines structural score, dependency relationships, and optional task-intent evidence without changing the structural ranker's global ordering contract. -
BudgetFiles (
budget.go) — assigns detail levels within the selection estimate: -1 (omit), 0 (header), 1 (summary), 2 (full symbols), 3 (symbols + struct field expansion).internal/cli/output_budget.gothen enforces the public token limit against the complete encoded response. -
Format — enriched Markdown is the default. Compact, verbose, detail, source lines, XML, JSON line envelopes, and structured JSON are also available. Bounded CLI output is encoded atomically; structured records are never byte-cut.
Map.Task (task.go, task_select.go, task_render.go) composes a separate
bounded implementation handoff from goal evidence, source excerpts,
relationships, repository rules, related changes, verification commands, and
explicit truncation accounting.
Map(repomap.go) — main orchestrator. Thread-safe (sync.RWMutex). Lazy output caching. Stale-checking via mtime polling with 30s debounce.Symbol(types.go) — name, kind, signature, receiver, exported, span, and documentationFileSymbols— symbols + imports from one fileRankedFile— FileSymbols + Score, DetailLevel, ImportedByTaskReport(task.go) — schema-versioned task evidence packet shared by human and JSON rendering
Optional BM25 re-ranking before detail selection is activated by --intent.
Field-level evidence covers paths, packages, symbols, signatures,
documentation, and imports. The task command uses the same evidence but
selects at most six primary targets by positive relevance first, structural
score second, and path last; structural fallbacks are labeled when the goal has
no positive match.
cache.go— disk cache viaSaveCache/LoadCache(JSON, keyed by SHA-256 of the absolute root path). Version 15 includes content hashes, saved Git HEAD, and a deterministic cache-relevant worktree digest so dirty-worktree reuse is safe.outputCache— lazy in-memory render cache owned byMap.cache statusinspects an entry without rebuilding;cache warmbuilds, saves, and verifies a fresh entry.
Defined in language.go as a single languageDefs slice. To add a language: add an entry there, then optionally add a tree-sitter registration in a new parser_ts_<lang>.go. The regex parsers in parser_generic.go handle remaining languages by pattern.
Optional .repomap.yaml at project root. Loader in config.go; filters applied in parse_dispatch.go, scanner.go, and commit_analyze.go. Absent file = no-op.
| Field | Type | Purpose |
|---|---|---|
method_blocklist |
[]string |
Glob (Test*) or regex (/^pb_/) patterns — drops matching symbol names at parse time |
include_paths |
[]string |
Glob patterns (relative to root). When non-empty, only matching files are scanned |
exclude_paths |
[]string |
Glob patterns. Matching files are always excluded; takes precedence over include_paths |
file_overrides |
map[string]string |
Glob → detail level ("full" or "omit"). Forces a file to that level regardless of rank |
file_overrides uses path.Match globs; patterns containing ** match any path with the corresponding prefix.
- Tests use the standard library plus
testifyassertions. - Integration tests create temporary Git repositories and real source files.
testing.Short()gates expensive integration coverage.testdata/task/contains twelve deterministic Go, TypeScript, and PHP task manifests.
repomap [directory] # default: enriched, 2048 tokens
repomap -t 4096 -f verbose ./src # bounded verbose map
repomap -f lines ./src # bounded source-line format
repomap --json-structured ./src # structured repository schema
repomap task "fix auth middleware" . # bounded implementation handoff
For the current flags, commands, task-report schema, confidence/provenance meanings, and worked examples, see docs/11-usage-examples.md and docs/03-output-formats.md.