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
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flow-init
3
- description: 'Initialize requirement structure with brainstorming and research. Usage: /flow-init "REQ-123|Title|URLs". Creates BRAINSTORM.md (north star) and research artifacts.'
3
+ description: 'Initialize a requirement with harness state and context package. Use when starting a new REQ/BUG and preparing deterministic execution context for the next stages.'
4
4
  ---
5
5
 
6
6
  # Flow-Init Skill
@@ -9,210 +9,47 @@ description: 'Initialize requirement structure with brainstorming and research.
9
9
 
10
10
  ## Purpose
11
11
 
12
- 初始化需求结构,包含头脑风暴和研究阶段。生成 BRAINSTORM.md 作为需求的「北极星」。
12
+ 初始化需求目录的 harness 运行状态,并生成可执行上下文包。
13
13
 
14
14
  ## Input Format
15
15
 
16
- ```
17
- /flow-init "REQ_ID|TITLE|PLAN_URLS?"
18
- /flow-init "REQ_ID|TITLE" --branch-only
19
- /flow-init --interactive
20
- ```
21
-
22
- - **REQ_ID**: `^(REQ|BUG)-[0-9]+$`
23
- - **TITLE**: 需求简短标题
24
- - **PLAN_URLS**: 计划文档URL (可选,逗号分隔)
25
- - **--branch-only**: 使用传统分支模式 (不创建 worktree)
26
-
27
- ## Execution Flow
28
-
29
- ### Stage 1: Entry Gate
30
-
31
- 1. **参数解析**
32
- - 验证 REQ_ID 格式
33
- - 提取 TITLE 和 PLAN_URLS
34
- - 若 TITLE 含中文,意译生成 BRANCH_TITLE_EN
35
-
36
- 2. **前置检查**
37
- ```bash
38
- bash scripts/check-prerequisites.sh --json --paths-only
39
- ```
40
- - Git 状态干净
41
- - devflow/ 目录存在
42
-
43
- 3. **唯一性检查**
44
- - `devflow/requirements/${REQ_ID}/` 不存在
45
-
46
- ### Stage 1.2: Git Worktree (Default) or Branch
47
-
48
- **Worktree 模式 (默认)**:
49
- ```bash
50
- # 计算路径
51
- REPO_NAME=$(basename $(git rev-parse --show-toplevel))
52
- WORKTREE_DIR="../${REPO_NAME}-${REQ_ID}"
53
-
54
- # 分支前缀按类型决定
55
- if [[ "${REQ_ID}" =~ ^BUG- ]]; then
56
- BRANCH_PREFIX="bugfix"
57
- else
58
- BRANCH_PREFIX="feature"
59
- fi
60
- BRANCH_NAME="${BRANCH_PREFIX}/${REQ_ID}-${slug(BRANCH_TITLE_EN)}"
61
-
62
- # 创建 worktree + 分支
63
- git worktree add -b "$BRANCH_NAME" "$WORKTREE_DIR"
64
-
65
- # 切换到 worktree
66
- cd "$WORKTREE_DIR"
67
- ```
68
-
69
- **分支模式 (--branch-only)**:
70
16
  ```bash
71
- # Requirements
72
- git checkout -b feature/${REQ_ID}-${slug(BRANCH_TITLE_EN)}
73
-
74
- # Bug Fixes
75
- git checkout -b bugfix/${BUG_ID}-${slug(BRANCH_TITLE_EN)}
17
+ /flow:init "REQ_ID|TITLE|PLAN_URLS?"
76
18
  ```
77
19
 
78
- ### Stage 1.5: Context Loading
20
+ - `REQ_ID`: `REQ-123` `BUG-123`
21
+ - `TITLE`: 需求标题
22
+ - `PLAN_URLS`: 可选,逗号分隔
79
23
 
80
- 检查并加载 (如存在):
81
- - `devflow/ROADMAP.md`
82
- - `devflow/ARCHITECTURE.md`
24
+ ## Execution Steps
83
25
 
84
- ### Stage 2: Directory Init
26
+ 1. 解析输入,提取 `REQ_ID`、`TITLE`、`PLAN_URLS`。
27
+ 2. 组装 goal 文本:
28
+ - `Deliver <REQ_ID>: <TITLE>`
29
+ - 若有 URL,追加 `Sources: <URLS>`。
30
+ 3. 运行初始化:
85
31
 
