cc-devflow 4.1.4 → 4.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/.claude/CLAUDE.md +87 -1183
  2. package/.claude/commands/core/architecture.md +2 -2
  3. package/.claude/commands/core/guidelines.md +2 -2
  4. package/.claude/commands/core/roadmap.md +4 -4
  5. package/.claude/commands/core/style.md +40 -268
  6. package/.claude/commands/flow/CLAUDE.md +28 -0
  7. package/.claude/commands/flow/archive.md +2 -2
  8. package/.claude/commands/flow/checklist.md +9 -251
  9. package/.claude/commands/flow/clarify.md +9 -127
  10. package/.claude/commands/flow/constitution.md +1 -1
  11. package/.claude/commands/flow/context.md +1 -1
  12. package/.claude/commands/flow/dev.md +19 -395
  13. package/.claude/commands/flow/fix.md +1 -6
  14. package/.claude/commands/flow/ideate.md +13 -13
  15. package/.claude/commands/flow/init.md +19 -41
  16. package/.claude/commands/flow/new.md +12 -268
  17. package/.claude/commands/flow/quality.md +10 -153
  18. package/.claude/commands/flow/release.md +18 -131
  19. package/.claude/commands/flow/restart.md +15 -16
  20. package/.claude/commands/flow/spec.md +14 -164
  21. package/.claude/commands/flow/status.md +12 -12
  22. package/.claude/commands/flow/update.md +4 -4
  23. package/.claude/commands/flow/upgrade.md +6 -6
  24. package/.claude/commands/flow/verify.md +19 -78
  25. package/.claude/commands/flow/workspace.md +3 -20
  26. package/.claude/docs/guides/INIT_TROUBLESHOOTING.md +7 -7
  27. package/.claude/docs/guides/NEW_TROUBLESHOOTING.md +44 -96
  28. package/.claude/docs/guides/ROADMAP_TROUBLESHOOTING.md +1 -1
  29. package/.claude/docs/guides/TASK_COMPLETION_MARKING.md +5 -5
  30. package/.claude/docs/guides/TEAM_MODE_GUIDE.md +0 -1
  31. package/.claude/docs/templates/ATTEMPT_TEMPLATE.md +1 -1
  32. package/.claude/docs/templates/BACKLOG_TEMPLATE.md +3 -3
  33. package/.claude/docs/templates/CLARIFICATION_REPORT_TEMPLATE.md +5 -5
  34. package/.claude/docs/templates/ERROR_LOG_TEMPLATE.md +2 -2
  35. package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +3 -3
  36. package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +33 -64
  37. package/.claude/docs/templates/RESEARCH_TEMPLATE.md +3 -3
  38. package/.claude/docs/templates/ROADMAP_DIALOGUE_TEMPLATE.md +2 -2
  39. package/.claude/docs/templates/ROADMAP_TEMPLATE.md +2 -2
  40. package/.claude/docs/templates/STYLE_TEMPLATE.md +3 -3
  41. package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +8 -9
  42. package/.claude/guides/workflow-guides/flow-orchestrator.md +31 -265
  43. package/.claude/hooks/CLAUDE.md +1 -1
  44. package/.claude/hooks/checklist-gate.js +4 -4
  45. package/.claude/hooks/inject-agent-context.ts +2 -2
  46. package/.claude/hooks/teammate-idle-hook.ts +1 -1
  47. package/.claude/rules/devflow-conventions.md +2 -93
  48. package/.claude/scripts/CLAUDE.md +1 -4
  49. package/.claude/scripts/calculate-checklist-completion.sh +2 -2
  50. package/.claude/scripts/check-prerequisites.sh +2 -2
  51. package/.claude/scripts/checklist-errors.sh +4 -4
  52. package/.claude/scripts/common.sh +12 -147
  53. package/.claude/scripts/flow-quality-full.sh +5 -5
  54. package/.claude/scripts/flow-quality-quick.sh +4 -4
  55. package/.claude/scripts/flow-workspace-init.sh +2 -2
  56. package/.claude/scripts/generate-clarification-report.sh +4 -4
  57. package/.claude/scripts/recover-workflow.sh +70 -73
  58. package/.claude/scripts/run-quality-gates.sh +1 -1
  59. package/.claude/scripts/setup-epic.sh +2 -2
  60. package/.claude/scripts/setup-ralph-loop.sh +2 -2
  61. package/.claude/scripts/validate-research.sh +1 -1
  62. package/.claude/scripts/verify-setup.sh +1 -1
  63. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +88 -108
  64. package/.claude/skills/workflow/CLAUDE.md +24 -0
  65. package/.claude/skills/workflow/flow-dev/CLAUDE.md +14 -76
  66. package/.claude/skills/workflow/flow-dev/SKILL.md +29 -67
  67. package/.claude/skills/workflow/flow-dev/context.jsonl +4 -8
  68. package/.claude/skills/workflow/flow-init/SKILL.md +23 -186
  69. package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +1 -1
  70. package/.claude/skills/workflow/flow-init/context.jsonl +3 -3
  71. package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +1 -1
  72. package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +15 -134
  73. package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +1 -1
  74. package/.claude/skills/workflow/flow-release/SKILL.md +20 -110
  75. package/.claude/skills/workflow/flow-release/context.jsonl +5 -7
  76. package/.claude/skills/workflow/flow-spec/CLAUDE.md +15 -101
  77. package/.claude/skills/workflow/flow-spec/SKILL.md +15 -518
  78. package/.claude/skills/workflow/flow-spec/context.jsonl +5 -7
  79. package/.claude/skills/workflow/flow-verify/CLAUDE.md +10 -0
  80. package/.claude/skills/workflow/flow-verify/SKILL.md +53 -0
  81. package/.claude/skills/workflow/flow-verify/context.jsonl +5 -0
  82. package/.claude/skills/workflow.yaml +72 -270
  83. package/CHANGELOG.md +72 -0
  84. package/README.md +91 -69
  85. package/README.zh-CN.md +90 -67
  86. package/bin/harness.js +22 -0
  87. package/docs/commands/README.md +34 -38
  88. package/docs/commands/README.zh-CN.md +34 -36
  89. package/docs/commands/core-roadmap.md +2 -2
  90. package/docs/commands/core-roadmap.zh-CN.md +2 -2
  91. package/docs/commands/core-style.md +29 -381
  92. package/docs/commands/core-style.zh-CN.md +29 -381
  93. package/docs/commands/flow-init.md +10 -10
  94. package/docs/commands/flow-init.zh-CN.md +11 -11
  95. package/docs/commands/flow-new.md +25 -260
  96. package/docs/commands/flow-new.zh-CN.md +26 -257
  97. package/docs/guides/getting-started.md +16 -15
  98. package/docs/guides/getting-started.zh-CN.md +10 -12
  99. package/lib/compiler/__tests__/manifest.test.js +156 -0
  100. package/lib/compiler/__tests__/parser.test.js +21 -0
  101. package/lib/compiler/index.js +17 -1
  102. package/lib/compiler/manifest.js +68 -6
  103. package/lib/compiler/parser.js +5 -0
  104. package/lib/harness/CLAUDE.md +21 -0
  105. package/lib/harness/cli.js +208 -0
  106. package/lib/harness/index.js +16 -0
  107. package/lib/harness/operations/dispatch.js +285 -0
  108. package/lib/harness/operations/init.js +48 -0
  109. package/lib/harness/operations/janitor.js +74 -0
  110. package/lib/harness/operations/pack.js +100 -0
  111. package/lib/harness/operations/plan.js +29 -0
  112. package/lib/harness/operations/release.js +83 -0
  113. package/lib/harness/operations/resume.js +44 -0
  114. package/lib/harness/operations/verify.js +163 -0
  115. package/lib/harness/planner.js +141 -0
  116. package/lib/harness/schemas.js +108 -0
  117. package/lib/harness/store.js +240 -0
  118. package/package.json +9 -1
  119. package/.claude/scripts/flow-workspace-start.sh +0 -217
  120. package/.claude/scripts/flow-workspace-switch.sh +0 -234
  121. package/.claude/skills/domain/using-git-worktrees/SKILL.md +0 -252
  122. package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +0 -133
  123. package/.claude/skills/domain/using-git-worktrees/context.jsonl +0 -4
  124. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +0 -218
  125. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +0 -232
  126. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +0 -130
  127. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +0 -140
  128. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +0 -70
