Expand description
ast-to-mermaid — Mermaid diagram renderer for code ASTs.
Parses Rust and Python source trees with tree-sitter, builds an in-memory call/dependency graph, and renders Mermaid diagrams at five levels of detail.
Self-contained — no external graph backend, no async runtime, no database.
Five symbol-graph rendering levels:
Level::Project— one node per crate, cross-crate calls.Level::Overview— one node per module, cross-module calls.Level::Module— subgraph for one module + external callers/callees.Level::Function— central function + direct callers/callees.Level::Impact— reverse call chain (N hops, default 3).
Plus an orthogonal sequence view — Mermaid sequenceDiagram
extracted from one function’s body in source order.
Re-exports§
pub use error::AstToMermaidError;pub use error::Result;pub use graph::Store;pub use model::AtomKind;pub use model::CodeAtom;pub use model::Edge;pub use model::EdgeKind;pub use model::EntityId;pub use parser::CodeParser;pub use parser::Language;pub use pipeline::AnalyzeOptions;pub use pipeline::AnalyzeReport;pub use pipeline::analyze;pub use render::Level;pub use render::render;pub use resolve::resolve_cross_module_calls;pub use cli::*;
Modules§
- artifacts
- Rich 5-layer artifact emission.
- cache
- Two-tier content-addressed cache for parsed atoms and materialized bundles.
- cli
- Shared CLI infrastructure for the unified
a2mbinary. - diff
- Set-diff between two materialized bundles.
- error
- Error types for the ast-to-mermaid pipeline.
- git_
source - Git-backed source enumeration for
--refmode. - graph
- In-memory storage for parsed code atoms + edges.
- limits
- Crate-wide AST recursion depth limit shared by every recursive
tree-sitter visitor — [
crate::parser::rust::flatten_use], [crate::sequence::visit::State], and the sequence renderer (crate::sequence::render). - model
- Domain model: code atoms, edges, ids — the public types renderers and the pipeline consume.
- parser
- Code parser — tree-sitter Rust + Python →
CodeAtoms. - pipeline
- End-to-end orchestrator: filesystem → parser → store → resolver → renderer.
- render
- Mermaid renderers driven by a
crate::graph::Storepopulated with code atoms. - resolve
- Cross-module call resolver.
- sequence
- Sequence-diagram extraction and rendering.