86
32
  ```bash
87
- bash scripts/create-requirement.sh "${REQ_ID}" --title "${TITLE}"
33
+ npm run harness:init -- --change-id "${REQ_ID}" --goal "${GOAL}"
88
34
  ```
89
35
 
90
- 生成:
91
- - `devflow/requirements/${REQ_ID}/README.md`
92
- - `devflow/requirements/${REQ_ID}/EXECUTION_LOG.md`
93
- - `devflow/requirements/${REQ_ID}/orchestration_status.json`
94
- - `devflow/requirements/${REQ_ID}/research/`
95
-
96
- ### Stage 2.3: Brainstorming (MANDATORY)
97
-
98
- **Iron Law**: `NO FLOW EXECUTION WITHOUT BRAINSTORM ALIGNMENT`
99
-
100
- 触发 `flow-brainstorming` skill,执行:
101
-
102
- 1. **Understanding** - 一次问一个问题
103
- 2. **Exploring** - 提出 2-3 种方案
104
- 3. **Presenting** - 分段呈现设计
105
- 4. **Documentation** - 输出 BRAINSTORM.md
106
-
107
- **输出**: `devflow/requirements/${REQ_ID}/BRAINSTORM.md`
108
-
109
- **验证**:
110
- - [ ] BRAINSTORM.md 存在
111
- - [ ] 包含「原始需求」章节
112
- - [ ] 包含「成功标准」章节
113
- - [ ] 包含「方案探索」章节
114
- - [ ] 包含「最终决策」章节
115
-
116
- ### Stage 2.5: Research (Subagent)
117
-
118
- 调用 `flow-researcher` subagent:
119
-
120
- ```json
121
- {
122
- "reqId": "${REQ_ID}",
123
- "reqDir": "devflow/requirements/${REQ_ID}",
124
- "title": "${TITLE}",
125
- "planUrls": ["..."],
126
- "contextFiles": {
127
- "brainstorm": "devflow/requirements/${REQ_ID}/BRAINSTORM.md"
128
- }
129
- }
130
- ```
131
-
132
- **输出**:
133
- - `research/internal/codebase-overview.md`
134
- - `research/mcp/YYYYMMDD/**`
135
- - `research/research-summary.md`
136
- - `research/tasks.json`
137
- - `research/research.md`
138
-
139
- ### Stage 3: README Generation
140
-
141
- 生成 `devflow/requirements/${REQ_ID}/README.md`
142
-
143
- ### Stage 4: Exit Gate (5-Level)
36
+ 4. 运行上下文打包:
144
37
 
145
38
  ```bash
146
- # Level 2: Structure validation
147
- bash scripts/validate-research.sh "${REQ_DIR}" --strict
148
- ```
149
-
150
- **验证**:
151
- 1. File Existence
152
- 2. Research.md Structure
153
- 3. Content Quality (无 TODO/PLACEHOLDER)
154
- 4. Tasks.json Validation
155
- 5. Git & Status & Constitution
156
-
157
- ## Output Artifacts
158
-
159
- ```
160
- devflow/requirements/${REQ_ID}/
161
- ├── README.md
162
- ├── BRAINSTORM.md # 北极星
163
- ├── research/
164
- │ ├── internal/
165
- │ │ └── codebase-overview.md
166
- │ ├── mcp/YYYYMMDD/
167
- │ ├── research.md
168
- │ ├── research-summary.md
169
- │ └── tasks.json
170
- ├── EXECUTION_LOG.md
171
- └── orchestration_status.json
39
+ npm run harness:pack -- --change-id "${REQ_ID}" --goal "${GOAL}"
172
40
  ```
173
41
 
174
- ## Scripts Reference
42
+ 5. 验证输出文件:
43
+ - `devflow/requirements/${REQ_ID}/harness-state.json`
44
+ - `devflow/requirements/${REQ_ID}/context-package.md`
175
45
 
176
- | Script | Purpose |
177
- |--------|---------|
178
- | `scripts/check-prerequisites.sh` | 前置条件检查 |
179
- | `scripts/create-requirement.sh` | 创建目录结构 |
180
- | `scripts/generate-research-tasks.sh` | 生成研究任务 |
181
- | `scripts/populate-research-tasks.sh` | 填充任务内容 |
182
- | `scripts/consolidate-research.sh` | 整合研究结果 |
183
- | `scripts/validate-research.sh` | 验证研究质量 |
46
+ ## Exit Criteria
184
47
 
