@ast-bro/cli
v3.0.0
Published
Fast, AST-based code-navigation and log-squeezing toolkit — downloads the binary on install
Maintainers
Readme
@ast-bro/cli
npm installer for ast-bro — a fast, AST-based code-navigation toolkit for source files (shape, public API, dep & call graphs, hybrid semantic search, structural rewrite, MCP server). Downloads the pre-built Rust binary on install.
Formerly
@ast-outline/cli. Same project under a new scope (theast-outlinename became overloaded after the tool grew beyond outlining). Theast-outlinecommand is still installed as a thin proxy that forwards toast-bro, so existing scripts keep working.
Install
npm install -g @ast-bro/cliThis installs three commands, all forwarding to the same binary:
ast-bro— canonical namesb— short alias (same tool, fewer keystrokes)ast-outline— backward-compat shim
Usage
# Map the structure of a file (signatures + line ranges, no bodies)
ast-bro map src/player.rs
# Show the exact source of a specific method
ast-bro show Player.cs TakeDamage
# Compact digest of a whole module
ast-bro digest src/services/
# True public API (resolves pub use / __all__ re-exports)
ast-bro surface .
# Find all implementations of a type
ast-bro implements IDamageable src/
# Dependency graph
ast-bro deps src/auth.rs --depth 2
ast-bro reverse-deps src/auth.rs
ast-bro cycles
# Call graph (AST-accurate)
ast-bro callers TakeDamage
ast-bro callees Player.TakeDamage
# Hybrid BM25 + dense semantic search
ast-bro search "how does login work"
# Find semantically similar code
ast-bro find-related src/auth/login.rs:42
# AST-aware structural search and rewrite (with metavariables)
ast-bro run -p '$FUNC($$$)' -l rust
ast-bro run -p 'foo($A)' -r 'bar($A)' --write # apply to diskOn first run, the CLI downloads the pre-built binary for your platform from GitHub releases and caches it locally.
| Platform | Cache directory |
|---|---|
| macOS | ~/Library/Caches/ast-bro-<version>/ |
| Linux | ~/.cache/ast-bro-<version>/ |
Supported Platforms
| Platform | Status | |---|---| | macOS ARM64 | Pre-built binary available | | Other platforms | Build from source (see below) |
For unsupported platforms, build from source:
cargo install ast-broWhat is ast-bro?
ast-bro is a fast, AST-based code-navigation toolkit built for LLM coding agents and humans. It uses tree-sitter via ast-grep to parse source files and provide:
- File shape —
map/digest/showfor signatures with line ranges (95% token savings vs reading full files) - True public API —
surfaceresolves re-export graphs across Rust, Python, TypeScript, and more - Dependency graph —
deps/reverse-deps/cycles/graphfor import analysis - Call graph —
callers/calleeswith AST accuracy across 14 languages - Semantic search — hybrid BM25 + dense embeddings via
searchandfind-related - Structural rewrite —
runfor AST-aware pattern matching with metavariables (find + replace) - MCP server — every command exposed as an MCP tool for LLM agents
Supports Rust, Python, TypeScript, JavaScript, Java, C#, C++, Kotlin, Scala, Go, PHP, Ruby, SQL, and Markdown.
Links
- ast-bro source code
- PyPI package (Python installer)
- crates.io (Rust library)
