Skip to main content

ast-bro

PyPI License: MIT

PyPI 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 first run.

Formerly ast-outline-cli. Same project under a new name (the ast-outline name became overloaded after the tool grew beyond outlining). The ast-outline command is still installed as a thin proxy that forwards to ast-bro, so existing scripts keep working.

Install

pip install ast-bro

This installs three commands, all forwarding to the same binary:

  • ast-bro — canonical name
  • sb — 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 disk

On 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/
Linux ~/.cache/ast-bro/

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-bro

What 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 / show for signatures with line ranges (95% token savings vs reading full files)
  • True public API — surface resolves re-export graphs across Rust, Python, TypeScript, and more
  • Dependency graph — deps / reverse-deps / cycles / graph for import analysis
  • Call graph — callers / callees with AST accuracy across 14 languages
  • Semantic search — hybrid BM25 + dense embeddings via search and find-related
  • Structural rewrite — run for 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

License

MIT

Metadata

Release files for ast-bro 4.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ast-bro 4.2.0
File Size Uploaded
ast_bro-4.2.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ast-bro 4.2.0
File Interpreter ABI Platform
ast_bro-4.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / ast_bro-4.2.0.tar.gz

Download URL ast_bro-4.2.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8ea4eca713beda682e46c2add7344fb68e1b17edc0a2bb6b997abb5707cd7d19
BLAKE2b-256 checksum
How to use checksums
d39c175d6bdb52fedcbcba9c37ee9679105c7a853f051bfcbf74a9de01d80c6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / ast_bro-4.2.0-py3-none-any.whl

Download URL ast_bro-4.2.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
530212ad87fecf1aac6ce2f9da7b5793c72a7d76936c6ff32528f2e4f04240a1
BLAKE2b-256 checksum
How to use checksums
1e90d00805525f7c083825d94998018dacf09fa785f78e258ada92b6b0e2abb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

4.2.0 This release

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page