# summary

Render structured AgentDiagramData JSON to Mermaid, draw.io XML, maxGraph JSON, SVG, or PDF.

# description

Reads an AgentDiagramData JSON document and renders it with the plugin's deterministic diagram renderer. Use this instead of hand-rolling a one-off conversion script. The AgentDiagramData shape is: `{ type, title?, direction?, nodes: [{ id, label, shape?, group?, style? }], edges: [{ from, to, label?, style?, arrowhead? }], participants?, messages? }`. Output goes to a file with `--out`, or to stdout when `--out` is omitted. The `svg` and `pdf` formats emit the same painted diagram the web-console shows (orthogonal edge routing, ER row-level connections, group bands) — not raw mxGraph XML. `pdf` requires `--out` and a local puppeteer install.

# examples

- `sf setup-agents diagram render --input data.json --format mermaid`
- `sf setup-agents diagram render --input data.json --format drawio --out docs/architecture/diagram.drawio`
- `sf setup-agents diagram render -i data.json -f maxgraph-json -o diagram.json`
- `sf setup-agents diagram render -i data.json -f svg -o diagram.svg`
- `sf setup-agents diagram render -i data.json -f pdf -o diagram.pdf`

# flags.input.summary

Path to an AgentDiagramData JSON file.

# flags.format.summary

Output format: mermaid, drawio, maxgraph-json, svg, or pdf.

# flags.out.summary

Path to write the rendered output. When omitted, the result is printed to stdout.

# info.wrote

Wrote %s (%s).

# error.invalidJson

Could not parse %s as JSON: %s

# error.invalidData

%s is not valid AgentDiagramData: expected an object with a "nodes" array.

# error.pdfNeedsOut

PDF output requires --out (the PDF is binary and cannot be written to stdout).

# error.puppeteer

PDF rendering needs puppeteer. Install it with: npm install puppeteer
