mirror of
https://github.com/openclaw/lobster.git
synced 2026-08-25 12:50:33 -04:00
[PR #13] feat(stdlib): add each command for per-item sub-pipeline iteration #13
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/openclaw/lobster/pull/13
Author: @sfo2001
Created: 2/15/2026
Status: 🔄 Open
Base:
main← Head:feat/pipeline-each📝 Commits (4)
671dcd6fix(stdlib): remove unused Transport type and transport variable5d78f6crefactor(stdlib): extract shared template_utils from map and templateee6b629feat(parser): add brace-delimited body syntax for sub-pipelines542e2f6feat(stdlib): add each command for per-item sub-pipeline iteration📊 Changes
9 files changed (+399 additions, -52 deletions)
View changed files
📝
src/cli.ts(+1 -1)📝
src/commands/registry.ts(+2 -0)➕
src/commands/stdlib/each.ts(+85 -0)📝
src/commands/stdlib/llm_task_invoke.ts(+0 -3)📝
src/commands/stdlib/map.ts(+1 -20)📝
src/commands/stdlib/template.ts(+1 -21)➕
src/commands/stdlib/template_utils.ts(+21 -0)📝
src/parser.ts(+107 -7)➕
test/each.test.ts(+181 -0)📄 Description
Motivation
Pipelines currently have no native way to read from or write to local files. Loading data requires shelling out (
exec cat+ manual parsing), and there is no structured JSON transformation primitive beyondmap.file.read,file.write, andjq-filterfill these gaps: pipelines can ingest local datasets, persist intermediate results, and apply arbitrary jq expressionswithout leaving the pipeline or spawning ad-hoc shell commands.
Summary
eachcommand: runs a sub-pipeline for each input item, collecting resultseach { map --unwrap url | exec curl "{{.}}" })template_utils.tsfrommapandtemplateto eliminate duplication{{.field}}interpolation in sub-pipeline args per item; nestedeachsupportedChanges
src/commands/stdlib/each.tssrc/commands/stdlib/template_utils.tssrc/parser.ts(brace body parsing)src/commands/stdlib/map.ts,template.ts(use shared util)src/commands/registry.ts(+1)test/each.test.ts(12 tests + 8 parser tests)+389 / -48 lines across 7 files.
Test plan
pnpm buildpassespnpm lintpassesnode --test dist/test/each.test.js-- 20 tests (12 each + 8 parser brace tests)mapandtemplatetests still pass (template_utils refactor)Use of AI
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.