CLI
Commands
Section titled “Commands”diascope build
Section titled “diascope build”Render a D2 diagram and story sidecar into a self-contained HTML file.
diascope build <diagram.d2> <story.yaml> [options]
-o, --out <file> Output HTML file (default: <story>.html) --viewer-bundle <path> Custom path or URL for the viewer JS bundlediascope init
Section titled “diascope init”Scaffold a story file from # @step annotations in a D2 diagram.
diascope init <diagram.d2> [options]
-o, --out <file> Output story file (default: <diagram>.story.yaml)Build behavior
Section titled “Build behavior”When diascope build runs, it:
- renders the D2 source to SVG using the
d2CLI - parses the story YAML
- warns about story node IDs that do not exist in the rendered SVG
- writes a single HTML file containing the viewer shell and rendered story
Exit behavior
Section titled “Exit behavior”- If
d2fails, the command exits with status code1. - If the story file cannot be parsed, the command exits with an error from the parser layer.