diagonaldiagrams
v0.9.1Diagrams and charts for agents: Mermaid or a spec in, an audited SVG out.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
describe Describe a figure type
Look up how to write a spec. With a figure type it returns that type's spec shape, rules, size budgets and an example; with no type it lists every type. Also takes style and story. Read-only, writes nothing. Call it before render when you are unsure of the shape.
| Parameter | Type | Description |
|---|---|---|
type | string | Figure type to describe, e.g. flow, arch, iso, bar, style or story. Omit to list all types. |
render Draw and audit a figure
Draw one figure and audit it in a single call. Validates the input, lays it out, writes OUT.svg, OUT.html and a receipt (OUT.graph.json) side by side, then checks the drawing. Returns one JSON line: ok, the file paths, a layout outline and any warnings. When ok is false, each error has a fix: change the spec or options and call render again. Overwrites files at the same out path. Use validate to check an input without drawing, and audit for an SVG this tool did not just draw.
| Parameter | Type | Description |
|---|---|---|
type * | string | Figure type: mermaid (data is Mermaid text), flow, arch, seq, schema, iso (3D layer stack), bar, line, scatter, geo, or any chart type that describe lists. |
data | string | CSV, GeoJSON or Mermaid text, inline. Give exactly one of spec, scene, data or path. |
options | object | CLI flags without dashes, e.g. {"x": "month", "y": "signups", "group": "product", "title": "...", "highlight": ["Atlas"]}. describe lists them. Diagrams also take "style": a stylesheet object (or a li… |
out | string | Output path ending .html (default diagonaldiagrams-out.html). The .svg and the receipt are written beside it. |
path | string | A spec, scene, CSV or Mermaid file on disk, instead of inline input. |
scene | object | A v2 scene, inline: {"preset": "flow", "nodes": [...], "edges": [...], "groups": [...]}; type names its preset. Give exactly one of spec, scene, data or path. |
spec | object | The figure as a JSON object, inline, in the shape `describe <type>` prints. Give exactly one of spec, scene, data or path. |
validate Validate a spec
Check an input without drawing anything: a spec, scene or CSV. Returns JSON with ok and, on failure, errors that each carry a fix. Read-only, and cheaper than render while you are still shaping the spec. For a finished drawing use audit.
| Parameter | Type | Description |
|---|---|---|
type * | string | Figure type: mermaid (data is Mermaid text), flow, arch, seq, schema, iso (3D layer stack), bar, line, scatter, geo, or any chart type that describe lists. |
data | string | CSV, GeoJSON or Mermaid text, inline. Give exactly one of spec, scene, data or path. |
options | object | CLI flags without dashes, e.g. {"x": "month", "y": "signups", "group": "product", "title": "...", "highlight": ["Atlas"]}. describe lists them. Diagrams also take "style": a stylesheet object (or a li… |
path | string | A spec, scene, CSV or Mermaid file on disk, instead of inline input. |
scene | object | A v2 scene, inline: {"preset": "flow", "nodes": [...], "edges": [...], "groups": [...]}; type names its preset. Give exactly one of spec, scene, data or path. |
spec | object | The figure as a JSON object, inline, in the shape `describe <type>` prints. Give exactly one of spec, scene, data or path. |
audit Audit an SVG
Check a finished SVG or HTML figure for what you cannot see in your own output: text over text, arrows through boxes, text that spills out of its shape, low contrast, tiny text, and in 3D figures text hidden behind a nearer face. Works on any SVG on disk, not only ones this tool drew. Returns JSON: ok, errors with a fix, and warnings. Read-only. render already audits its own output, so use this after hand edits or on a figure from elsewhere.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the .svg or .html figure to check. |
export Export a figure to another format
Redraw a rendered figure as png, pdf, svg, drawio or excalidraw. It reads the receipt (OUT.graph.json) that render wrote beside the figure, so the figure must have been drawn by this tool. Writes the new file next to it, or at out, and returns the path as a line of text. png and pdf need cairosvg or headless Edge or Chrome. Overwrites an existing file at the same path.
| Parameter | Type | Description |
|---|---|---|
path * | string | The figure's base path, or its .html or .svg. OUT.graph.json must sit beside it. |
layout | string | Page preset for png and pdf: figure (760 px wide, default), wide (1120), slide (1280) or social (1080). |
out | string | Where to write the file. Default: beside the figure. |
to | string | Output format. Default png. |
infer Suggest a scatter spec from a CSV
Propose a starting spec for a scatter chart from a CSV. Returns the spec as JSON to edit and pass to render. Read-only: it suggests and draws nothing. Only for scatter charts; for other charts, describe the type and write the spec yourself.
| Parameter | Type | Description |
|---|---|---|
data | string | CSV text, inline. Give this or path. |
path | string | A CSV file on disk. Give this or data. |
apply Patch a spec file
Edit a spec file with a patch instead of rewriting it: move or reorder items, rename text, change colors, add or remove things, or move them into a group, so a regenerated spec keeps the change. Changes the spec file in place and writes the patch beside it (SPEC.patch.json). Render the spec to the same out path again; changed in the result says what moved.
| Parameter | Type | Description |
|---|---|---|
patch * | A list of operations (place, order, style, text, add, remove, move-to-group), or the path of a patch file. | |
spec * | string | Path of the spec file to change. It is edited in place. |
story Build an animated story page
Present one figure as a story: a story file lists views that focus, dim, highlight and reveal parts of it, and one HTML page animates between them. Writes OUT.html and returns JSON with ok, the path and the views; overwrites an existing page. describe story shows the story file's shape. For a plain figure use render.
| Parameter | Type | Description |
|---|---|---|
out * | string | The page to write, ending .html. |
story * | string | Path of the story file (JSON). |
diff Compare two drawings
Say what changed between two drawings of the same figure (.svg or .html): items added, removed, renamed, moved, reordered or recolored, as JSON and plain sentences. Read-only. Use it after apply or an edit to confirm the change did what you meant.
| Parameter | Type | Description |
|---|---|---|
new * | string | The later drawing (.svg or .html). |
old * | string | The earlier drawing (.svg or .html). |