mirror of
https://github.com/openclaw/lobster.git
synced 2026-08-25 12:50:33 -04:00
[PR #12] feat(stdlib): add file I/O and jq-filter commands #12
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/12
Author: @sfo2001
Created: 2/15/2026
Status: 🔄 Open
Base:
main← Head:feat/file-io-jq-filter📝 Commits (3)
671dcd6fix(stdlib): remove unused Transport type and transport variable1d88b05feat(stdlib): add file I/O and jq-filter commands2e6230ffeat(stdlib): add --raw flag to jq-filter command📊 Changes
10 files changed (+814 additions, -4 deletions)
View changed files
📝
.gitignore(+3 -0)📝
src/cli.ts(+1 -1)📝
src/commands/registry.ts(+6 -0)➕
src/commands/stdlib/file_read.ts(+86 -0)➕
src/commands/stdlib/file_write.ts(+70 -0)➕
src/commands/stdlib/jq_filter.ts(+84 -0)📝
src/commands/stdlib/llm_task_invoke.ts(+0 -3)➕
test/file_read.test.ts(+197 -0)➕
test/file_write.test.ts(+196 -0)➕
test/jq_filter.test.ts(+171 -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
file.readcommand: reads files into the pipeline with auto-detection of JSON, JSONL, and plain text formatsfile.writecommand: writes pipeline items to disk as JSON, JSONL, or text; supports tee passthrough for downstream stagesjq-filtercommand: applies jq expressions to each pipeline item, with--rawflag for plain string outputfile.read;file.writecreates parent directories by default (--mkdir)Changes
src/commands/stdlib/file_read.ts,file_write.ts,jq_filter.tssrc/commands/registry.ts(+3 registrations)src/cli.ts(minor)test/file_read.test.ts(12 tests),test/file_write.test.ts(10 tests),test/jq_filter.test.ts(10 tests)+682 lines across 9 files.
Test plan
pnpm buildpassespnpm lintpasses (0 warnings)node --test dist/test/file_read.test.js-- 12 testsnode --test dist/test/file_write.test.js-- 10 testsnode --test dist/test/jq_filter.test.js-- 10 testsjqon PATH for jq-filter testsUse of AI
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.