feat: thread steps + thread fork #345

Merged
xiaomo merged 1 commits from feat/342-thread-steps-fork into main 2026-05-18 16:34:55 +00:00
Owner

What

Add uwf thread steps and uwf thread fork commands.

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, ThreadForkOutput
  • packages/uwf-protocol/src/index.ts — export new types
  • packages/cli-uwf/src/commands/thread.tscmdThreadSteps (walk chain, list chronologically) + cmdThreadFork (verify step belongs to thread, create new ULID, update index)
  • packages/cli-uwf/src/cli.ts — wire up thread steps and thread fork subcommands

Ref

Refs #342, #343, #344

## What Add `uwf thread steps` and `uwf thread fork` commands. ## 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`, `ThreadForkOutput` - `packages/uwf-protocol/src/index.ts` — export new types - `packages/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 up `thread steps` and `thread fork` subcommands ## Ref Refs #342, #343, #344
xiaoju added 1 commit 2026-05-18 16:30:31 +00:00
- uwf thread steps <thread-id>: walk CAS chain, list all steps chronologically
- uwf thread fork <thread-id> <step-hash>: create new thread from history point
- New types: StartEntry, StepEntry, ThreadStepsOutput, ThreadForkOutput
- Supports both active and archived threads

Refs #342
xiaomo approved these changes 2026-05-18 16:34:53 +00:00
xiaomo left a comment
Owner

LGTM

一个小 nit(不阻塞):cmdThreadFork 里 startNode 分支的 if (cur === stepHash) 是 dead code — 循环顶部已经检查过了。

类型设计不错,ThreadStepsOutput.steps[StartEntry, ...StepEntry[]] tuple 保证至少有 start。

LGTM ✅ 一个小 nit(不阻塞):`cmdThreadFork` 里 startNode 分支的 `if (cur === stepHash)` 是 dead code — 循环顶部已经检查过了。 类型设计不错,`ThreadStepsOutput.steps` 用 `[StartEntry, ...StepEntry[]]` tuple 保证至少有 start。
xiaomo merged commit 67e689ff1a into main 2026-05-18 16:34:55 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#345