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

For an isolated tool installation, use uv tool install ast-bro. Both commands work on Windows x64 with Python 3.8+; no Rust toolchain is needed.

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/<version>/
Linux ~/.cache/ast-bro/<version>/
Windows %LOCALAPPDATA%\ast-bro\Cache\<version>\

Supported Platforms

Platform Status
macOS ARM64 Pre-built binary available
Windows x64 (Windows 10/11) Pre-built binary available
Windows ARM64 Build from source
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 15 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, Elixir, SQL, and Markdown.

License

MIT

Metadata

Release files for ast-bro 4.7.1

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.7.1
File Size Uploaded Provenance Actions
ast_bro-4.7.1.tar.gz 6.7 kB Without provenance Details for ast_bro-4.7.1.tar.gz

Built distribution (wheel)

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

Total release size: 12.2 kB

Release files / ast_bro-4.7.1.tar.gz

Download URL ast_bro-4.7.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ffc3ec0497192ddc4dff89febd20c84d89557b52ac737c3adc6b9fd32274e991
BLAKE2b-256 checksum
How to use checksums
d4aebdea7ae896501b32b6ee32600e0c43402b4acb106edc961ceca84fd500d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

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

Download URL ast_bro-4.7.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22b1bd2b93324ab4b669784e37aee909f263f34e5bad88e87ea59dc3ea98523a
BLAKE2b-256 checksum
How to use checksums
fe394ade4246d322eb51515e30500579f837572709d04d0ced9e43d4ef2be6a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

Security for ast-bro 4.7.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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