Skip to content

feat(core): loop iteration via .step() with each:#83

Open
ben-rogerson wants to merge 17 commits intomainfrom
feat/workflow-iteration
Open

feat(core): loop iteration via .step() with each:#83
ben-rogerson wants to merge 17 commits intomainfrom
feat/workflow-iteration

Conversation

@ben-rogerson
Copy link
Copy Markdown
Owner

Summary

  • Adds each: to .step() so a workflow step can run a sub-workflow once per item from a directory glob, JSON file, or function.
  • Per-iteration outputs land in <work_dir>/.generata/loops/<workflow>-<step>-<run>.json, surfaced downstream as <step-id>_manifest.
  • Supports concurrency (sequential by default), onFailure: "halt" | "continue", onItemFail for per-failure side effects, and maxRetries per iteration.
  • New exports from @generata/core: LoopWorkflowStep and EachSource.
  • Bundles two earlier merged-but-unshipped PRs: opt-in worktree cleanup (feat: opt-in worktree cleanup #80) and drop startup banner (chore: drop startup banner and tagline #81).

Test plan

  • pnpm fmt
  • pnpm lint
  • pnpm typecheck
  • pnpm test (262 passing)
  • Run a real workflow with a each: { items: ... } loop end-to-end against the live CLI before depending on this in production.

Drives the full path: builder accepts loop step, precheck passes, engine
dispatches to runLoopStep, sub-workflow runs per item, manifest is written,
and `<step-id>_manifest` flows downstream to the next step.

Also fixes the engine's loop-step deps wiring: the inner runWorkflow now
forwards deps to sub-workflow runs so a mocked runAgent applies to both
outer and sub steps. Without this, the integration test (and any caller
mocking runAgent) would silently fall back to the real CLI inside loop
sub-runs.
@ben-rogerson ben-rogerson added the wontfix This will not be worked on label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant