March 25, 2026
5 pull requests merged across 1 repo
bahdotsh/indxr
- New
src/dep_graph.rsmodule with heuristic import resolution across languages (Rustcrate::, JS/TS relative.//../, Python dot-paths, generic segment matching) - File-level graph: resolves imports to indexed files, builds file-to-file dependency edges with deduplication and path scoping
- Symbol-level graph: edges from
extends/implementsrelationships + word-boundary signature matching for type references - Output formats: DOT (Graphviz), Mermaid (renders in GitHub markdown), and JSON
- MCP tool
get_dependency_graphwith params:path(scope),level(file/symbol),format(dot/mermaid/json),depth(hop limit) - CLI flag
--graph [dot|mermaid]combinable with--filter-pathfor scoped output - 24 new tests (18 unit + 6 MCP integration), 0 clippy warnings
Usage
# CLI
indxr --graph mermaid # full codebase mermaid graph
indxr --graph dot --filter-path src/mcp # scoped DOT graph
indxr --graph mermaid -o deps.md # write to file
# MCP tool
get_dependency_graph { "format": "mermaid" }
get_dependency_graph { "path": "src/mcp", "level": "symbol", "format": "dot" }
get_dependency_graph { "format": "json", "depth": 2 }
Test plan
-
cargo test— 146 tests pass (24 new) -
cargo clippy— 0 warnings - Self-tested on the indxr codebase with
--graph mermaidand--graph dot --filter-path src/mcp— produces accurate dependency graphs - Verify MCP tool via
indxr serveand callingget_dependency_graphwith various params
- Add
indxr watchstandalone command that monitors source files and auto-regenerates INDEX.md on changes - Add
--watchflag toindxr servefor MCP server auto-reindexing without agents callingregenerate_index - Refactor MCP server loop from blocking stdin to channel-based event loop (
ServerEventenum) to support concurrent stdin + watcher events - Uses
notify+notify-debouncer-mini(300ms default debounce) — no async runtime, stays fully synchronous with threads/channels - Lightweight pre-filter skips INDEX.md, cache dir, hidden files, and non-source files to avoid spurious rebuilds
- 6 new unit tests for the trigger filter logic
Usage
# Standalone watch mode
indxr watch ./project # watches and updates INDEX.md
indxr watch ./project -o out.md # custom output path
indxr watch --debounce-ms 500 # custom debounce
# MCP server with auto-reindex
indxr serve --watch ./project # MCP + file watching
Test plan
-
cargo build— compiles cleanly -
cargo test— all 115 tests pass (including 6 new watch tests) -
cargo clippy— no warnings -
cargo fmt— clean - Manual:
indxr watch .→ edit a.rsfile → verify INDEX.md updates with "Change detected" on stderr - Manual:
indxr serve --watch .→ verify MCP tools work normally + auto-reindex on file changes
- Adds
indxr initsubcommand that scaffolds all configuration files for AI agent integration in a single command - Supports Claude Code (
--claude), Cursor (--cursor), Windsurf (--windsurf), or all at once (default) - Generates MCP configs, agent instruction files (CLAUDE.md, .cursorrules, .windsurfrules), PreToolUse hooks, INDEX.md, and .gitignore entry
- Safe by default: skips existing files with a warning,
--forceto overwrite - Includes 17 unit tests covering templates, file conflict handling, and gitignore logic
- Updates all documentation: README, CLAUDE.md, CLI reference, agent integration guide, MCP server docs
Files created per agent
| Flag | Files |
|---|---|
--claude | .mcp.json, CLAUDE.md, .claude/settings.json |
--cursor | .cursor/mcp.json, .cursorrules |
--windsurf | .windsurf/mcp.json, .windsurfrules |
| Always | .gitignore (append), INDEX.md (unless --no-index) |
Usage
indxr init # all agents
indxr init --claude # Claude Code only
indxr init --cursor --windsurf # Cursor + Windsurf
indxr init --no-index --no-hooks # skip INDEX.md and hooks
indxr init --force # overwrite existing files
Test plan
-
cargo buildcompiles without errors -
cargo test— all 109 tests pass (17 new init tests) - Manual smoke test:
indxr init --claude --no-indexin temp directory creates expected files - Re-running
indxr initskips existing files with correct warnings - Verify
indxr initwith INDEX.md generation on a real project - Verify generated
.mcp.jsonworks withindxr serve
- Split the 2,387-line
src/mcp.rsinto asrc/mcp/module tree with 4 focused files: mod.rs(192 lines) — JSON-RPC types, protocol handlers, server loophelpers.rs(831 lines) — extracted utility functions (compile_glob_matcher,split_identifier,bigram_similarity,collapse_nested_bodies,contains_word_boundary,is_compact,serialize_compact,to_compact_rows, etc.), types (SymbolMatch,SignatureMatch,ShallowDeclaration,RelevanceMatch), and constantstools.rs(1,467 lines) — tool definitions, dispatcher, and all 18 tool implementationstests.rs(1,196 lines) — all unit and integration tests- No functional changes — pure structural refactor
- Addresses review feedback from PR #1 about file size and helper extraction
Test plan
-
cargo buildcompiles with zero warnings - All 93 tests pass (
cargo test) - Public API unchanged (
mcp::run_mcp_serveris the only export)
Adds 13 token-saving features to the MCP server, growing it from 12 to 18 tools. All changes are additive and backward-compatible.
6 New Tools
get_diff_summary— Structural diff against a git ref (branch/tag/commit). Shows added/removed/modified declarations instead of raw diffs. Reuses existingdiff.rsengine.batch_file_summaries— Summarize multiple files in one call viapathsarray orglobpattern (cap: 30 files). Eliminates 5-10 sequentialget_file_summaryround-trips.get_callers— Find who references a symbol by searching imports and signatures across all files. Approximate but far cheaper than agents grepping manually.get_public_api— Public API surface of a file or directory. Only public declarations with signatures — no bodies, no privates, no counts.explain_symbol— Full interface metadata (signature, doc comment, relationships, async/test/deprecated flags) without reading body source.get_related_tests— Find test functions for a symbol by naming convention (test_*,*_test, etc.) and file association.
7 Enhancements to Existing Tools
read_source— Newsymbols: [...]array for multi-symbol reads (500 line cap) andcollapse: trueto fold nested block bodies to{ ... }search_relevant— Newkind: "fn"filter and improved scoring with camelCase/snake_case-aware identifier splitting + bigram fuzzy fallbackget_token_estimate— Newdirectory/globparams for bulk token estimation across file setsregenerate_index— Now delta-aware: returnschangesfield showing files added/removed/modifiedlookup_symbol,list_declarations,search_signatures,search_relevant— Newcompact: trueparam for columnar{columns, rows}output (~30% token savings)
Shared Helpers Added
simple_glob_match, split_identifier, bigram_similarity, collapse_nested_bodies, to_compact_rows, collect_public_decls, find_tests_for_symbol, explain_decl
Test plan
-
cargo build— compiles cleanly -
cargo test— all 37 tests pass (28 existing + 9 new/updated) - New tests:
test_score_match_camel_case_aware,test_split_identifier,test_simple_glob_match - Updated tests: score_match expectations adjusted for identifier-part scoring, tool count updated to 18
- INDEX.md regenerated
- CLAUDE.md updated with new tools in exploration workflow and token savings table