185
- ## Templates Reference
186
-
187
- | Template | Purpose |
188
- |----------|---------|
189
- | `assets/INIT_FLOW_TEMPLATE.md` | 详细执行流程 |
190
- | `assets/RESEARCH_TEMPLATE.md` | 研究文档格式 |
191
- | `assets/BRAINSTORM_TEMPLATE.md` | 头脑风暴模板 |
192
-
193
- ## Agent Reference
194
-
195
- | Agent | Purpose |
196
- |-------|---------|
197
- | `references/flow-researcher.md` | 研究 subagent 指令 |
198
-
199
- ## Error Handling
200
-
201
- | Error | Solution |
202
- |-------|----------|
203
- | Invalid REQ_ID | 检查格式 `^(REQ\|BUG)-[0-9]+$` |
204
- | REQ_ID exists | 使用不同 ID 或 --force |
205
- | Git not clean | commit/stash changes |
206
- | Research validation failed | 手动补充 research.md |
48
+ - `harness-state.json.status == "initialized"`
49
+ - `context-package.md` 存在并包含 Next Commands 段落
207
50
 
208
51
  ## Next Step
209
52
 
53
+ ```bash
54
+ /flow:spec "${REQ_ID}"
210
55
  ```
211
- /flow-prd "${REQ_ID}"
212
- ```
213
-
214
- ---
215
-
216
- **Related Skills**:
217
- - `flow-brainstorming` - 头脑风暴
218
- - `flow-prd` - PRD 生成
@@ -145,7 +145,7 @@ Generated: {GENERATED_AT}
145
145
  2. **Direct Editing**:
146
146
  - Copy this template to `research/research.md`
147
147
  - Fill in decisions based on your research
148
- - Run validation script before proceeding to /flow-prd
148
+ - Run validation script before proceeding to /flow:spec
149
149
 
150
150
  ---
151
151
 
@@ -1,5 +1,5 @@
1
- {"file": ".claude/rules/project-constitution.md", "reason": "Quality rules and constraints"}
2
1
  {"file": "devflow/ROADMAP.md", "reason": "Project roadmap context", "optional": true}
3
2
  {"file": "devflow/ARCHITECTURE.md", "reason": "Architecture context", "optional": true}
4
- {"file": "devflow/spec/frontend/index.md", "reason": "Frontend conventions", "optional": true}
5
- {"file": "devflow/spec/backend/index.md", "reason": "Backend conventions", "optional": true}
3
+ {"file": "devflow/requirements/{REQ}/harness-state.json", "reason": "Existing harness state", "optional": true}
4
+ {"file": "devflow/requirements/{REQ}/context-package.md", "reason": "Existing context package", "optional": true}
5
+ {"file": ".claude/rules/project-constitution.md", "reason": "Quality rules and constraints"}
@@ -134,7 +134,7 @@ fi
134
134
  # Validate required directories and files
135
135
  if [[ ! -d "$REQ_DIR" ]]; then
136
136
  echo "ERROR: Requirement directory not found: $REQ_DIR" >&2
137
- echo "Run /flow-new first to create the requirement structure." >&2
137
+ echo "Run /flow:init first to create the requirement structure." >&2
138
138
  exit 1
139
139
  fi
140
140
 
@@ -12,23 +12,18 @@
12
12
  # Optional if --interactive mode is used
13
13
  #
14
14
  # OPTIONS:
15
- # --title TITLE Requirement title (docs; branch fallback)
16
- # --branch-title TITLE Branch title used for git branch naming (optional)
15
+ # --title TITLE Requirement title
16
+ # --branch-title TITLE Branch title (deprecated, ignored)
17
17
  # --description DESC Brief description (optional)
18
- # --skip-git Skip git branch/worktree creation
19
- # --branch-only Use traditional branch mode (no worktree)
20
- # --worktree Use worktree mode (default)
18
+ # --skip-git Deprecated (git operations removed)
21
19
  # --interactive, -i Interactive mode (prompts for inputs)
22
20
  # --json Output in JSON format
23
21
  # --help, -h Show help message
24
22
  #
25
23
  # EXAMPLES:
26
- # # Create requirement with worktree (default)
24
+ # # Create requirement
27
25
  # ./create-requirement.sh REQ-123 --title "User authentication"
28
26
  #
29
- # # Create requirement with traditional branch
30
- # ./create-requirement.sh REQ-123 --title "User authentication" --branch-only
31
- #
32
27
  # # Interactive mode
33
28
  # ./create-requirement.sh --interactive
34
29
  #
@@ -66,18 +61,8 @@ while [[ $# -gt 0 ]]; do
66
61
  DESCRIPTION="$2"
67
62
  shift 2
68
63
  ;;
69
- --skip-git)
70
- SKIP_GIT=true
71
- shift
72
- ;;
73
- --branch-only)
74
- BRANCH_ONLY=true
75
- USE_WORKTREE=false
76
- shift
77
- ;;
78
- --worktree)
79
- USE_WORKTREE=true
80
- BRANCH_ONLY=false
64
+ --skip-git|--branch-only|--worktree)
65
+ # Deprecated: git operations removed from DevFlow
81
66
  shift
82
67
  ;;
83
68
  --interactive|-i)
@@ -103,12 +88,9 @@ ARGUMENTS:
103
88
  Optional if --interactive mode is used
104
89
 
105
90
  OPTIONS:
106
- --title TITLE Requirement title (docs; branch fallback)
107
- --branch-title TITLE Branch title used for git branch naming (optional)
91
+ --title TITLE Requirement title
92
+ --branch-title TITLE Deprecated (ignored)
108
93
  --description DESC Brief description (optional)
109
- --skip-git Skip git branch/worktree creation
110
- --branch-only Use traditional branch mode (no worktree)
111
- --worktree Use worktree mode (default)
112
94
  --interactive, -i Interactive mode (prompts for inputs)
113
95
  --json Output results in JSON format
114
96
  --auto-id Auto-select next available REQ-ID when missing or duplicated
@@ -142,15 +124,9 @@ STRUCTURE CREATED:
142
124
  ├── EXECUTION_LOG.md
143
125
  └── status.json
144
126
 
145
- GIT MODES:
146
- Worktree (default):
147
- - Creates: ../repo-name-REQ-XXX/
148
- - Branch: feature/REQ-XXX-title
149
- - Enables parallel development
150
-
151
- Branch (--branch-only):
152
- - Creates: feature/REQ-XXX-title branch
153
- - Traditional single-workspace mode
127
+ NOTE:
128
+ Git branch/worktree management is handled externally by the user.
129
+ DevFlow only creates the requirement directory structure.
154
130
 
155
131
  EOF
156
132
  exit 0
@@ -392,98 +368,16 @@ if [[ -n "$DESCRIPTION" ]]; then
392
368
  log_event "$REQ_ID" "Description: $DESCRIPTION"
393
369
  fi
394
370
 
395
- # Create git branch/worktree if requested and available
396
- GIT_BRANCH=""
397
- WORKTREE_DIR=""
398
- if ! $SKIP_GIT && has_git; then
399
- # Generate branch name from title
400
- if [[ -n "$BRANCH_TITLE" ]]; then
401
- BRANCH_SUFFIX=$(slugify "$BRANCH_TITLE")
402
- elif [[ -n "$TITLE" ]]; then
403
- BRANCH_SUFFIX=$(slugify "$TITLE")
404
- else
405
- BRANCH_SUFFIX="new-requirement"
406
- fi
407
- if [[ -z "$BRANCH_SUFFIX" ]]; then
408
- BRANCH_SUFFIX="new-requirement"
409
- fi
410
-
411
- # Determine branch prefix based on type
412
- if [[ "$REQ_TYPE" == "bug" ]]; then
413
- GIT_BRANCH="bugfix/$REQ_ID-$BRANCH_SUFFIX"
414
- else
415
- GIT_BRANCH="feature/$REQ_ID-$BRANCH_SUFFIX"
416
- fi
417
-
418
- # Check if branch already exists
419
- if git rev-parse --verify "$GIT_BRANCH" >/dev/null 2>&1; then
420
- if ! $JSON_MODE; then
421
- echo "WARNING: Git branch already exists: $GIT_BRANCH" >&2
422
- fi
423
- # Branch exists - check if we should use worktree mode
424
- if $USE_WORKTREE && ! $BRANCH_ONLY; then
425
- REPO_NAME=$(basename "$REPO_ROOT")
426
- WORKTREE_DIR="$(dirname "$REPO_ROOT")/${REPO_NAME}-${REQ_ID}"
427
- if [[ -d "$WORKTREE_DIR" ]]; then
428
- if ! $JSON_MODE; then
429
- echo "Worktree already exists at: $WORKTREE_DIR" >&2
430
- fi
431
- else
432
- # Create worktree with existing branch
433
- git worktree add "$WORKTREE_DIR" "$GIT_BRANCH" >/dev/null 2>&1
434
- log_event "$REQ_ID" "Created git worktree: $WORKTREE_DIR (existing branch: $GIT_BRANCH)"
435
- if ! $JSON_MODE; then
436
- echo "Created worktree at: $WORKTREE_DIR" >&2
437
- fi
438
- fi
439
- fi
440
- else
441
- # Branch doesn't exist - create it
442
- if $USE_WORKTREE && ! $BRANCH_ONLY; then
443
- # Worktree mode (default)
444
- REPO_NAME=$(basename "$REPO_ROOT")
445
- WORKTREE_DIR="$(dirname "$REPO_ROOT")/${REPO_NAME}-${REQ_ID}"
446
-
447
- if [[ -d "$WORKTREE_DIR" ]]; then
448
- if ! $JSON_MODE; then
449
- echo "WARNING: Worktree directory already exists: $WORKTREE_DIR" >&2
450
- echo "Skipping worktree creation." >&2
451
- fi
452
- else
453
- # Create worktree with new branch
454
- git worktree add -b "$GIT_BRANCH" "$WORKTREE_DIR" >/dev/null 2>&1
455
- log_event "$REQ_ID" "Created git worktree: $WORKTREE_DIR (branch: $GIT_BRANCH)"
456
-
457
- if ! $JSON_MODE; then
458
- echo "Created worktree at: $WORKTREE_DIR" >&2
459
- echo "Branch: $GIT_BRANCH" >&2
460
- fi
461
- fi
462
- else
463
- # Traditional branch mode
464
- git checkout -b "$GIT_BRANCH" >/dev/null 2>&1
465
- log_event "$REQ_ID" "Created git branch: $GIT_BRANCH"
466
-
467
- if ! $JSON_MODE; then
468
- echo "Created and checked out branch: $GIT_BRANCH" >&2
469
- fi
470
- fi
471
- fi
472
-
473
- # Set environment variable for non-branch-based workflows
474
- export DEVFLOW_REQ_ID="$REQ_ID"
475
- fi
371
+ # Set environment variable for REQ identification
372
+ export DEVFLOW_REQ_ID="$REQ_ID"
476
373
 
477
374
  # Output results
478
375
  if $JSON_MODE; then
479
- printf '{"req_id":"%s","req_type":"%s","req_dir":"%s","title":"%s","git_branch":"%s","worktree_dir":"%s","mode":"%s","created_at":"%s"}\n' \
376
+ printf '{"req_id":"%s","req_type":"%s","req_dir":"%s","title":"%s","created_at":"%s"}\n' \
480
377
  "$REQ_ID" \
481
378
  "$REQ_TYPE" \
482
379
  "$REQ_DIR" \
483
380
  "${TITLE:-""}" \
484
- "${GIT_BRANCH:-""}" \
485
- "${WORKTREE_DIR:-""}" \
486
- "$( $USE_WORKTREE && echo "worktree" || echo "branch" )" \
487
381
  "$(get_beijing_time_iso)"
488
382
  else
489
383
  echo ""
@@ -495,22 +389,9 @@ else
495
389
  if [[ -n "$TITLE" ]]; then
496
390
  echo "Title: $TITLE"
497
391
  fi
498
- if [[ -n "$GIT_BRANCH" ]]; then
499
- echo "Git Branch: $GIT_BRANCH"
500
- fi
501
- if [[ -n "$WORKTREE_DIR" ]]; then
502
- echo "Worktree: $WORKTREE_DIR"
503
- echo "Mode: worktree (parallel development enabled)"
504
- elif [[ -n "$GIT_BRANCH" ]]; then
505
- echo "Mode: branch (traditional)"
506
- fi
507
392
  echo ""
508
393
  echo "Next Steps:"
509
- if [[ -n "$WORKTREE_DIR" && -d "$WORKTREE_DIR" ]]; then
510
- echo " 1. cd $WORKTREE_DIR"
511
- echo " 2. claude # Start new Claude Code session"
512
- echo " 3. Continue with /flow-prd or /flow-spec"
513
- elif [[ "$REQ_TYPE" == "bug" ]]; then
394
+ if [[ "$REQ_TYPE" == "bug" ]]; then
514
395
  echo " 1. Run bug-analyzer agent to analyze the BUG"
515
396
  echo " 2. Run /flow-fix to start BUG fix workflow"
516
397
  echo " 3. Keep EXECUTION_LOG.md updated during fixes"
@@ -311,7 +311,7 @@ main() {
311
311
  echo "════════════════════════════════════════════════════════════════════════"
312
312
  if [[ $total_errors -eq 0 ]]; then
313
313
  echo "✅ ALL VALIDATIONS PASSED"
314
- echo "research.md is ready for /flow-prd"
314
+ echo "research.md is ready for /flow:spec"
315
315
  echo "════════════════════════════════════════════════════════════════════════"
316
316
  return 0
317
317
  else
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flow-release
3
- description: 'Create PR and manage release. Usage: /flow-release "REQ-123" or /flow-release'
3
+ description: 'Release a verified requirement and run runtime cleanup. Use only after flow-verify has passed.'
4
4
  ---
5
5
 
6
6
  # Flow-Release Skill
@@ -9,131 +9,41 @@ description: 'Create PR and manage release. Usage: /flow-release "REQ-123" or /f
9
9
 
10
10
  ## Purpose
11
11
 
12
- 创建 PR 并管理发布流程,包括 worktree 清理。
12
+ 在验证通过后生成发布说明并标记需求为 released,同时执行 runtime 清理。
13
13
 
14
14
  ## Input Format
15
15
 
16
- ```
17
- /flow-release "REQ_ID"
18
- /flow-release # Auto-detect
19
- ```
20
-
21
- ## Branch Completion Decision
22
-
23
- 参考 `flow-finishing-branch` Skill:
24
-
25
- | 选项 | 适用场景 | 命令 |
26
- |-----|---------|------|
27
- | A) Fast-forward | 小改动,单人开发 | `git merge --ff-only` |
28
- | B) Create PR | 需要记录,团队审查 | `gh pr create` |
29
- | C) Squash merge | 多提交合并为一 | `gh pr merge --squash` |
30
- | D) Cleanup only | 工作被废弃 | `git branch -D` |
31
-
32
- ## Merge Semantics
33
-
34
- - A) Fast-forward: 直接合并到 `main`
35
- - B) Create PR: 仅创建/更新 PR,不自动合并
36
- - C) Squash merge: 通过 PR squash 合并到 `main`
37
- - D) Cleanup only: 不合并,仅清理
38
-
39
- ## Entry Gate
40
-
41
- 1. **PRD.md, TECH_DESIGN.md, EPIC.md, TASKS.md** 存在
42
- 2. **TEST_REPORT.md, SECURITY_REPORT.md** Gate 均为 PASS
43
- 3. **Status**: `quality_complete`(兼容 `qa_complete`)或 `release_failed`
44
- 4. **Git**: 当前在 feature/bugfix 分支;若工作区不干净,必须先按 `.claude/commands/util/git-commit.md` 完成提交(Conventional Commits + 按同类变更拆分)再继续
45
-
46
- ## Execution Flow
47
-
48
- ### Stage 1: Context Preparation
49
-
50
- 收集元数据:
51
- - TITLE, branch, commits, changed files
52
- - coverage, security 状态
53
- - **Worktree 检测**: 判断是否在 worktree 中
54
-
55
- ### Stage 2: Release Manager Agent
56
-
57
- 调用 `release-manager` agent:
58
- - 生成 RELEASE_PLAN.md
59
- - 生成 PR 描述草稿
60
-
61
- ### Stage 3: Commit Gate (MANDATORY)
62
-
63
- - 检查 `git status --porcelain`
64
- - 若存在未提交变更,必须先执行 `/util/git-commit`(规则文件 `.claude/commands/util/git-commit.md`)
65
- - 提交完成后再次确认工作区干净,再进入 PR 创建
66
-
67
- ### Stage 4: PR Creation
68
-
69
- 使用 `gh` CLI:
70
- - 标题: `${REQ_ID}: ${TITLE}`
71
- - 正文: agent 输出
72
-
73
- ### Stage 5: Worktree/Branch Cleanup
74
-
75
- **Worktree 模式**:
76
16
  ```bash
