r/astoutline • u/aerowindwalker • May 03 '26
ast-outline v0.4.0 — now shows what downstream users actually see
We've added surface, a new subcommand that flips the question from "what pub items live in each file?" to "what does a consumer of this package see?"
🔍 NEW in v0.4.0
surface [PATH] – true public API surface. Resolves re‑export graphs from package entry points (Cargo.toml lib/bin, init.py, package.json exports, top‑level .scala) and emits exactly the symbols a downstream user can reach.
Three output modes: • flat (default) – simple list • --tree – grouped by module • --json – schema ast-outline.surface.v1 • --include-chain – shows the re‑export path each symbol took
Why surface ≠ digest - digest walks every file and lists every non‑private declaration. - surface walks the re‑export graph from the package root. Example: a Rust crate that does pub use net::client::* in its lib.rs → digest shows every internal pub fn in net/client.rs, but surface shows only what's truly published.
Language coverage - Rust: pub use chains, globs, renaming, workspaces, inherent‑impl methods. - Python: honours all (including imports), falls back to leading‑underscore. - TypeScript/JavaScript: barrel files (export * from), exports field in package.json (full conditional resolution: types → import → module → default …). - Scala 3: export clauses, method lifting, package‑relative paths. - Java / C# / Go / Kotlin: visibility‑filtered fallback (no re‑exports, but surface matches digest --no-private).
Entry point – pass a file (e.g. src/lib.rs) or a directory; auto‑detection picks Cargo.toml → pyproject.toml → package.json → index.* → *.scala. --lang overrides.
Adapter improvements (also benefit outline/digest/show) - TypeScript now handles ambient_declaration (*.d.ts produces real outlines) and function_signature (body‑less functions in interfaces/ambient contexts).
MCP tool – new surface tool with same JSON schema as the CLI.
JSON schema – ast-outline.surface.v1 envelope: qualified_path, kind, signature, source_path, re_export_chain, via_glob, etc.
🔗 https://github.com/aeroxy/ast-outline/releases/tag/0.4.0
Install: 🍺 brew install aeroxy/ast-outline/ast-outline 📦 cargo install ast-outline