opschain workflows export
Included from Basic tier
opschain workflows export <project>/<code> [--out <file.yaml>]
Exports a stored server workflow's current definition as its interchange
envelope YAML, for backup and change control — git's role here is backup
and change control, never sourcing. The envelope wraps the latest version's
authored source_yaml verbatim (the stored definition is the schema) and
adds only:
workflow:— the code (the identity);name:— carried only when it differs from the code;summary:— carried only when set (the explicit one-liner lists render);description:— carried only when set;draft:— always stated explicitly on export;definition: |— the authored YAML as a block scalar.
Version numbers are deliberately absent: workflows import always mints the
next number through the ordinary authorised path, so carrying one would
break the byte-identical export → import → export round trip that keeps git
backups clean. Rendering is deterministic (envelope keys in declaration
order, two-space indent, trailing newline), so re-exporting an unchanged
workflow is byte-identical and exported files diff cleanly.
Without --out the bare YAML goes to stdout, redirectable; with it, the
file is written and exported workflow <project>/<code> to <file> confirms.
Needs a server target (--server <url>, OPSCHAIN_SERVER, or the active
context).
Flags
| Flag | Meaning |
|---|---|
--out <file> | Write the YAML to this file instead of stdout. |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Exported. |
| 1 | The command failed (workflow not found, server error, unwritable file). |
| 2 | Usage error — malformed address, no server target. |
Named errors
expected <project>/<workflow-code>, got "<arg>"— exit 2.workflow "<code>" not found in project "<project>"— exit 1.
Examples
opschain workflows export demo/nightly --out backups/nightly.yaml
exported workflow demo/nightly to backups/nightly.yaml
See also
opschain docs cli/workflows-import— the other half of the round trip.opschain docs cli/workflows-show— the bare definition without the envelope.opschain learn 8.1(backup and interchange).