Skip to content

feat(cli): add --workflow for sequential pattern composition#2069

Open
1rashiid wants to merge 5 commits into
danielmiessler:mainfrom
1rashiid:feature/workflow-composition
Open

feat(cli): add --workflow for sequential pattern composition#2069
1rashiid wants to merge 5 commits into
danielmiessler:mainfrom
1rashiid:feature/workflow-composition

Conversation

@1rashiid
Copy link
Copy Markdown

@1rashiid 1rashiid commented Mar 19, 2026

Adds a --workflow <file> flag that runs multiple patterns in sequence, piping each step's output into the next step's input. Workflows are simple YAML/JSON files with a steps: list — each step names a pattern and may optionally override input, variables, model, or vendor.

Every step reuses the existing Chatter.Send path, so all current flags (--stream, --dry-run, -m, -v, --context, etc.) keep working. Patterns are validated against the local store before any LLM call, and runtime failures stop immediately with a [step N/TOTAL pattern] failed: … error. Progress goes to stderr; final result to stdout. Single-pattern -p usage is untouched.

cat article.txt | fabric --workflow wf.yaml --stream

🤖 Generated with Claude Code

Adds a lightweight pattern composition feature that lets users chain
multiple patterns together via a simple YAML/JSON workflow file,
piping each step's output into the next step's input.

* New --workflow flag parses YAML/JSON with steps: [{pattern, input?,
  variables?, model?, vendor?}]
* Each step reuses the existing Chatter.Send path, so --stream,
  --dry-run, -m/-V, -v, --context, --strategy, --language all continue
  to work unchanged
* Pre-flight validation: empty steps, missing pattern, repeated
  patterns, and unknown pattern names all fail before any LLM call
* Per-step input override: an optional `input:` field lets a step
  ignore the carried output; whitespace-only values are treated as no
  override
* Progress + errors use a consistent "[step N/TOTAL pattern]" prefix
  on stderr so stdout stays pipe-clean
* Single-pattern -p path is untouched – workflow only activates when
  --workflow is set

Tests cover loading, validation, input-override chaining, empty-output
handling, and bad/malformed workflow files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ksylvan ksylvan self-assigned this Mar 19, 2026
@ksylvan ksylvan marked this pull request as draft March 19, 2026 15:15
@ksylvan
Copy link
Copy Markdown
Collaborator

ksylvan commented Apr 9, 2026

Please fix the modernize errors, @1rashiid - Thanks.,

@ksylvan ksylvan marked this pull request as ready for review April 23, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants