feat: thread steps + thread fork #345
Reference in New Issue
Block a user
Delete Branch "feat/342-thread-steps-fork"
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?
What
Add
uwf thread stepsanduwf thread forkcommands.Why
Need to inspect thread execution history and create branches from historical steps (#342).
Changes
packages/uwf-protocol/src/types.ts— new types:StartEntry,StepEntry,ThreadStepsOutput,ThreadForkOutputpackages/uwf-protocol/src/index.ts— export new typespackages/cli-uwf/src/commands/thread.ts—cmdThreadSteps(walk chain, list chronologically) +cmdThreadFork(verify step belongs to thread, create new ULID, update index)packages/cli-uwf/src/cli.ts— wire upthread stepsandthread forksubcommandsRef
Refs #342, #343, #344
LGTM ✅
一个小 nit(不阻塞):
cmdThreadFork里 startNode 分支的if (cur === stepHash)是 dead code — 循环顶部已经检查过了。类型设计不错,
ThreadStepsOutput.steps用[StartEntry, ...StepEntry[]]tuple 保证至少有 start。