Skip to main content

Crate toolpath_dot

Crate toolpath_dot 

Source
Expand description

Generate Graphviz DOT visualizations from Toolpath documents.

Renders Documents — Steps, Paths, and Graphs — as Graphviz DOT digraphs. Steps become nodes, parent references become edges, and actor types are color-coded (blue for humans, green for agents, yellow for tools). Dead ends are highlighted with dashed red borders.

§Example

use toolpath::v1::{Document, Path, PathIdentity, Step};
use toolpath_dot::{render, RenderOptions};

let step = Step::new("step-001", "human:alex", "2026-01-29T10:00:00Z")
    .with_raw_change("src/main.rs", "@@ -1 +1 @@\n-old\n+new")
    .with_intent("Fix greeting");

let path = Path {
    path: PathIdentity { id: "p1".into(), base: None, head: "step-001".into() },
    steps: vec![step],
    meta: None,
};

let dot = render(&Document::Path(path), &RenderOptions::default());
assert!(dot.contains("digraph toolpath"));

Pipe the output through Graphviz to produce images:

path derive git --repo . --branch main | path render dot | dot -Tpng -o graph.png

Structs§

RenderOptions
Options controlling what information is rendered in the DOT output.

Functions§

actor_color
Return a fill color for a given actor string.
escape_dot
Escape a string for use in DOT label attributes (double-quoted context).
escape_html
Escape a string for use inside HTML-like DOT labels.
render
Render any Toolpath Document variant to a Graphviz DOT string.
render_graph
Render a Graph as a DOT digraph.
render_path
Render a Path as a DOT digraph.
render_step
Render a single Step as a DOT digraph.