diagonaldiagrams

v0.9.1
io.github.lucas19919/diagonaldiagrams Checked 6 hours ago Published 1 month ago

Diagrams 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.

ParameterTypeDescription
typestringFigure 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.

ParameterTypeDescription
type *stringFigure 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.
datastringCSV, GeoJSON or Mermaid text, inline. Give exactly one of spec, scene, data or path.
optionsobjectCLI 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…
outstringOutput path ending .html (default diagonaldiagrams-out.html). The .svg and the receipt are written beside it.
pathstringA spec, scene, CSV or Mermaid file on disk, instead of inline input.
sceneobjectA v2 scene, inline: {"preset": "flow", "nodes": [...], "edges": [...], "groups": [...]}; type names its preset. Give exactly one of spec, scene, data or path.
specobjectThe 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.

ParameterTypeDescription
type *stringFigure 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.
datastringCSV, GeoJSON or Mermaid text, inline. Give exactly one of spec, scene, data or path.
optionsobjectCLI 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…
pathstringA spec, scene, CSV or Mermaid file on disk, instead of inline input.
sceneobjectA v2 scene, inline: {"preset": "flow", "nodes": [...], "edges": [...], "groups": [...]}; type names its preset. Give exactly one of spec, scene, data or path.
specobjectThe 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.

ParameterTypeDescription
path *stringPath 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.

ParameterTypeDescription
path *stringThe figure's base path, or its .html or .svg. OUT.graph.json must sit beside it.
layoutstringPage preset for png and pdf: figure (760 px wide, default), wide (1120), slide (1280) or social (1080).
outstringWhere to write the file. Default: beside the figure.
tostringOutput 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.

ParameterTypeDescription
datastringCSV text, inline. Give this or path.
pathstringA 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.

ParameterTypeDescription
patch *A list of operations (place, order, style, text, add, remove, move-to-group), or the path of a patch file.
spec *stringPath 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.

ParameterTypeDescription
out *stringThe page to write, ending .html.
story *stringPath 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.

ParameterTypeDescription
new *stringThe later drawing (.svg or .html).
old *stringThe earlier drawing (.svg or .html).