77
- # 获取当前 worktree 信息
78
- CURRENT_WORKTREE=$(git rev-parse --show-toplevel)
79
- MAIN_REPO=$(get_main_repo_path)
80
- BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
81
-
82
- # 切换到主仓库
83
- cd "$MAIN_REPO"
17
+ /flow:release "REQ_ID" [--janitor-hours N]
18
+ ```
84
19
 
85
- # 合并 (PR 或 fast-forward)
86
- # ...
20
+ - `janitor-hours` 默认 `72`
87
21
 
88
- # 删除 worktree
89
- git worktree remove "$CURRENT_WORKTREE"
22
+ ## Execution Steps
90
23
 
91
- # 删除分支
92
- git branch -d "$BRANCH_NAME"
93
- ```
24
+ 1. 检查 `report-card.json`:
25
+ - `overall` 必须为 `pass`
26
+ 2. 运行发布:
94
27
 
95
- **分支模式**:
96
28
  ```bash
97
- # 切换到 main
98
- git checkout main
99
-
100
- # 合并
101
- git merge --ff-only "$BRANCH_NAME"
102
-
103
- # 删除分支
104
- git branch -d "$BRANCH_NAME"
29
+ npm run harness:release -- --change-id "${REQ_ID}"
105
30
  ```
106
31
 
107
- ### Stage 6: Exit Gate
108
-
109
- 1. RELEASE_PLAN.md 存在
110
- 2. PR 创建成功
111
- 3. Status: `release_complete`
112
- 4. Worktree 已清理 (如适用)
113
-
114
- ## Output
32
+ 3. 运行熵清理:
115
33
 
34
+ ```bash
35
+ npm run harness:janitor -- --hours ${HOURS}
116
36
  ```
117
- devflow/requirements/${REQ_ID}/
118
- ├── RELEASE_PLAN.md
119
- └── orchestration_status.json (release_complete)
120
-
121
- GitHub:
122
- └── PR created with link
123
37
 
124
- Cleanup:
125
- └── Worktree removed (if applicable)
126
- ```
38
+ 4. 验证输出:
39
+ - `devflow/requirements/${REQ_ID}/RELEASE_NOTE.md`
40
+ - `devflow/requirements/${REQ_ID}/harness-state.json` 中 `status == "released"`
127
41
 
128
- ## Worktree Cleanup Notes
42
+ ## Exit Criteria
129
43
 
130
- - 清理前确保所有更改已提交并推送
131
- - 如果 PR 未合并,worktree 保留
132
- - 使用 `--keep-worktree` 标志可跳过清理
133
- - 清理失败不阻塞发布流程
44
+ - 发布文件存在且状态为 released
45
+ - janitor 执行成功
134
46
 
135
47
  ## Next Step
136
48
 
137
- 1. 等待代码评审与 CI 通过
138
- 2. 合并后更新主分支标签
139
- 3. 可选: `/flow-verify` 复检
49
+ - 进入 PR / merge 流程(仓库策略处理)
@@ -1,7 +1,5 @@
1
- {"file": "devflow/requirements/{REQ}/PRD.md", "reason": "Product requirements"}
2
- {"file": "devflow/requirements/{REQ}/EPIC.md", "reason": "Epic overview"}
3
- {"file": "devflow/requirements/{REQ}/TASKS.md", "reason": "Task completion"}
4
- {"file": "devflow/requirements/{REQ}/TEST_REPORT.md", "reason": "Test results", "optional": true}
5
- {"file": "devflow/requirements/{REQ}/SECURITY_REPORT.md", "reason": "Security results", "optional": true}
6
- {"file": "devflow/requirements/{REQ}/quickstart.md", "reason": "Verification commands", "optional": true}
7
- {"file": ".claude/rules/project-constitution.md", "reason": "Quality rules"}
1
+ {"file": "devflow/requirements/{REQ}/report-card.json", "reason": "Gate results before release"}
2
+ {"file": "devflow/requirements/{REQ}/task-manifest.json", "reason": "Task completion summary"}
3
+ {"file": "devflow/requirements/{REQ}/harness-state.json", "reason": "Lifecycle status", "optional": true}
4
+ {"file": "devflow/requirements/{REQ}/RELEASE_NOTE.md", "reason": "Previous release note", "optional": true}
5
+ {"file": ".claude/rules/project-constitution.md", "reason": "Quality rules and constraints"}