Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLI
AssigneesNone

#336 Add --stdin support to method run and workflow run for Unix pipe composition

Opened by stack72 · 5/12/2026

Problem

A user wants to query data artifacts and run a method (or workflow) against each result. Today the only options are writing a shell loop or building a full workflow YAML — both are too much ceremony for ad-hoc CLI use.

For example, a user discovers 10 pending items with swamp data query and wants to run a transform method on each one. They shouldn't need to write a workflow definition or a bash script to do this.

Proposed Solution

Add --stdin support to swamp method run and swamp workflow run so they can read input from a pipe, following standard Unix composition patterns:

swamp data query source-model --where "status == 'pending'" --json \
  | swamp method run target-model transform --stdin
swamp data query source-model --where "active == true" --json \
  | swamp workflow run my-workflow --stdin

Each piped item would produce a discrete method/workflow run with its own data artifact, preserving normal data lineage and output tracking.

Implementation Notes

  • data query --json already produces structured JSON output suitable for piping
  • method run and workflow run currently only accept --input and --input-file — no stdin
  • A readStdin() utility already exists in the codebase (used by workflow edit)
  • Both commands share input_parser.ts, so the change is likely in one place
  • This follows Unix composition principles — no new concepts for users who already know pipes

Alternatives Considered

  • method run --foreach <query>: embeds iteration into the method command, creating complex error semantics (partial failure, retry, continue-on-error flags). Mixes orchestration concerns into a single-execution command.
  • Requiring users to write a workflow YAML for this: too much ceremony for ad-hoc use cases. Workflows are the right answer for repeatable automation, not for exploratory one-off operations.
  • Adding --apply to data query: puts execution concerns in the data layer, wrong separation of responsibilities.
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

5/12/2026, 5:01:34 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.