# summary

Import an existing diagram or org metadata into AgentDiagramData JSON.

# description

Builds the canonical AgentDiagramData model from a real source — force-app metadata, an existing draw.io file, a Mermaid `.mmd`, or a Markdown file with an embedded `mermaid` block — so `sf setup-agents diagram render` can re-lay-it-out optimally instead of you hand-authoring the JSON. Each source normalizes to the same model: nodes are entities/objects (never fields — an ERD models objects, a field's relationship becomes an edge), edges are relationships, and `group` is inferred per source (namespace for force-app, subgraph/swimlane for drawio/mermaid). Output goes to a file with `--out`, or to stdout when `--out` is omitted; pipe it into `diagram render`.

# examples

- `sf setup-agents diagram import --input force-app --from force-app --out model.json`
- `sf setup-agents diagram import --input docs/erd.drawio --out model.json`
- `sf setup-agents diagram import -i diagram.mmd --out model.json && sf setup-agents diagram render -i model.json -f drawio -o /tmp/erd.drawio`
- `sf setup-agents diagram import -i design.md` (extracts the embedded mermaid block, prints the model)

# flags.input.summary

Path to the source: a force-app directory, a .drawio file, a .mmd Mermaid file, or a .md Markdown file.

# flags.from.summary

Source adapter: force-app, drawio, mermaid, md, or auto (infer from the path — directory → force-app, by extension otherwise).

# flags.out.summary

Path to write the AgentDiagramData JSON. When omitted, the model is printed to stdout.

# flags.title.summary

Diagram title. Defaults to the input file/directory name.

# info.wrote

Wrote %s (imported via %s: %s nodes, %s edges).

# error.notFound

Input not found: %s