@@ -36,39 +36,29 @@ get_repo_root() {
36
36
  fi
37
37
  }
38
38
 
39
- # Get current requirement ID from worktree path, branch, or environment
39
+ # Get current requirement ID from environment, workspace, or directory scan
40
+ # Priority: 1. $DEVFLOW_REQ_ID 2. .current-req file 3. latest requirement dir
40
41
  # Returns: REQ-XXX or BUG-XXX format
41
42
  get_current_req_id() {
42
- # First check if DEVFLOW_REQ_ID environment variable is set
43
+ # Priority 1: Environment variable
43
44
  if [[ -n "${DEVFLOW_REQ_ID:-}" ]]; then
44
45
  echo "$DEVFLOW_REQ_ID"
45
46
  return
46
47
  fi
47
48
 
48
- # Check if in git repo
49
- if git rev-parse --show-toplevel >/dev/null 2>&1; then
50
- # Try to extract from worktree directory name first (e.g., cc-devflow-REQ-123)
51
- local git_root
52
- git_root=$(git rev-parse --show-toplevel)
53
- local dir_name
54
- dir_name=$(basename "$git_root")
55
- if [[ "$dir_name" =~ -([A-Z]+-[0-9]+(-[0-9]+)?)$ ]]; then
56
- echo "${BASH_REMATCH[1]}"
57
- return
58
- fi
59
-
60
- # Then check git branch
61
- local branch=$(git rev-parse --abbrev-ref HEAD)
62
- # Extract REQ-XXX or BUG-XXX from branch name like feature/REQ-123-title or feature/REQ-20251006-001-title
63
- # Support formats: REQ-123, REQ-20251006-001, BUG-456, etc.
64
- if [[ "$branch" =~ (REQ-[0-9]+-[0-9]+|REQ-[0-9]+|BUG-[0-9]+-[0-9]+|BUG-[0-9]+) ]]; then
65
- echo "${BASH_REMATCH[1]}"
49
+ # Priority 2: Workspace .current-req file
50
+ local repo_root=$(get_repo_root)
51
+ local current_req_file="$repo_root/devflow/workspace/.current-req"
52
+ if [[ -f "$current_req_file" ]]; then
53
+ local req_from_file
54
+ req_from_file=$(cat "$current_req_file" 2>/dev/null | tr -d '[:space:]')
55
+ if [[ "$req_from_file" =~ ^(REQ|BUG)-[0-9]+(-[0-9]+)?$ ]]; then
56
+ echo "$req_from_file"
66
57
  return
67
58
  fi
68
59
  fi
69
60
 
70
- # For non-git repos, try to find the latest requirement directory
71
- local repo_root=$(get_repo_root)
61
+ # Priority 3: Latest requirement directory scan
72
62
  local req_dir="$repo_root/devflow/requirements"
73
63
 
74
64
  if [[ -d "$req_dir" ]]; then
@@ -630,131 +620,6 @@ get_delta_count() {
630
620
  fi
631
621
  }
632
622
 
633
- # =============================================================================
634
- # Git Worktree Functions (v4.3)
635
- # =============================================================================
636
-
637
- # Check if currently in a git worktree (not main repo)
638
- # Returns: 0 if in worktree, 1 if in main repo or not in git
639
- is_in_worktree() {
640
- local git_dir
641
- git_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1
642
-
643
- # If .git is a file (not directory), we're in a worktree
644
- if [[ -f "$(git rev-parse --show-toplevel 2>/dev/null)/.git" ]]; then
645
- return 0
646
- fi
647
- return 1
648
- }
649
-
650
- # Get the main repository path (works from any worktree)
651
- # Returns: absolute path to main repository
652
- get_main_repo_path() {
653
- local git_root
654
- git_root=$(git rev-parse --show-toplevel 2>/dev/null) || return 1
655
-
656
- if is_in_worktree; then
657
- # Read gitdir from .git file and extract main repo path
658
- local gitdir_content
659
- gitdir_content=$(cat "$git_root/.git" 2>/dev/null)
660
- if [[ "$gitdir_content" =~ ^gitdir:\ (.+)$ ]]; then
661
- local gitdir="${BASH_REMATCH[1]}"
662
- # gitdir format: /path/to/main/.git/worktrees/name
663
- echo "$gitdir" | sed 's|/.git/worktrees/.*||'
664
- fi
665
- else
666
- echo "$git_root"
667
- fi
668
- }
669
-
670
- # Get current worktree path
671
- # Returns: absolute path to current worktree (or main repo if not in worktree)
672
- get_worktree_path() {
673
- git rev-parse --show-toplevel 2>/dev/null
674
- }
675
-
676
- # Get worktree directory for a specific REQ_ID
677
- # Args: $1 - REQ_ID
678
- # Returns: expected worktree path (may not exist)
679
- get_worktree_dir_for_req() {
680
- local req_id="$1"
681
- local main_repo
682
- main_repo=$(get_main_repo_path) || return 1
683
-
684
- local repo_name
685
- repo_name=$(basename "$main_repo")
686
-
687
- echo "$(dirname "$main_repo")/${repo_name}-${req_id}"
688
- }
689
-
690
- # Check if a worktree exists for a specific REQ_ID
691
- # Args: $1 - REQ_ID
692
- # Returns: 0 if exists, 1 if not
693
- worktree_exists_for_req() {
694
- local req_id="$1"
695
- local worktree_dir
696
- worktree_dir=$(get_worktree_dir_for_req "$req_id")
697
-
698
- [[ -d "$worktree_dir" ]]
699
- }
700
-
701
- # Extract REQ_ID from current worktree path or branch
702
- # Returns: REQ_ID or empty string
703
- get_req_id_from_worktree() {
704
- local git_root
705
- git_root=$(git rev-parse --show-toplevel 2>/dev/null) || return 1
706
-
707
- # Try to extract from directory name first (e.g., cc-devflow-REQ-123)
708
- local dir_name
709
- dir_name=$(basename "$git_root")
710
- if [[ "$dir_name" =~ -([A-Z]+-[0-9]+(-[0-9]+)?)$ ]]; then
711
- echo "${BASH_REMATCH[1]}"
712
- return 0
713
- fi
714
-
715
- # Fall back to branch name
716
- local branch
717
- branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
718
- if [[ "$branch" =~ (REQ-[0-9]+(-[0-9]+)?|BUG-[0-9]+(-[0-9]+)?) ]]; then
719
- echo "${BASH_REMATCH[1]}"
720
- return 0
721
- fi
722
-
723
- echo ""
724
- }
725
-
726
- # List all worktrees with their REQ_IDs
727
- # Output format: path|branch|req_id (one per line)
728
- list_worktrees_with_req() {
729
- local main_repo
730
- main_repo=$(get_main_repo_path) || return 1
731
-
732
- git -C "$main_repo" worktree list --porcelain | while IFS= read -r line; do
733
- if [[ "$line" =~ ^worktree ]]; then
734
- local path="${line#worktree }"
735
- elif [[ "$line" =~ ^branch ]]; then
736
- local branch="${line#branch refs/heads/}"
737
- local req_id=""
738
- local dir_name
739
- dir_name=$(basename "$path")
740
- if [[ "$dir_name" =~ -([A-Z]+-[0-9]+(-[0-9]+)?)$ ]]; then
741
- req_id="${BASH_REMATCH[1]}"
742
- elif [[ "$branch" =~ (REQ-[0-9]+(-[0-9]+)?|BUG-[0-9]+(-[0-9]+)?) ]]; then
743
- req_id="${BASH_REMATCH[1]}"
744
- fi
745
- echo "${path}|${branch}|${req_id}"
746
- elif [[ "$line" =~ ^detached ]]; then
747
- local req_id=""
748
- local dir_name
749
- dir_name=$(basename "$path")
750
- if [[ "$dir_name" =~ -([A-Z]+-[0-9]+(-[0-9]+)?)$ ]]; then
751
- req_id="${BASH_REMATCH[1]}"
752
- fi
753
- echo "${path}|(detached)|${req_id}"
754
- fi
755
- done
756
- }
757
-
758
623
  # Color output helpers
759
624
  color_red() { echo -e "\033[0;31m$1\033[0m"; }
760
625
  color_green() { echo -e "\033[0;32m$1\033[0m"; }
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
  # [INPUT]: 依赖 run-quality-gates.sh, spec-reviewer, code-quality-reviewer, security-reviewer
3
3
  # [OUTPUT]: 完整质量验证结果和报告
4
- # [POS]: scripts 的完整质量验证脚本,被 /flow-quality --full 调用
4
+ # [POS]: scripts 的完整质量验证脚本,被 /flow:verify --strict 调用
5
5
  # [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
 
7
7
  set -e
@@ -72,7 +72,7 @@ echo " Output: $REQ_DIR/SPEC_REVIEW.md"
72
72
  cat > "$REQ_DIR/SPEC_REVIEW.md" << EOF
73
73
  # Spec Compliance Review
74
74
 
75
- > Generated by /flow-quality --full
75
+ > Generated by /flow:verify --strict
76
76
 
77
77
  ## Summary
78
78
 
@@ -103,7 +103,7 @@ echo " Output: $REQ_DIR/CODE_QUALITY_REVIEW.md"
103
103
  cat > "$REQ_DIR/CODE_QUALITY_REVIEW.md" << EOF
104
104
  # Code Quality Review
105
105
 
106
- > Generated by /flow-quality --full
106
+ > Generated by /flow:verify --strict
107
107
 
108
108
  ## Summary
109
109
 
@@ -139,7 +139,7 @@ fi
139
139
  cat > "$REQ_DIR/SECURITY_REPORT.md" << EOF
140
140
  # Security Report
141
141
 
142
- > Generated by /flow-quality --full
142
+ > Generated by /flow:verify --strict
143
143
 
144
144
  ## Summary
145
145
 
@@ -167,7 +167,7 @@ echo "--------------------"
167
167
  cat > "$REQ_DIR/TEST_REPORT.md" << EOF
168
168
  # Test Report
169
169
 
170
- > Generated by /flow-quality --full
170
+ > Generated by /flow:verify --strict
171
171
 
172
172
  ## Summary
173
173
 
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
  # [INPUT]: 依赖 run-quality-gates.sh
3
3
  # [OUTPUT]: 快速质量验证结果
4
- # [POS]: scripts 的快速质量验证脚本,被 /flow-quality 调用
4
+ # [POS]: scripts 的快速质量验证脚本,被 /flow:verify 调用
5
5
  # [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
 
7
7
  set -e
@@ -54,7 +54,7 @@ if [[ -n "$REQ_DIR" && -d "$REQ_DIR" ]]; then
54
54
  cat > "$REQ_DIR/TEST_REPORT.md" << EOF
55
55
  # Test Report
56
56
 
57
- > Generated by /flow-quality (quick mode)
57
+ > Generated by /flow:verify (quick mode)
58
58
 
59
59
  ## Summary
60
60
 
@@ -76,7 +76,7 @@ EOF
76
76
  cat > "$REQ_DIR/SECURITY_REPORT.md" << EOF
77
77
  # Security Report
78
78
 
79
- > Generated by /flow-quality (quick mode)
79
+ > Generated by /flow:verify (quick mode)
80
80
 
81
81
  ## Summary
82
82
 
@@ -87,7 +87,7 @@ EOF
87
87
  ## Checks Performed
88
88
 
89
89
  - [x] Baseline quality gate security checks
90
- - [ ] Deep security audit (use /flow-quality --full when needed)
90
+ - [ ] Deep security audit (use /flow:verify --strict when needed)
91
91
 
92
92
  ## Quality Gate
93
93
 
@@ -88,7 +88,7 @@ Workspace created for $DEVELOPER.
88
88
 
89
89
  ### Next Steps
90
90
 
91
- 1. Start a requirement with \`/flow-init "REQ-XXX|Title"\`
91
+ 1. Start a requirement with \`/flow:init "REQ-XXX|Title"\`
92
92
  2. Use \`/flow-workspace record "message"\` to track progress
93
93
  3. Use \`/flow-workspace start\` to recover context in new sessions
94
94
 
@@ -113,5 +113,5 @@ echo "Files created:"
113
113
  ls -la "$DEV_WORKSPACE"
114
114
  echo ""
115
115
  echo "Next steps:"
116
- echo " 1. Start a requirement: /flow-init \"REQ-XXX|Title\""
116
+ echo " 1. Start a requirement: /flow:init \"REQ-XXX|Title\""
117
117
  echo " 2. Record progress: /flow-workspace record \"message\""
@@ -288,21 +288,21 @@ EOF
288
288
  cat << EOF
289
289
  ✅ **Clarification complete**. All ${questions_answered} questions answered.
290
290
 
291
- Recommended next command: \`/flow-prd ${req_id}\`
291
+ Recommended next command: \`/flow:spec ${req_id}\`
292
292
  EOF
293
293
  elif [[ "$questions_count" -eq 0 ]]; then
294
294
  cat << EOF
295
295
  ✅ **No critical ambiguities detected**. research.md is sufficiently specified.
296
296
 
297
- Recommended next command: \`/flow-prd ${req_id}\`
297
+ Recommended next command: \`/flow:spec ${req_id}\`
298
298
  EOF
299
299
  else
300
300
  cat << EOF
301
301
  ⚠️ **Clarification incomplete**. ${questions_answered}/${questions_count} questions answered.
302
302
 
303
303
  Options:
304
- 1. Continue with \`/flow-clarify ${req_id}\` to complete remaining questions
305
- 2. Proceed with \`/flow-prd ${req_id}\` (acceptable risk if remaining items are low-impact)
304
+ 1. Continue with \`/flow:spec ${req_id} --overwrite\` to complete remaining questions
305
+ 2. Proceed with \`/flow:spec ${req_id}\` (acceptable risk if remaining items are low-impact)
306
306
  EOF
307
307
  fi
308
308
 
@@ -28,24 +28,23 @@ usage() {
28
28
 
29
29
  选项:
30
30
  -h, --help 显示此帮助信息
31
- --from STAGE 从指定阶段重新开始 (init/prd/epic/dev/quality/release, qa 兼容)
31
+ --from STAGE 从指定阶段重新开始 (init/spec/dev/verify/release;prd/epic/quality/qa 兼容)
32
32
  --force 强制恢复,跳过安全检查
33
33
  --dry-run 显示恢复计划但不执行
34
34
  --verbose 显示详细信息
35
35
 
36
36
  阶段说明:
37
37
  init - 初始化阶段
38
- prd - PRD生成阶段
39
- epic - Epic规划阶段
38
+ spec - 规格与任务规划阶段
40
39
  dev - 开发执行阶段
41
- quality - 质量验证阶段
40
+ verify - 质量验证阶段
42
41
  release - 发布管理阶段
43
42
 
44
43
  示例:
45
44
  $0 REQ-123 # 自动检测并恢复
46
45
  $0 REQ-123 --from dev # 从开发阶段重新开始
47
46
  $0 REQ-123 --dry-run # 预览恢复计划
48
- $0 REQ-123 --from prd --force # 强制从PRD阶段重新开始
47
+ $0 REQ-123 --from spec --force # 强制从规划阶段重新开始
49
48
 
50
49
  EOF
51
50
  exit 0
@@ -127,14 +126,14 @@ detect_workflow_status() {
127
126
  # 检查需求目录是否存在
128
127
  if [[ ! -d "$REQ_DIR" ]]; then
129
128
  echo -e "${RED}错误: 需求目录不存在: $REQ_DIR${NC}"
130
- echo -e "${YELLOW}建议: 使用 /flow-init 初始化需求${NC}"
129
+ echo -e "${YELLOW}建议: 使用 /flow:init 初始化需求${NC}"
131
130
  exit 1
132
131
  fi
133
132
 
134
133
  # 检查状态文件
135
134
  if [[ ! -f "$STATUS_FILE" ]]; then
136
135
  echo -e "${YELLOW}警告: 状态文件不存在,需求可能未正确初始化${NC}"
137
- echo -e "${YELLOW}建议: 使用 /flow-init --force 重新初始化${NC}"
136
+ echo -e "${YELLOW}建议: 使用 /flow:init --force 重新初始化${NC}"
138
137
  exit 1
139
138
  fi
140
139
 
@@ -213,29 +212,21 @@ analyze_recovery_strategy() {
213
212
  if [[ -n "$FROM_STAGE" ]]; then
214
213
  echo -e "${YELLOW}用户指定从阶段恢复: $FROM_STAGE${NC}"
215
214
  validate_stage "$FROM_STAGE"
216
- echo "$FROM_STAGE"
215
+ echo "$(normalize_stage "$FROM_STAGE")"
217
216
  return 0
218
217
  fi
219
218
 
220
219
  # 根据当前阶段智能判断恢复点
221
220
  case "$current_phase" in
222
- initialized|planning)
223
- echo -e "${CYAN}建议: 从 PRD 阶段开始${NC}"
224
- echo "prd"
221
+ initialized|context_packed|planning|planned|spec_in_progress)
222
+ echo -e "${CYAN}建议: 从规格阶段开始${NC}"
223
+ echo "spec"
225
224
  ;;
226
- prd_generation_in_progress)
227
- echo -e "${CYAN}建议: 重新生成 PRD${NC}"
228
- echo "prd"
229
- ;;
230
- prd_complete|epic_planning)
231
- echo -e "${CYAN}建议: 从 Epic 阶段开始${NC}"
232
- echo "epic"
233
- ;;
234
- epic_complete)
225
+ prd_generation_in_progress|epic_planning|prd_complete|epic_complete|spec_complete)
235
226
  echo -e "${CYAN}建议: 从开发阶段开始${NC}"
236
227
  echo "dev"
237
228
  ;;
238
- development|dev_complete)
229
+ development|development_in_progress|dev_complete|development_complete)
239
230
  # 检查是否有未完成的任务
240
231
  if [[ -f "$REQ_DIR/TASKS.md" ]]; then
241
232
  # 统计已完成任务 (- [x] 标记)
@@ -252,16 +243,20 @@ analyze_recovery_strategy() {
252
243
  echo "dev"
253
244
  else
254
245
  echo -e "${CYAN}建议: 进入质量验证阶段${NC}"
255
- echo "quality"
246
+ echo "verify"
256
247
  fi
257
248
  else
258
249
  echo -e "${CYAN}建议: 从开发阶段开始${NC}"
259
250
  echo "dev"
260
251
  fi
261
252
  ;;
262
- quality|quality_complete|qa|qa_complete)
253
+ quality|qa|verification_in_progress)
263
254
  echo -e "${CYAN}建议: 从质量验证阶段开始${NC}"
264
- echo "quality"
255
+ echo "verify"
256
+ ;;
257
+ quality_complete|qa_complete|verified)
258
+ echo -e "${CYAN}建议: 从发布阶段开始${NC}"
259
+ echo "release"
265
260
  ;;
266
261
  release|release_complete)
267
262
  echo -e "${CYAN}建议: 从发布阶段开始${NC}"
@@ -273,8 +268,8 @@ analyze_recovery_strategy() {
273
268
  exit 0
274
269
  ;;
275
270
  *)
276
- echo -e "${YELLOW}警告: 未知阶段 '$current_phase',从 PRD 开始${NC}"
277
- echo "prd"
271
+ echo -e "${YELLOW}警告: 未知阶段 '$current_phase',从规格阶段开始${NC}"
272
+ echo "spec"
278
273
  ;;
279
274
  esac
280
275
  }
@@ -284,17 +279,33 @@ validate_stage() {
284
279
  local stage="$1"
285
280
 
286
281
  case "$stage" in
287
- init|prd|epic|dev|quality|qa|release)
282
+ init|spec|dev|verify|release|prd|epic|quality|qa)
288
283
  return 0
289
284
  ;;
290
285
  *)
291
286
  echo -e "${RED}错误: 无效的阶段 '$stage'${NC}"
292
- echo -e "${YELLOW}有效阶段: init, prd, epic, dev, quality, release (qa 兼容)${NC}"
287
+ echo -e "${YELLOW}有效阶段: init, spec, dev, verify, release (prd/epic/quality/qa 兼容)${NC}"
293
288
  exit 1
294
289
  ;;
295
290
  esac
296
291
  }
297
292
 
293
+ # 兼容历史阶段名称,统一映射到主链阶段
294
+ normalize_stage() {
295
+ local stage="$1"
296
+ case "$stage" in
297
+ prd|epic)
298
+ echo "spec"
299
+ ;;
300
+ quality|qa)
301
+ echo "verify"
302
+ ;;
303
+ *)
304
+ echo "$stage"
305
+ ;;
306
+ esac
307
+ }
308
+
298
309
  # ============================================================================
299
310
  # 恢复执行
300
311
  # ============================================================================
@@ -315,19 +326,16 @@ generate_recovery_plan() {
315
326
  local stages=()
316
327
  case "$start_stage" in
317
328
  init)
318
- stages=("init" "prd" "epic" "dev" "quality" "release")
329
+ stages=("init" "spec" "dev" "verify" "release")
319
330
  ;;
320
- prd)
321
- stages=("prd" "epic" "dev" "quality" "release")
322
- ;;
323
- epic)
324
- stages=("epic" "dev" "quality" "release")
331
+ spec)
332
+ stages=("spec" "dev" "verify" "release")
325
333
  ;;
326
334
  dev)
327
- stages=("dev" "quality" "release")
335
+ stages=("dev" "verify" "release")
328
336
  ;;
329
- quality|qa)
330
- stages=("quality" "release")
337
+ verify)
338
+ stages=("verify" "release")
331
339
  ;;
332
340
  release)
333
341
  stages=("release")
@@ -340,22 +348,19 @@ generate_recovery_plan() {
340
348
  local command=""
341
349
  case "$stage" in
342
350
  init)
343
- command="/flow-init \"$REQ_ID\""
344
- ;;
345
- prd)
346
- command="/flow-prd \"$REQ_ID\""
351
+ command="/flow:init \"$REQ_ID\""
347
352
  ;;
348
- epic)
349
- command="/flow-epic \"$REQ_ID\""
353
+ spec)
354
+ command="/flow:spec \"$REQ_ID\""
350
355
  ;;
351
356
  dev)
352
- command="/flow-dev \"$REQ_ID\" --resume"
357
+ command="/flow:dev \"$REQ_ID\" --resume"
353
358
  ;;
354
- quality)
355
- command="/flow-quality \"$REQ_ID\""
359
+ verify)
360
+ command="/flow:verify \"$REQ_ID\" --strict"
356
361
  ;;
357
362
  release)
358
- command="/flow-release \"$REQ_ID\""
363
+ command="/flow:release \"$REQ_ID\""
359
364
  ;;
360
365
  esac
361
366
 
@@ -387,43 +392,35 @@ execute_recovery() {
387
392
  fi
388
393
 
389
394
  # 根据起始阶段执行命令
390
- # 注意: 这里只是展示命令,实际执行由用户手动调用或使用 /flow-restart
395
+ # 注意: 这里只是展示命令,实际执行由用户手动调用或使用 /flow:restart
391
396
  echo -e "${CYAN}请手动执行以下命令以恢复工作流:${NC}"
392
397
  echo ""
393
398
 
394
399
  case "$start_stage" in
395
400
  init)
396
- echo "/flow-init \"$REQ_ID\""
397
- echo "/flow-prd \"$REQ_ID\""
398
- echo "/flow-epic \"$REQ_ID\""
399
- echo "/flow-dev \"$REQ_ID\""
400
- echo "/flow-quality \"$REQ_ID\""
401
- echo "/flow-release \"$REQ_ID\""
401
+ echo "/flow:init \"$REQ_ID\""
402
+ echo "/flow:spec \"$REQ_ID\""
403
+ echo "/flow:dev \"$REQ_ID\""
404
+ echo "/flow:verify \"$REQ_ID\" --strict"
405
+ echo "/flow:release \"$REQ_ID\""
402
406
  ;;
403
- prd)
404
- echo "/flow-prd \"$REQ_ID\""
405
- echo "/flow-epic \"$REQ_ID\""
406
- echo "/flow-dev \"$REQ_ID\""
407
- echo "/flow-quality \"$REQ_ID\""
408
- echo "/flow-release \"$REQ_ID\""
409
- ;;
410
- epic)
411
- echo "/flow-epic \"$REQ_ID\""
412
- echo "/flow-dev \"$REQ_ID\""
413
- echo "/flow-quality \"$REQ_ID\""
414
- echo "/flow-release \"$REQ_ID\""
407
+ spec)
408
+ echo "/flow:spec \"$REQ_ID\""
409
+ echo "/flow:dev \"$REQ_ID\""
410
+ echo "/flow:verify \"$REQ_ID\" --strict"
411
+ echo "/flow:release \"$REQ_ID\""
415
412
  ;;
416
413
  dev)
417
- echo "/flow-dev \"$REQ_ID\" --resume"
418
- echo "/flow-quality \"$REQ_ID\""
419
- echo "/flow-release \"$REQ_ID\""
414
+ echo "/flow:dev \"$REQ_ID\" --resume"
415
+ echo "/flow:verify \"$REQ_ID\" --strict"
416
+ echo "/flow:release \"$REQ_ID\""
420
417
  ;;
421
- quality|qa)
422
- echo "/flow-quality \"$REQ_ID\""
423
- echo "/flow-release \"$REQ_ID\""
418
+ verify)
419
+ echo "/flow:verify \"$REQ_ID\" --strict"
420
+ echo "/flow:release \"$REQ_ID\""
424
421
  ;;
425
422
  release)
426
- echo "/flow-release \"$REQ_ID\""
423
+ echo "/flow:release \"$REQ_ID\""
427
424
  ;;
428
425
  esac
429
426
 
@@ -25,7 +25,7 @@ Usage: run-quality-gates.sh <phase> [--json] [--verbose]
25
25
  Execute quality gate verification commands for a phase.
26
26
 
27
27
  Arguments:
28
- phase Phase name (flow-dev, flow-review, flow-quality, flow-qa, flow-release)
28
+ phase Phase name (flow-dev, flow-review, flow-quality, flow-release)
29
29
 
30
30
  Options:
31
31
  --json Output results as JSON
@@ -78,7 +78,7 @@ validate_req_id "$REQ_ID" || exit 1
78
78
  # Ensure the requirement directory exists
79
79
  if [[ ! -d "$REQ_DIR" ]]; then
80
80
  echo "ERROR: Requirement directory not found: $REQ_DIR" >&2
81
- echo "Run /flow-init first to create the requirement structure." >&2
81
+ echo "Run /flow:init first to create the requirement structure." >&2
82
82
  exit 1
83
83
  fi
84
84
 
@@ -170,4 +170,4 @@ else
170
170
  echo "PRD_FILE: $PRD_FILE"
171
171
  echo "EPIC_FILE: $EPIC_FILE"
172
172
  echo "TASKS_FILE: $TASKS_FILE"
173
- fi
173
+ fi
@@ -91,14 +91,14 @@ fi
91
91
  REQ_DIR="devflow/requirements/${REQ_ID}"
92
92
  if [[ ! -d "$REQ_DIR" ]]; then
93
93
  echo "❌ Error: Requirement directory not found: $REQ_DIR" >&2
94
- echo " Run /flow-init first to create the requirement structure" >&2
94
+ echo " Run /flow:init first to create the requirement structure" >&2
95
95
  exit 1
96
96
  fi
97
97
 
98
98
  # Check if TASKS.md exists
99
99
  if [[ ! -f "${REQ_DIR}/TASKS.md" ]]; then
100
100
  echo "❌ Error: TASKS.md not found in $REQ_DIR" >&2
101
- echo " Run /flow-epic first to generate tasks" >&2
101
+ echo " Run /flow:spec first to generate tasks" >&2
102
102
  exit 1
103
103
  fi
104
104
 
@@ -303,7 +303,7 @@ main() {
303
303
  echo "════════════════════════════════════════════════════════════════════════"
304
304
  if [[ $total_errors -eq 0 ]]; then
305
305
  echo "✅ ALL VALIDATIONS PASSED"
306
- echo "research.md is ready for /flow-prd"
306
+ echo "research.md is ready for /flow:spec"
307
307
  echo "════════════════════════════════════════════════════════════════════════"
308
308
  return 0
309
309
  else
@@ -31,7 +31,7 @@ require_file() {
31
31
  require_dir "$CLAUDE_DIR/commands"
32
32
  require_dir "$CLAUDE_DIR/skills"
33
33
  require_dir "$CLAUDE_DIR/scripts"
34
- require_file "$CLAUDE_DIR/commands/flow-new.md"
34
+ require_file "$CLAUDE_DIR/commands/flow/new.md"
35
35
  require_file "$CLAUDE_DIR/skills/cc-devflow-orchestrator/SKILL.md"
36
36
 
37
37
  echo "cc-devflow setup OK."