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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ast_bro-4.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ast_bro-4.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file ast_bro-4.1.0.tar.gz.

File metadata

  • Download URL: ast_bro-4.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ast_bro-4.1.0.tar.gz
Algorithm Hash digest
SHA256 7fe502f010df98a3e0937a9e5da5066fe9fd2c5af746021625b176b50550c27f
MD5 48249ab107cfa7c923936a0e3af60b3d
BLAKE2b-256 02cab32e2b127c47cb7748ef38faa850f7664e2928da2a44e7176d5bb0cd38cd

See more details on using hashes here.

File details

Details for the file ast_bro-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: ast_bro-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ast_bro-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1dbbedf8f324368532ab265b66bb7d3b5a29742150813935e97a95d4e8e0eb07
MD5 cd47ef3146843a14cf6441db7a1adaaf
BLAKE2b-256 0467ba2b21a0a87ccff0f78837c476d5fa0f7ed1fffce827f827b337ce8b4d65

See more details on using hashes here.

Release history Release notifications | RSS feed

4.2.0

2 files

This release

4.1.0 This release

2 files

4.0.0

2 files

3.0.0

2 files

2.4.3

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.0

2 files

2.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page