March 27, 2026
4 pull requests merged across 1 repo
bahdotsh/indxr
- Add
get_type_flowMCP tool that tracks where types flow across function boundaries — shows which functions produce (return) and consume (accept as parameters) a given type - Language-aware type extraction from signatures for Rust, Go, TS/JS, Python, Java/Kotlin/C#, and Swift
- Query-time analysis with no data model or cache changes — same O(declarations) scan pattern as
get_callers - Supports
pathfilter,include_fields,limit, andcompactcolumnar output
Test plan
- 13 unit tests for per-language type extraction (Rust, Go, TS, Python, Java, Kotlin, Swift, Ruby, edge cases)
- 8 integration tests for the tool (producers, consumers, case-insensitivity, compact, path filter, limit, error handling)
- Tool count assertion updated (21 → 22)
-
cargo fmtandcargo clippyclean - All 249 tests pass
- Add
indxr diff --pr <N>CLI command that resolves a GitHub PR's base branch via the API, then runs the existing structural diff pipeline — showing added/removed/modified declarations without reading raw diffs - Extend the MCP
get_diff_summarytool with an optionalprparameter so AI agents can diff PRs without knowing the base ref - Add
src/github.rsmodule: thin GitHub API client handling token auth (GITHUB_TOKEN/GH_TOKEN/ghCLI fallback), remote URL parsing (HTTPS + SSH), and PR metadata fetching viaureq
Test plan
-
cargo build— compiles cleanly (one expected warning forPrInfo.statefield reserved for future use) -
cargo test— all 214 tests pass, including 6 new URL parsing tests ingithub.rs - Manual:
indxr diff --pr <N>against a real PR in a GitHub-hosted repo - Manual:
indxr diff --since mainvia the new subcommand (parity with global--sinceflag) - Manual: verify error messages for missing token, non-GitHub remote, invalid PR number
- Manual: MCP
get_diff_summarywith{"pr": 7}viaindxr serve
- Adds per-function complexity metrics (cyclomatic complexity, max nesting depth, parameter count) using tree-sitter AST analysis across all 8 tree-sitter languages (Rust, Python, TS, JS, Go, Java, C, C++)
- New
get_hotspotsMCP tool returns top N most complex functions ranked by composite score, with path filtering, sort options, and compact mode - New
get_healthMCP tool returns aggregate codebase health metrics (avg/median/p90 complexity, documentation %, test count, hottest files) - New
--hotspotsCLI flag outputs a formatted complexity table to stdout
Design
- Complexity is computed as a post-processing pass in
src/parser/complexity.rsafter extraction — zero changes to any of the 8 language extractors ComplexityMetricsis anOptionfield onDeclarationwith#[serde(default)]for full backward compatibility- Per-language branch node tables cover: if/else, loops, match/switch arms,
&&/||/??, catch, ternary - Cache version bumped from 2 → 3 (one-time re-parse on upgrade)
Test plan
- 7 new unit tests in
complexity.rscovering Rust, Python, Go, C, and bodyless declarations - Tool definition count test updated (19 → 21)
- All 188 tests pass
-
cargo clippy -- -D warningsclean -
cargo fmtclean -
indxr --hotspotsverified on indxr's own codebase — produces reasonable rankings -
--filter-pathscoping verified
indxr initnow auto-detects RTK on PATH and configures its PreToolUse hooks alongside indxr's existing hooks- Writes
.claude/hooks/rtk-rewrite.sh(executable) that delegates tortk rewritewith proper exit code handling (rewrite/deny/ask/passthrough) - Settings.json gains a third PreToolUse entry for RTK's Bash command rewriting, placed before indxr's git-diff reminder hook
- CLAUDE.md, .cursorrules, and .windsurfrules get an RTK awareness section when detected
--no-rtkflag to skip RTK setup;--no-hookscontinues to skip all hooks as before- Graceful degradation: silently skips if rtk/jq not on PATH, no new dependencies added
Motivation
indxr saves tokens on the code-reading side (MCP tools instead of full file reads), but raw shell command output (git, cargo test, npm, etc.) is the other major token sink. RTK compresses that output by 60-90%. Together they cover both sources of context waste, and indxr init becomes the single setup command for both.
Test plan
-
cargo buildcompiles cleanly -
cargo test— all 181 tests pass (8 new tests for RTK integration) - Manual:
indxr init --claudewith rtk installed → verify.claude/hooks/rtk-rewrite.shcreated + executable, settings.json has 3 PreToolUse entries - Manual:
indxr init --claudewithout rtk → verify silent skip, settings.json has 2 entries - Manual:
indxr init --claude --no-rtkwith rtk installed → verify rtk skipped - Manual:
indxr init --claude --no-hooks→ no settings.json or hook script created