Skip to main content

Crate ast_to_mermaid

Crate ast_to_mermaid 

Source
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:

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 a2m binary.
diff
Set-diff between two materialized bundles.
error
Error types for the ast-to-mermaid pipeline.
git_source
Git-backed source enumeration for --ref mode.
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::Store populated with code atoms.
resolve
Cross-module call resolver.
sequence
Sequence-diagram extraction and rendering.