ast-index v3.40.4
Fast code search CLI for 34 programming languages. Native Rust implementation.
Supported Projects
| Platform | Languages | File Extensions |
|---|
| Android | Kotlin, Java | .kt, .java |
| iOS | Swift, Objective-C | .swift, .m, .h |
| Web/Frontend | TypeScript, JavaScript | .ts, .tsx, .js, .jsx, .mjs, .cjs, .vue, .svelte |
| Web/Frontend | CSS, SCSS, Less | .css, .pcss, .postcss, .scss, .less |
| Systems | Rust | .rs |
| Systems | Zig | .zig, .zon |
| Backend | C#, Python, Go, C++, Scala | .cs, .py, .go, .cpp, .cc, .c, .hpp, .scala, .sc |
| Backend | PHP | .php, .phtml |
| Scripting | Ruby, Perl | .rb, .pm, .pl, .t |
| Mobile | Dart/Flutter | .dart |
| Schema | Protocol Buffers, WSDL/XSD | .proto, .wsdl, .xsd |
| Enterprise | BSL (1C:Enterprise) | .bsl, .os |
| Scripting | Lua, Bash | .lua, .sh, .bash, .zsh |
| Functional | Elixir | .ex, .exs |
| Data | SQL, R | .sql, .r, .R |
| Scientific | Matlab | .m |
| JVM | Groovy | .groovy, .gradle |
| Functional | Common Lisp | .lisp, .lsp, .cl, .asd |
| Game | GDScript (Godot) | .gd |
Project type is auto-detected.
Setup guide for your project — install, commands, and usage examples.
Installation
Homebrew (macOS/Linux)
brew tap defendend/ast-index
brew install ast-index
Winget (Windows)
winget install --id defendend.ast-index
Migration from kotlin-index
If you have the old kotlin-index installed:
brew uninstall kotlin-index
brew untap defendend/kotlin-index
brew tap defendend/ast-index
brew install ast-index
From source
git clone https://github.com/defendend/Claude-ast-index-search.git
cd Claude-ast-index-search
cargo build --release
# Binary: target/release/ast-index (~44 MB)
Troubleshooting: Syntax errors on install
If brew install ast-index fails with merge conflict errors (<<<<<<< HEAD), reset your local tap:
cd /opt/homebrew/Library/Taps/defendend/homebrew-ast-index
git fetch origin
git reset --hard origin/main
brew install ast-index
Quick Start
cd /path/to/project
# Build index
ast-index rebuild
# Search
ast-index search ViewModel
ast-index class BaseFragment
ast-index implementations Presenter
ast-index usages Repository
Monorepo workflow
If your repo has subdirectories with their own VCS markers (git submodules,
subtrees, nested Cargo.toml / settings.gradle), read-commands normally
stop at the nearest marker — they won't reuse a parent-level index even
if one exists. Pass --walk-up, or set AST_INDEX_WALK_UP=1, to tell
the lookup to prefer any existing parent DB over nested markers:
# once, in the root
cd /monorepo && ast-index rebuild
# later, from any subproject — reuse the root index
AST_INDEX_WALK_UP=1 ast-index search ViewModel
# or per-call:
ast-index --walk-up search ViewModel
This is opt-in by design: silently preferring a far-away parent DB could
surface a stale or misconfigured index from an earlier accidental
rebuild higher up. With the flag you explicitly say "trust the parent".
AI Agent Integration
Claude Code Plugin
# Option 1: via marketplace
claude plugin marketplace add defendend/Claude-ast-index-search
claude plugin install ast-index
# Option 2: if ast-index is already installed
ast-index install-claude-plugin
Restart Claude Code to activate. Update: brew upgrade ast-index && claude plugin update ast-index. Uninstall: claude plugin uninstall ast-index.
See examples/.claude/rules/ast-index.md for a template rules file that teaches the agent to prefer ast-index over grep, outline before reading large files, and pass the same instructions to subagents. Adapt before dropping into your project's .claude/rules/.
MCP server (Cursor, Codex, Cline, Continue, OpenCode, Windsurf, …)
An MCP server that exposes ast-index tools to any MCP-compatible agent. Each
tool call spawns ast-index <subcommand>, parses the output, and returns a
compact TOON-inspired text blob (≈2-3× fewer tokens than pretty JSON). Agents
can opt into raw JSON per-call via format: "json" when they need structured
parsing.
Build:
cargo build --release -p ast-index-mcp
# Binary: target/release/ast-index-mcp
Exposed tools (20):