Skip to main content
Version: v5.6.1

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​

FlagMeaning
--out <file>Write the YAML to this file instead of stdout.

Exit codes​

CodeMeaning
0Exported.
1The command failed (workflow not found, server error, unwritable file).
2Usage 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).