feat: restructure CLI commands (workflow/thread/step/turn) #467
Reference in New Issue
Block a user
Delete Branch "fix/463-http-methods"
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?
Fixes #463
重构方向正确,命令拆分合理,废弃提示完整 👍 几个问题需要修:
必须修
1.
step.ts里walkChain/expandDeep等大量代码是从thread.ts复制的walkChain、expandDeep、expandValue、expandCasRefField、expandAnyOfField、expandArrayField、expandObjectField、collectOrderedSteps、expandOutput— 这些函数在thread.ts里本来就有,现在step.ts里又写了一遍。应该提取到一个共享模块(比如
src/chain.ts或src/cas-expand.ts),两边 import。代码重复是 bug 的温床。2.
step read是个半成品CLI 已注册、README 已写、migration guide 也列了,但实现是 TODO + JSON fallback。要么这个 PR 不暴露
step read命令(注释掉 CLI 注册),要么实现它。半成品命令暴露给用户会造成困惑。建议:这个 PR 先不注册
step read,README 里标注(coming soon),等 #462 合并后再加。3.
cmdThreadKill没删thread.ts里cmdThreadKill函数还在(文件末尾),但 CLI 已经注册了 deprecation handler 指向stop/cancel。函数本身不再被任何 CLI 命令调用。应该删掉,避免死代码。4.
thread list --status completed的逻辑有 bug当
statusFilter === "idle"时,不加载 history(正确),但也不 filter active threads(走到最后 return items,包含了所有 active = idle + running)。实际上--status idle会返回 running 的 thread。修法:filter 应该在 return 之前统一做,或者把 active threads 的加载也条件化。
建议(不阻塞)
5.
StepEntry.detail类型从CasRef改成unknownworkflow-protocol/src/types.ts里把detail: CasRef改成了detail: unknown。这是 protocol 层的 breaking change,影响所有消费者。虽然step list需要展开 detail,但 protocol 类型应该保持 CAS 语义(是引用),展开是 CLI 层的事。建议:protocol 保持
CasRef,CLI 输出类型单独定义。6. PR 标题和 branch 名
小橘提醒了,标题是
fix: add explicit return types for GET/POST methods,branch 是fix/463-http-methods,跟实际内容(CLI 命令重构)完全不搭。建议改一下 PR title。7.
workflow-agent-claude-code/package.json加了workflow-util依赖这个改动跟 CLI 重构无关,应该在单独的 commit/PR 里。
fix: add explicit return types for GET/POST methodsto feat: restructure CLI commands (workflow/thread/step/turn)LGTM 👍 四个必须修的问题都解决了。
两个小瑕疵不阻塞合并,合并后顺手清理:
cmdThreadRunning函数还在thread.ts里但没有调用方了,可以删掉step read但命令没注册,建议标注(coming soon)或先去掉