feat(workflow-utils): dryRun support for spawnSafe, cursorAgent, llmExtract #105

Merged
xiaomo merged 1 commits from feat/104-dryrun-utils into main 2026-04-25 00:26:27 +00:00
Owner

What

spawnSafecursorAgentllmExtract 三个副作用函数支持 dryRun 模式。

Why

配合 #101StartSignal.meta.dryRun,workflow 里可以把 dryRun flag 透传给工具函数,跳过实际执行只打 log。所有 log 被 log-store 记录,便于调试和流程验证。

Changes

  • spawn-safe.ts: SpawnSafeOptionsdryRun: boolean,dryRun 时 log 参数 + 返回 stub { exitCode: 0, stdout: '[dryRun] skipped' }
  • cursor-agent.ts: CursorAgentOptionsdryRun: boolean,dryRun 时短路不走 spawnSafe
  • llm-extract.ts: LlmExtractOptions<T>dryRun: boolean,dryRun 时跳过 fetch 返回 {} as T
  • 兼容性:使用 Omit 联合类型,现有不传 dryRun 的调用不 break
  • 测试:spawnSafe + llmExtract 各加 dryRun 用例

Tests

378 tests pass (workflow-utils 6, core 26, store 73, cli 122, daemon 151)

Ref

Fixes #104

## What `spawnSafe`、`cursorAgent`、`llmExtract` 三个副作用函数支持 `dryRun` 模式。 ## Why 配合 #101 的 `StartSignal.meta.dryRun`,workflow 里可以把 dryRun flag 透传给工具函数,跳过实际执行只打 log。所有 log 被 log-store 记录,便于调试和流程验证。 ## Changes - **spawn-safe.ts**: `SpawnSafeOptions` 加 `dryRun: boolean`,dryRun 时 log 参数 + 返回 stub `{ exitCode: 0, stdout: '[dryRun] skipped' }` - **cursor-agent.ts**: `CursorAgentOptions` 加 `dryRun: boolean`,dryRun 时短路不走 spawnSafe - **llm-extract.ts**: `LlmExtractOptions<T>` 加 `dryRun: boolean`,dryRun 时跳过 fetch 返回 `{} as T` - 兼容性:使用 `Omit` 联合类型,现有不传 dryRun 的调用不 break - 测试:spawnSafe + llmExtract 各加 dryRun 用例 ## Tests 378 tests pass (workflow-utils 6, core 26, store 73, cli 122, daemon 151) ## Ref Fixes #104
xiaoju added 1 commit 2026-04-25 00:24:40 +00:00
When dryRun=true, each function logs its parameters and returns a stub
result without executing any subprocess or network call. Log output is
captured by log-store for analysis.

- spawnSafe: returns { exitCode: 0, stdout: '[dryRun] skipped' }
- cursorAgent: short-circuits before spawnSafe, returns ok('[dryRun] skipped')
- llmExtract: skips fetch, returns ok({} as T)
- Tests added for spawnSafe and llmExtract dryRun paths

Fixes #104
xiaomo approved these changes 2026-04-25 00:26:26 +00:00
xiaomo left a comment
Owner

LGTM — dryRun 工具函数层全覆盖

亮点:

  • 端到端透传链路完整:CLI → IPC → workflow-manager → worker → StartSignal.meta
  • Omit 联合类型 + resolve helper 向后兼容,零 breaking change
  • spawnSafe / cursorAgent / llmExtract 三个副作用入口全部 dryRun 短路
  • crash recovery 路径也带上了 dryRun(PendingThread / triggerPayload / ensureThreadMessagesWithStart)
  • normalizeStartMeta 防御旧数据缺少 dryRun 的情况
  • 新增 isDryRun() 导出,workflow 作者开箱即用
  • 378 tests 全绿

代码干净,合并 🚀

## ✅ LGTM — dryRun 工具函数层全覆盖 **亮点:** - 端到端透传链路完整:CLI → IPC → workflow-manager → worker → StartSignal.meta - `Omit` 联合类型 + resolve helper 向后兼容,零 breaking change - spawnSafe / cursorAgent / llmExtract 三个副作用入口全部 dryRun 短路 - crash recovery 路径也带上了 dryRun(PendingThread / triggerPayload / ensureThreadMessagesWithStart) - `normalizeStartMeta` 防御旧数据缺少 dryRun 的情况 - 新增 `isDryRun()` 导出,workflow 作者开箱即用 - 378 tests 全绿 代码干净,合并 🚀
xiaomo merged commit 611bc48751 into main 2026-04-25 00:26:27 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#105