Docs / Guides
GUIDES

CLI reference

Every render, inspect and validate flag, exit code and diagnostic shape.

The bpmn binary reads .bpmn and .bpmn20.xml files and never modifies them. inspect and validate print human-readable text by default and a versioned JSON object with --format json; render instead takes --format svg|png to select its output format.

bpmn render

Render one diagram of a BPMN file to SVG or PNG.

bpmn render [OPTIONS] --output <OUTPUT> <INPUT>

  -o, --output <OUTPUT>   Output file path or `-` for stdout (SVG only)
  -f, --format <FORMAT>   svg (default) or png; inferred from the output
                          extension when omitted
      --diagram <DIAGRAM> Diagram id, or zero-based index when the value is
                          a non-negative number. Defaults to the first
                          diagram (with a warning when the file has several)
      --scale <SCALE>     Positive finite scale for rasterized output only

SVG output is deterministic: stable element ids, escaped labels, explicit viewBox and markers. PNG rasterization goes through resvg with system fonts: output maps generic families through a deterministic fallback chain (DejaVu Sans → Liberation Sans → Noto Sans → Arial, same for serif) and emits raster.font_substituted or raster.missing_fonts warnings when a preferred family is unavailable — so exact PNG bytes can differ between machines with different installed fonts.

bpmn inspect

Summarize a BPMN file's contents: a diagramCount plus counts of processes, participants, lanes, nodes by kind, flows and annotations.

bpmn inspect process.bpmn --format json

bpmn validate

Validate references, geometry and DI coverage without rendering.

bpmn validate process.bpmn [--format json] [--strict]

--strict promotes warnings to errors. Diagnostics are ordered, stable and machine-readable: each carries a code such as reference.dangling or di.missing_shape, a severity, the semantic or DI element id when known, and a one-based source line when available.

Exit codes

Every command uses the same contract, so scripts only need to check one number:

  • 0 — success
  • 2 — invalid usage
  • 3 — invalid BPMN or DI
  • 4 — IO failure
  • 5 — render failure

Use it as a CI gate

- run: |
    for f in models/*.bpmn; do bpmn validate "$f" --format json --strict; done

Invalid models fail the job with exit code 3 and a JSON report you can pin or diff. See TEST-001 for the pinned fixture matrix behind these guarantees.