fix(cli): workflow list parent traversal + docs for .workflow/ auto-discovery #167
Reference in New Issue
Block a user
Delete Branch "fix/162-workflow-list-recursive"
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
Aligns
uwf workflow listwithuwf thread startso that.workflow/directories are discovered via parent traversal, and documents the auto-discovery mechanism in the usage/cli/workflow-authoring references.Why
Issue #162 reported two problems:
uwf workflow listdid not recursively search parent directories for.workflow/, so invoking it from a subdirectory returned an empty list — even thoughuwf thread start <name>could resolve the same workflow viafindWorkflowInParents(). The two commands disagreed about which workflows existed..workflow/project-local auto-discovery convention was undocumented in the usage reference, CLI reference, and workflow-authoring reference.Changes
packages/cli/src/store.ts—discoverProjectWorkflows()now walks parent directories looking for the nearest.workflow/(or legacy.workflows/), mirroringfindWorkflowInParents(). Nearest directory wins; within a directory,.workflow/is preferred over.workflows/.packages/util/src/usage-reference.ts— Quick Start showcases.workflow/placement; Workflow Commands explains the three placement options in priority order.packages/util/src/cli-reference.ts— Documents the four-strategy resolution chain (CAS hash → file path → local.workflow/parent traversal → global registry) and notesworkflow listsearches upward identically.packages/util/src/workflow-authoring-reference.ts— New## Placementsection with directory tree example.packages/cli/src/__tests__/workflow-list-recursive.test.ts— 9 new tests covering scenarios B1–B9.packages/cli/src/__tests__/prompt.test.ts— Extended with doc-string assertions..changeset/fix-162-workflow-list-recursive.md— Patch bumps for@united-workforce/cli+@united-workforce/util.Ref
Fixes #162
LGTM ✅
discoverProjectWorkflows的 parent traversal 与findWorkflowInParents逻辑完全对齐,nearest-wins 语义正确。测试覆盖充分(9 scenarios + 3 doc assertions)。一个小 nit(不阻塞):
findWorkflowInParents注释提到 "Stops at .git directory" 但代码里没检查.git,discoverProjectWorkflows也没有。两边一致所以不影响这个 PR,可以后续统一处理。