@rpamis/comet 0.3.0 → 0.3.2

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 (46) hide show
  1. package/LICENSE +21 -21
  2. package/assets/manifest.json +2 -1
  3. package/assets/skills/comet/SKILL.md +42 -30
  4. package/assets/skills/comet/scripts/comet-env.sh +55 -0
  5. package/assets/skills/comet/scripts/comet-state.sh +25 -9
  6. package/assets/skills/comet/scripts/comet-yaml-validate.sh +1 -1
  7. package/assets/skills/comet-archive/SKILL.md +8 -4
  8. package/assets/skills/comet-build/SKILL.md +36 -44
  9. package/assets/skills/comet-design/SKILL.md +93 -23
  10. package/assets/skills/comet-hotfix/SKILL.md +40 -25
  11. package/assets/skills/comet-open/SKILL.md +37 -30
  12. package/assets/skills/comet-tweak/SKILL.md +35 -22
  13. package/assets/skills/comet-verify/SKILL.md +70 -49
  14. package/assets/skills-zh/comet/SKILL.md +22 -14
  15. package/assets/skills-zh/comet-archive/SKILL.md +6 -2
  16. package/assets/skills-zh/comet-build/SKILL.md +35 -43
  17. package/assets/skills-zh/comet-design/SKILL.md +29 -9
  18. package/assets/skills-zh/comet-hotfix/SKILL.md +39 -24
  19. package/assets/skills-zh/comet-open/SKILL.md +9 -4
  20. package/assets/skills-zh/comet-tweak/SKILL.md +21 -8
  21. package/assets/skills-zh/comet-verify/SKILL.md +36 -15
  22. package/bin/comet.js +3 -3
  23. package/dist/commands/update.js +1 -1
  24. package/dist/commands/update.js.map +1 -1
  25. package/dist/core/command-error.d.ts +4 -0
  26. package/dist/core/command-error.d.ts.map +1 -0
  27. package/dist/core/command-error.js +53 -0
  28. package/dist/core/command-error.js.map +1 -0
  29. package/dist/core/detect.d.ts.map +1 -1
  30. package/dist/core/detect.js +33 -4
  31. package/dist/core/detect.js.map +1 -1
  32. package/dist/core/openspec.d.ts.map +1 -1
  33. package/dist/core/openspec.js +52 -1
  34. package/dist/core/openspec.js.map +1 -1
  35. package/dist/core/platforms.d.ts.map +1 -1
  36. package/dist/core/platforms.js +14 -2
  37. package/dist/core/platforms.js.map +1 -1
  38. package/dist/core/skills.d.ts.map +1 -1
  39. package/dist/core/skills.js +58 -0
  40. package/dist/core/skills.js.map +1 -1
  41. package/dist/core/superpowers.d.ts +3 -2
  42. package/dist/core/superpowers.d.ts.map +1 -1
  43. package/dist/core/superpowers.js +75 -9
  44. package/dist/core/superpowers.js.map +1 -1
  45. package/package.json +1 -1
  46. package/scripts/postinstall.js +44 -44
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: comet-verify
3
- description: "Comet Phase 4: Verify and Complete. Invoke with /comet-verify. Verify implementation matches design, handle development branch."
3
+ description: "Comet Phase 4: Verify and Close. Invoke with /comet-verify. Verify implementation matches design, handle development branch."
4
4
  ---
5
5
 
6
- # Comet Phase 4: Verify and Complete (Verify)
6
+ # Comet Phase 4: Verify and Close (Verify)
7
7
 
8
8
  ## Prerequisites
9
9
 
10
- - Code has been committed (Phase 3 complete)
11
- - All tasks in tasks.md are complete
10
+ - Code committed (Phase 3 complete)
11
+ - All tasks.md tasks completed
12
12
 
13
13
  ## Steps
14
14
 
@@ -17,15 +17,18 @@ description: "Comet Phase 4: Verify and Complete. Invoke with /comet-verify. Ver
17
17
  Execute entry verification:
18
18
 
19
19
  ```bash
20
- COMET_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
21
- COMET_STATE="${COMET_STATE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-state.sh' -type f -print -quit 2>/dev/null)}"
22
- COMET_GUARD="${COMET_GUARD:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-guard.sh' -type f -print -quit 2>/dev/null)}"
20
+ COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
21
+ if [ -z "$COMET_ENV" ]; then
22
+ echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
23
+ return 1
24
+ fi
25
+ . "$COMET_ENV"
23
26
  bash "$COMET_STATE" check <change-name> verify
24
27
  ```
25
28
 
26
29
  Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
27
30
 
28
- ### 1. Change Scale Assessment
31
+ ### 1. Scale Assessment
29
32
 
30
33
  Execute scale assessment:
31
34
 
@@ -33,21 +36,22 @@ Execute scale assessment:
33
36
  bash "$COMET_STATE" scale <change-name>
34
37
  ```
35
38
 
36
- Script automatically counts tasks, delta specs, and changed files to determine whether to use light or full verification mode, and sets the verify_mode field.
39
+ The script automatically counts tasks, delta spec count, changed file count, determines light or full verification mode, and sets the verify_mode field.
37
40
 
38
- Before verification starts, inspect and handle uncommitted changes through `comet/reference/dirty-worktree.md`. Verify-specific handling:
41
+ Before verification begins, handle uncommitted changes through `comet/reference/dirty-worktree.md` protocol. Verify phase special handling:
39
42
 
40
- 1. If dirty diff belongs to the current change and involves implementation, tests, tasks, delta spec, or design doc changes, do not fix or commit directly in verify; record failure and return to build
41
- 2. If dirty diff is only a verify-phase artifact, such as a verification report draft or branch-handling record, continue in verify and record state
42
- 3. If dirty diff has implemented work but tasks.md is unchecked, treat it as stale build state; record failure and return to build so `/comet-build` verifies the implementation, checks off tasks, and commits
43
+ 1. If dirty diff belongs to current change and involves implementation, tests, tasks, delta spec, or design doc changes, do not fix or commit directly in verify phase; report failures and enter Step 1b verification failure decision blocking point
44
+ 2. If dirty diff is only verify phase artifacts (e.g., verification report draft, branch handling records), may continue and record state in verify phase
45
+ 3. If dirty diff shows implementation but tasks.md not checked, treat as build state lag; report failures and enter Step 1b, let user decide to roll back for fix or accept deviation
43
46
 
44
- Return to build:
47
+ Only after user chooses fix, allow rollback to build phase:
45
48
 
46
49
  ```bash
50
+ # Execute only after user confirms fix
47
51
  bash "$COMET_STATE" transition <change-name> verify-fail
48
52
  ```
49
53
 
50
- Note: if the build phase committed after each task, worktree diff can underestimate change size. In that case, read the plan header `base-ref` and re-check the full commit range:
54
+ Note: If every task in build phase was committed, the script's file count based on working tree diff may underestimate change scale. In this case, must read plan file header `base-ref` and verify with commit range:
51
55
 
52
56
  ```bash
53
57
  PLAN=$(bash "$COMET_STATE" get <change-name> plan)
@@ -55,27 +59,41 @@ BASE_REF=$(grep '^base-ref:' "$PLAN" 2>/dev/null | head -1 | sed 's/^base-ref: *
55
59
  git diff --stat "$BASE_REF"...HEAD
56
60
  ```
57
61
 
58
- If the commit range exceeds lightweight thresholds (> 5 files, cross-module coordination, or more than 1 delta spec capability), manually switch to full verification:
62
+ If commit range shows changes exceed lightweight threshold (> 4 files, cross-module coordination, or delta spec spans more than 1 capability), manually set to full verification:
59
63
 
60
64
  ```bash
61
65
  bash "$COMET_STATE" set <change-name> verify_mode full
62
66
  ```
63
67
 
68
+ ### 1b. Verification Failure Decision (Blocking Point)
69
+
70
+ When verification does not pass, must pause and wait for the user to decide fix or accept deviation. Must not automatically run `bash "$COMET_STATE" transition <change-name> verify-fail`, nor automatically invoke `/comet-build`.
71
+
72
+ When pausing, must list:
73
+ - Failed items
74
+ - Whether CRITICAL (build failure, test failure, security issues, core acceptance scenario failure)
75
+ - Recommended handling approach
76
+
77
+ After user selection, continue as follows:
78
+ - **Fix all**: Run `bash "$COMET_STATE" transition <change-name> verify-fail`, then invoke `/comet-build` to fix
79
+ - **Handle item by item**: CRITICAL failures must be fixed; non-CRITICAL failures may choose to accept deviation, but must record acceptance reason and impact scope in verification report. If any CRITICAL failure exists, skipping fix to accept all is not allowed
80
+
64
81
  ### 2a. Lightweight Verification (Small Changes)
65
82
 
66
- When scale assessment result is "small", skip `openspec-verify-change`, directly execute the following checks:
83
+ When scale assessment result is "small", skip `openspec-verify-change` and directly execute these checks:
67
84
 
68
- 1. All tasks in tasks.md completed `[x]`
69
- 2. Changed files consistent with tasks.md description (compare `git diff --stat` / `git diff --cached --stat` / `git diff --stat <base-ref>...HEAD` against task content)
70
- 3. Build passes (run project-appropriate build command, e.g., `npm run build`, `mvn compile`, `cargo build`)
85
+ 1. All tasks.md tasks completed `[x]`
86
+ 2. Changed files match tasks.md descriptions (`git diff --stat` / `git diff --cached --stat` / `git diff --stat <base-ref>...HEAD` compared against tasks content)
87
+ 3. Build passes (run project-specific build command, e.g., `npm run build`, `mvn compile`, `cargo build`, etc.)
71
88
  4. Related tests pass
72
- 5. No obvious security issues (no hardcoded secrets, no new unsafe operations)
89
+ 5. No obvious security issues (no hardcoded keys, no new unsafe operations)
73
90
 
74
- **Pass standard**: All 5 items OK, no CRITICAL issues.
91
+ **Pass criteria**: All 5 items OK, no CRITICAL issues.
75
92
 
76
- **When failing**: report failed items, record failure, move back to build, then invoke `/comet-build`.
93
+ **When not passing**: Report failures, enter Step 1b verification failure decision blocking point. Only after user confirms fix, execute the following command to record failure and roll back to build phase, then invoke `/comet-build` to fix:
77
94
 
78
95
  ```bash
96
+ # Execute only after user confirms fix
79
97
  bash "$COMET_STATE" transition <change-name> verify-fail
80
98
  ```
81
99
 
@@ -84,7 +102,7 @@ bash "$COMET_STATE" transition <change-name> verify-fail
84
102
  **Skipped items** (not checked in lightweight verification):
85
103
  - spec scenario coverage
86
104
  - design doc consistency deep comparison
87
- - code pattern consistency recommendations
105
+ - code pattern consistency suggestions
88
106
  - delta spec and design doc drift detection
89
107
 
90
108
  ### 2b. Full Verification (Large Changes)
@@ -94,49 +112,52 @@ When scale assessment result is "large":
94
112
  **Immediately execute:** Use the Skill tool to load the `openspec-verify-change` skill. Skipping this step is prohibited.
95
113
 
96
114
  After the skill loads, follow its guidance to verify. Check items:
97
- 1. All tasks in tasks.md completed (`[x]`)
98
- 2. Implementation matches design.md design decisions
99
- 3. Implementation matches brainstorming design document
100
- 4. All capability specification scenarios pass
101
- 5. proposal.md goals satisfied
102
- 6. No contradiction between delta spec and design doc (if Build phase had incremental spec modifications, check if design doc has corresponding records)
103
- 7. `docs/superpowers/specs/` associated design document can be located (file exists and relates to current change)
115
+ 1. All tasks.md tasks completed (`[x]`)
116
+ 2. Implementation matches `openspec/changes/<name>/design.md` high-level design decisions
117
+ 3. Implementation matches Design Doc (technical design documents under `docs/superpowers/specs/`)
118
+ 4. All capability spec scenarios pass
119
+ 5. proposal.md goals are satisfied
120
+ 6. No contradictions between delta spec and design doc (if Build phase had incremental spec modifications, check if design doc has corresponding records)
121
+ 7. Associated design documents under `docs/superpowers/specs/` are locatable (file exists and is related to current change)
104
122
 
105
- When verification fails: report missing items, record failure, move back to build, then invoke `/comet-build`.
123
+ When verification does not pass: report missing items, enter Step 1b verification failure decision blocking point. Only after user confirms fix, execute the following command to record failure and roll back to build phase, then invoke `/comet-build` to supplement:
106
124
 
107
125
  ```bash
126
+ # Execute only after user confirms fix
108
127
  bash "$COMET_STATE" transition <change-name> verify-fail
109
128
  ```
110
129
 
111
- **Spec drift handling**:
112
- - If check item 6 finds contradiction (delta spec has content but design doc doesn't reflect it), prompt user:
113
- - Option A: Append "Implementation Divergence" section to design doc recording deviation reason
114
- - Option B: Roll back to Build phase, supplement brainstorming to update design doc
115
- - Option C: Confirm deviation acceptable, continue verification (design doc will be marked as `superseded-by-main-spec` during archiving)
130
+ **Spec Drift Handling** (user decision point):
131
+ - If check item 6 finds contradictions (delta spec has content but design doc does not reflect it), **must pause and wait for user to choose handling method**; must not select automatically. Options:
132
+ - Option A: Append "Implementation Divergence" section to design doc recording deviation reason. Option A is a verify phase allowed artifact; after writing, must not re-trigger Step 1b dirty-worktree decision due to that design doc change
133
+ - Option B: After user selects B, run `bash "$COMET_STATE" transition <change-name> verify-fail`, then invoke `/comet-build`; `/comet-build`'s Spec Incremental Update rules will load `superpowers:brainstorming` to update Design Doc + delta spec
134
+ - Option C: Confirm deviation is acceptable, continue verification (design doc will be marked as `superseded-by-main-spec` during archiving)
116
135
 
117
- ### 3. Completion (Superpowers)
136
+ ### 3. Finishing (Superpowers)
118
137
 
119
138
  **Immediately execute:** Use the Skill tool to load the `superpowers:finishing-a-development-branch` skill. Skipping this step is prohibited.
120
139
 
121
140
  If `superpowers:finishing-a-development-branch` is unavailable, stop the process and prompt to install or enable Superpowers skills. Do not substitute this step with normal conversation.
122
141
 
123
- After the skill loads, follow its guidance to complete. Branch handling options:
124
- 1. Local merge to main branch
142
+ After the skill loads, follow its guidance to finish. Branch handling options:
143
+ 1. Merge to main branch locally
125
144
  2. Push and create PR
126
145
  3. Keep branch (handle later)
127
146
  4. Discard work
128
147
 
148
+ This is a user decision point. **Must pause and wait for user to choose branch handling method**. Must not select based on recommendations, defaults, or current branch status. Only after the user completes selection and the corresponding operation finishes, may `branch_status: handled` be written.
149
+
129
150
  **Confirmation items**:
130
151
  - All tests pass
131
- - No hardcoded secrets or security issues
152
+ - No hardcoded keys or security issues
132
153
 
133
154
  ### 4. Record Verification Evidence
134
155
 
135
- The verification report must be written to disk and recorded in `.comet.yaml`; branch handling must also be written to state after it completes. Do not manually set `verify_result: pass`; guard performs the transition.
156
+ Verification report must be saved to disk and recorded in `.comet.yaml`; after branch handling completes, state fields must also be written. Do not manually set `verify_result: pass`; use guard for auto-transition.
136
157
 
137
158
  ```bash
138
159
  mkdir -p docs/superpowers/reports
139
- # Write this verification result to a report file, for example:
160
+ # Write verification conclusions to report file, e.g.:
140
161
  # docs/superpowers/reports/YYYY-MM-DD-<change-name>-verify.md
141
162
 
142
163
  bash "$COMET_STATE" set <change-name> verification_report docs/superpowers/reports/YYYY-MM-DD-<change-name>-verify.md
@@ -147,20 +168,20 @@ bash "$COMET_STATE" set <change-name> branch_status handled
147
168
 
148
169
  - Verification report passed
149
170
  - Branch handled
150
- - `.comet.yaml` `verification_report` points to an existing verification report file
151
- - `.comet.yaml` has `branch_status: handled`
152
- - **Phase guard**: Run `bash "$COMET_GUARD" <change-name> verify --apply`; after all PASS, it uses `comet-state transition verify-pass` to advance to `phase: archive`
171
+ - `verification_report` in `.comet.yaml` points to an existing verification report file
172
+ - `branch_status: handled` in `.comet.yaml`
173
+ - **Phase guard**: Run `bash "$COMET_GUARD" <change-name> verify --apply`; after all PASS, auto-transitions to `phase: archive` through `comet-state transition verify-pass`
153
174
 
154
- After verification and branch handling are complete, run guard to auto-transition:
175
+ After both verification and branch handling are complete, run guard for auto-transition:
155
176
 
156
177
  ```bash
157
178
  bash "$COMET_GUARD" <change-name> verify --apply
158
179
  ```
159
180
 
160
- State file is automatically updated to `phase: archive`, `verify_result: pass`, `verified_at: YYYY-MM-DD`.
181
+ State file auto-updates to `phase: archive`, `verify_result: pass`, `verified_at: YYYY-MM-DD`.
161
182
 
162
183
  ## Automatic Transition
163
184
 
164
185
  After exit conditions are met, **proceed immediately to the next phase without waiting for user input**:
165
186
 
166
- > **REQUIRED NEXT SKILL:** Invoke `comet-archive` skill to enter the archiving phase.
187
+ > **REQUIRED NEXT SKILL:** Invoke `comet-archive` skill to enter the archive phase.
@@ -53,8 +53,8 @@ agent 做决策只需读本节,参考附录按需查阅。
53
53
  **断点恢复规则**:
54
54
  - 每次恢复上下文时,先重新执行 Step 0 和 Step 1,不依赖对话历史判断阶段
55
55
  - 只要存在 active change 且工作区有未提交改动,必须按 `comet/reference/dirty-worktree.md` 协议处理。该协议定义了检查步骤、归因分类和禁令,本文件不重复
56
- - 若 `phase: build`,读取 tasks.md 的下一个未勾选任务继续
57
- - 若 `phase: verify` 且 `verify_result: fail`,先运行 `bash "$COMET_STATE" transition <name> verify-fail`,再调用 `/comet-build`
56
+ - 若 `phase: build`,先检查 `build_mode` 和 `isolation` 是否已设置;若有未设置的字段,回到 `/comet-build` 对应步骤补充后再执行;若均已设置,读取 tasks.md 的下一个未勾选任务继续
57
+ - 若 `phase: verify` 且 `verify_result: fail`,进入验证失败决策阻塞点:暂停并询问用户修复或接受偏差;用户选择修复后才运行 `bash "$COMET_STATE" transition <name> verify-fail` 并调用 `/comet-build`
58
58
  - 若 `phase: open` 但 proposal/design/tasks 已完整,先运行 `bash "$COMET_GUARD" <change-name> open --apply` 修正状态,再继续判定
59
59
  - 若 `phase: archive`,只允许调用 `/comet-archive`;归档成功后 change 会移动到 archive 目录,不再对原活跃目录运行 guard
60
60
 
@@ -62,9 +62,9 @@ agent 做决策只需读本节,参考附录按需查阅。
62
62
 
63
63
  1. `archived: true` 或 change 已移入 archive → 流程已完成
64
64
  2. `verify_result: pass` 且 `archived` 不是 `true` → `/comet-archive`
65
- 3. `verify_result: fail` → `bash "$COMET_STATE" transition <name> verify-fail` `/comet-build`
65
+ 3. `verify_result: fail` → 进入验证失败决策阻塞点(暂停询问修复或接受偏差;用户选择修复后才 `verify-fail` `/comet-build`)
66
66
  4. `phase: verify` 或 tasks.md 全部勾选 → `/comet-verify`
67
- 5. `phase: build` 或已有 Design Doc 但计划/执行未完成 → `/comet-build`
67
+ 5. `phase: build` 或已有 Design Doc 但计划/执行未完成 → 优先按 workflow 路由:`hotfix` → `/comet-hotfix`,`tweak` → `/comet-tweak`,`full` → `/comet-build`
68
68
  6. `phase: design` 或有 change 但无 Design Doc → `/comet-design`
69
69
  7. `phase: open` 或有活跃 change 但 `.comet.yaml` 缺失 → `/comet-open`
70
70
  8. 无活跃 change → `/comet-open`
@@ -103,14 +103,17 @@ agent 做决策只需读本节,参考附录按需查阅。
103
103
 
104
104
  流转链:open → design → build → verify → archive
105
105
 
106
- **连续执行要求**:从检测到的阶段开始,agent 必须自动走完后续所有阶段,中间不停顿等待用户输入(除非遇到需要用户决策的节点)。每个阶段完成后立即进入下一阶段,无需用户再次输入。
106
+ **连续执行要求**:从检测到的阶段开始,agent 必须自动推进后续阶段;自动推进只适用于没有用户决策的衔接点。遇到用户决策点时必须暂停并等待用户明确回复,不得用推荐规则、默认值或历史偏好代替用户确认。
107
+
108
+ **决策点是阻塞点**:只要到达下列任一节点,当前 `/comet` 调用必须停住。用户明确选择后才能写入对应状态字段、执行对应操作,随后再继续自动流转。
107
109
 
108
110
  需要用户参与的节点(仅在这些节点暂停):
109
111
  1. brainstorming 确认设计方案
110
- 2. build 阶段选择执行方式
111
- 3. verify 不通过时决定修复或接受偏差
112
+ 2. build 阶段选择工作方式(隔离方式 + 执行方式,一次交互完成)
113
+ 3. verify 不通过时决定修复或接受偏差(含 Spec 漂移处理方式选择)
112
114
  4. finishing-branch 选择分支处理方式
113
115
  5. 遇到升级条件(hotfix/tweak → 完整流程)
116
+ 6. build 阶段范围扩张需重新设计或拆分新 change
114
117
 
115
118
  agent 不应跳过这些决策点;其他明确无歧义的阶段衔接必须自动继续推进,不得中途退出。
116
119
  </IMPORTANT>
@@ -137,11 +140,11 @@ agent 不应跳过这些决策点;其他明确无歧义的阶段衔接必须
137
140
 
138
141
  /comet-hotfix(预设路径,跳过 brainstorming)
139
142
  open ──→ build ──→ verify ──→ archive
140
- ↑ 如触发升级条件 → 补充 Design Doc → 回到完整流程
143
+ ↑ 如触发升级条件 → 阻塞确认升级 → 补充 Design Doc → 回到完整流程
141
144
 
142
145
  /comet-tweak(预设路径,跳过 brainstorming 和完整 plan)
143
146
  open ──→ lightweight build ──→ light verify ──→ archive
144
- ↑ 如触发升级条件 → 补充 Design Doc → 回到完整流程
147
+ ↑ 如触发升级条件 → 阻塞确认升级 → 补充 Design Doc → 回到完整流程
145
148
  ```
146
149
 
147
150
  ---
@@ -155,12 +158,14 @@ workflow: full
155
158
  phase: build
156
159
  design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
157
160
  plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
161
+ base_ref: a1b2c3d4e5f6...
158
162
  build_mode: subagent-driven-development
159
163
  isolation: branch
160
164
  verify_mode: light
161
165
  verify_result: pending
162
166
  verification_report: null
163
167
  branch_status: pending
168
+ created_at: 2026-05-26
164
169
  verified_at: null
165
170
  archived: false
166
171
  ```
@@ -171,12 +176,14 @@ archived: false
171
176
  | `phase` | 当前阶段:`open`、`design`、`build`、`verify`、`archive`(init 统一设为 `open`,guard 负责过渡) |
172
177
  | `design_doc` | 关联的 Superpowers Design Doc 路径,可为空 |
173
178
  | `plan` | 关联的 Superpowers Plan 路径,可为空 |
179
+ | `base_ref` | init 时记录的 git commit SHA,用于 scale 评估。无 plan 时作为改动文件数统计基准 |
174
180
  | `build_mode` | 已选择的执行方式,可为空 |
175
181
  | `isolation` | `branch` 或 `worktree`,工作区隔离方式。full 初始化可为 `null`,但只允许持续到 `/comet-build` Step 3 前;hotfix/tweak 默认 `branch` |
176
182
  | `verify_mode` | `light` 或 `full`,可为空 |
177
183
  | `verify_result` | `pending`、`pass` 或 `fail` |
178
184
  | `verification_report` | 验证报告文件路径,verify 通过前必须指向已存在文件 |
179
185
  | `branch_status` | `pending` 或 `handled`,分支处理完成后设为 `handled` |
186
+ | `created_at` | change 创建日期(init 时自动写入),格式 `YYYY-MM-DD` |
180
187
  | `verified_at` | 验证通过时间,可为空 |
181
188
  | `archived` | change 是否已归档 |
182
189
 
@@ -199,11 +206,12 @@ archived: false
199
206
  Comet 脚本随 skill 包分发在 `comet/scripts/` 下。**不硬编码路径** — 定位一次,缓存到环境变量:
200
207
 
201
208
  ```bash
202
- COMET_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
203
- COMET_GUARD="${COMET_GUARD:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-guard.sh' -type f -print -quit 2>/dev/null)}"
204
- COMET_STATE="${COMET_STATE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-state.sh' -type f -print -quit 2>/dev/null)}"
205
- COMET_HANDOFF="${COMET_HANDOFF:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-handoff.sh' -type f -print -quit 2>/dev/null)}"
206
- COMET_ARCHIVE="${COMET_ARCHIVE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-archive.sh' -type f -print -quit 2>/dev/null)}"
209
+ COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
210
+ if [ -z "$COMET_ENV" ]; then
211
+ echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
212
+ return 1
213
+ fi
214
+ . "$COMET_ENV"
207
215
 
208
216
  # 脚本定位失败时停止流程
209
217
  if [ -z "$COMET_GUARD" ] || [ -z "$COMET_STATE" ] || [ -z "$COMET_HANDOFF" ] || [ -z "$COMET_ARCHIVE" ]; then
@@ -18,8 +18,12 @@ description: "Comet 阶段 5:归档。用 /comet-archive 调用。同步 delta
18
18
  执行入口验证:
19
19
 
20
20
  ```bash
21
- COMET_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
22
- COMET_STATE="${COMET_STATE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-state.sh' -type f -print -quit 2>/dev/null)}"
21
+ COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
22
+ if [ -z "$COMET_ENV" ]; then
23
+ echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
24
+ return 1
25
+ fi
26
+ . "$COMET_ENV"
23
27
  bash "$COMET_STATE" check <name> archive
24
28
  ```
25
29
 
@@ -17,9 +17,12 @@ description: "Comet 阶段 3:计划与构建。用 /comet-build 调用。制
17
17
  执行入口验证:
18
18
 
19
19
  ```bash
20
- COMET_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
21
- COMET_STATE="${COMET_STATE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-state.sh' -type f -print -quit 2>/dev/null)}"
22
- COMET_GUARD="${COMET_GUARD:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-guard.sh' -type f -print -quit 2>/dev/null)}"
20
+ COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
21
+ if [ -z "$COMET_ENV" ]; then
22
+ echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
23
+ return 1
24
+ fi
25
+ . "$COMET_ENV"
23
26
  bash "$COMET_STATE" check <name> build
24
27
  ```
25
28
 
@@ -58,9 +61,11 @@ bash "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
58
61
 
59
62
  无需手动更新 phase,guard 会在退出条件满足后自动流转。
60
63
 
61
- ### 3. 工作区隔离
64
+ ### 3. 选择工作方式
62
65
 
63
- 计划已写入当前分支。在开始执行前,选择工作区隔离方式:
66
+ 计划已写入当前分支。在开始执行前,**一次性询问用户**选择工作区隔离方式和执行方式:
67
+
68
+ **工作区隔离**:
64
69
 
65
70
  | 选项 | 方式 | 说明 |
66
71
  |------|------|------|
@@ -71,52 +76,30 @@ bash "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
71
76
  - 变更涉及 ≤ 3 个文件 → 推荐 A
72
77
  - 需要并行开发、当前分支有未提交工作 → 推荐 B
73
78
 
74
- 用户选择后,更新 `isolation` 字段。`isolation` 只允许以下值之一:
75
-
76
- ```bash
77
- bash "$COMET_STATE" set <name> isolation <value>
78
- ```
79
-
80
- - `branch`
81
- - `worktree`
82
-
83
- <IMPORTANT>
84
- 这是脚本级硬约束,不是建议。full workflow 初始化时 `isolation` 可以暂时为 `null`,但只允许存在到本步骤之前。
85
- 进入实现前必须停下来询问用户并写入 `branch` 或 `worktree`。若保持 `null`,`build → verify` 的 guard 和 `comet-state transition build-complete` 都会失败。
86
- </IMPORTANT>
87
-
88
- **执行隔离**:
89
-
90
- - **branch**:执行 `git checkout -b <change-name>`,后续工作在新分支上进行
91
- - **worktree**:调用 `superpowers:using-git-worktrees` 技能或使用原生 `EnterWorktree` 工具创建隔离工作区
92
-
93
- 创建隔离后,确认计划文件可访问(分支方式天然可访问;worktree 方式需确认计划已提交)。
94
-
95
- ### 4. 选择执行方式
96
-
97
- 向用户展示计划摘要(任务数、涉及模块),然后询问执行方式:
79
+ **执行方式**:
98
80
 
99
81
  | 选项 | 技能 | 适用场景 |
100
82
  |------|------|---------|
101
83
  | A | `superpowers:subagent-driven-development` | 任务独立、复杂度高、需要双阶段审查 |
102
84
  | B | `superpowers:executing-plans` | 任务简单、无子agent环境、轻量快速 |
103
85
 
104
- **推荐规则**:
86
+ **执行方式推荐规则**:
105
87
  - 任务数 ≥ 3 → 推荐 A
106
88
  - 任务数 ≤ 2 且无跨模块依赖 → 推荐 B
107
89
  - 来自 hotfix 路径 → 推荐 B
108
90
 
109
- 用户选择后,更新 `build_mode` 字段。`build_mode` 只允许以下值之一:
91
+ 这是用户决策点。必须暂停并等待用户明确选择隔离方式和执行方式,**不得根据推荐规则自行选择 `branch` `worktree`**,也**不得根据推荐规则自行选择执行方式**。推荐规则只能用于说明建议,不能替代用户确认。
92
+
93
+ 用户选择后,更新 `isolation` 和 `build_mode` 字段:
110
94
 
111
95
  ```bash
112
- bash "$COMET_STATE" set <name> build_mode <value>
96
+ bash "$COMET_STATE" set <name> isolation <branch|worktree>
97
+ bash "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
113
98
  ```
114
99
 
115
- - `subagent-driven-development`
116
- - `executing-plans`
117
- - `direct`(默认仅 hotfix/tweak preset 使用)
100
+ `isolation` 是脚本级硬约束。full workflow 初始化时可以为 `null`,但只允许存在到本步骤之前。若保持 `null`,`build → verify` 的 guard 和 `comet-state transition build-complete` 都会失败。
118
101
 
119
- full workflow 不得默认使用 `direct`。只有用户明确要求跳过计划执行技能,且你已记录显式 override 时,才允许:
102
+ `build_mode` 默认仅 hotfix/tweak preset 使用 `direct`。full workflow 不得默认使用 `direct`。只有用户明确要求跳过计划执行技能,且你已记录显式 override 时,才允许:
120
103
 
121
104
  ```bash
122
105
  bash "$COMET_STATE" set <name> direct_override true
@@ -125,7 +108,14 @@ bash "$COMET_STATE" set <name> build_mode direct
125
108
 
126
109
  没有 `direct_override: true` 时,full workflow 的 `build_mode=direct` 会被 guard 和状态转换同时拦截。
127
110
 
128
- 然后,**立即执行:** 使用 Skill 工具加载对应技能。禁止跳过此步骤。
111
+ **执行隔离**:
112
+
113
+ - **branch**:执行 `git checkout -b <change-name>`,后续工作在新分支上进行
114
+ - **worktree**:必须使用 Skill 工具加载 `superpowers:using-git-worktrees` 技能创建隔离工作区。禁止用普通 shell 命令或原生工具绕过该技能;如该技能不可用,停止流程并提示安装或启用 Superpowers 技能。
115
+
116
+ 创建隔离后,确认计划文件可访问(分支方式天然可访问;worktree 方式需确认计划已提交)。
117
+
118
+ **加载执行技能**:使用 Skill 工具加载对应技能。禁止跳过此步骤。
129
119
 
130
120
  如所选 Superpowers 技能不可用,停止流程并提示安装或启用对应技能,不要用普通对话替代该步骤。
131
121
 
@@ -134,17 +124,19 @@ bash "$COMET_STATE" set <name> build_mode direct
134
124
  - 完成 tasks.md 勾选(`- [ ]` → `- [x]`)
135
125
  - 每个任务完成后提交代码
136
126
 
137
- ### 5. Spec 增量更新
127
+ ### 4. Spec 增量更新
138
128
 
139
129
  实施过程中发现初版 spec 不完整时,按变更规模分级处理:
140
130
 
141
131
  | 规模 | 触发条件 | 做法 |
142
132
  |------|---------|------|
143
133
  | 小 | 遗漏验收场景、边界条件 | 直接编辑 delta spec + design.md,追加 tasks.md 任务 |
144
- | 中 | 接口变更、新增组件、数据流变化 | 重新 `superpowers:brainstorming` 更新 Design Doc + delta spec |
145
- | 大 | 全新 capability 需求 | `/opsx:new` 创建独立 change |
134
+ | 中 | 接口变更、新增组件、数据流变化 | 暂停并等待用户确认后,必须使用 Skill 工具加载 `superpowers:brainstorming` 更新 Design Doc + delta spec |
135
+ | 大 | 全新 capability 需求 | 必须暂停并等待用户确认拆分;用户确认后,通过 `/comet-open` 创建独立 change |
136
+
137
+ **50% 阈值判定**:以 tasks.md 初始任务总数为基准,若新增任务数超过该总数的一半,视为超出原计划范围,必须暂停并等待用户决定是否拆分为新 change。
146
138
 
147
- **50% 阈值判定**:以 tasks.md 初始任务总数为基准,若新增任务数超过该总数的一半,视为超出原计划范围,应考虑拆分为新 change。
139
+ 创建独立 change 时必须调用 `/comet-open`,不得直接调用 `/opsx:new`。`/comet-open` 会同时创建 OpenSpec 产物和 `.comet.yaml`,避免新 change 脱离 Comet 状态机。
148
140
 
149
141
  **原则**:
150
142
  - delta spec 是活文档,本阶段期间随时可修改
@@ -152,14 +144,14 @@ bash "$COMET_STATE" set <name> build_mode direct
152
144
  - 不提前同步到 main spec,归档时统一同步
153
145
  - 小规模增量直接改 delta spec 时,应在 commit message 中注明,便于归档时判断 design doc 漂移
154
146
 
155
- ### 6. 上下文管理
147
+ ### 5. 上下文管理
156
148
 
157
149
  Build 是最长阶段,可能跨越大量任务。为支持上下文压缩后断点恢复:
158
150
 
159
151
  - **每完成一个 task**:立即勾选 tasks.md 并提交代码,确保 `.comet.yaml` 和文件状态持久化
160
152
  - **上下文压缩后恢复**:读取 `.comet.yaml` 的 `phase` 字段确认仍在 build 阶段,读取 plan 文件头的 `base-ref`,再读取 tasks.md 找到下一个未勾选任务继续执行
161
153
  - **用户手动修改恢复**:按 `comet/reference/dirty-worktree.md` 协议处理未提交改动。该协议定义了检查步骤、归因分类和禁令。build 阶段的特殊处理:
162
- 1. 归因后,若 diff 暗示计划或 spec 已变化,按 Step 5「Spec 增量更新」分级处理
154
+ 1. 归因后,若 diff 暗示计划或 spec 已变化,按 Step 4「Spec 增量更新」分级处理
163
155
  - **长任务拆分**:单任务超过 200 行代码变更时,考虑拆分为多个子任务分别提交
164
156
 
165
157
  ## 退出条件
@@ -17,10 +17,12 @@ description: "Comet 阶段 2:深度设计。用 /comet-design 调用。通过
17
17
  执行入口验证:
18
18
 
19
19
  ```bash
20
- COMET_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
21
- COMET_STATE="${COMET_STATE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-state.sh' -type f -print -quit 2>/dev/null)}"
22
- COMET_GUARD="${COMET_GUARD:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-guard.sh' -type f -print -quit 2>/dev/null)}"
23
- COMET_HANDOFF="${COMET_HANDOFF:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-handoff.sh' -type f -print -quit 2>/dev/null)}"
20
+ COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
21
+ if [ -z "$COMET_ENV" ]; then
22
+ echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
23
+ return 1
24
+ fi
25
+ . "$COMET_ENV"
24
26
  bash "$COMET_STATE" check <name> design
25
27
  ```
26
28
 
@@ -92,23 +94,41 @@ canonical_spec: openspec
92
94
 
93
95
  如 `superpowers:brainstorming` 不可用,停止流程并提示安装或启用 Superpowers 技能,不要用普通对话替代该步骤。
94
96
 
95
- 技能加载后,按其指引产出:
96
- - `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` — 设计文档(技术 RFC)
97
- - 如需补充验收场景,回写 `openspec/changes/<name>/specs/<capability>/spec.md` — OpenSpec delta 能力规格
97
+ 技能加载后,按其指引产出设计方案(以对话形式呈现):
98
+ - 技术方案:架构、数据流、关键技术选型与风险
99
+ - 测试策略
100
+ - 如需补充验收场景,标明将回写的 delta spec 变更
101
+
102
+ brainstorming 阶段不写入 Design Doc 文件,仅产出设计方案供 Step 1c 用户确认。确认后才创建 `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` 并回写 delta spec。
103
+
104
+ ### 1c. 用户确认设计方案(阻塞点)
105
+
106
+ brainstorming 产出设计方案后,**必须暂停并等待用户明确确认设计方案**。不得在用户确认前创建最终 Design Doc、写入 `design_doc`、运行 design guard,或进入 `/comet-build`。
107
+
108
+ 暂停时只展示必要摘要:
109
+ - 采用的技术方案
110
+ - 关键取舍与风险
111
+ - 测试策略
112
+ - 如有 Spec Patch,列出将回写的 delta spec 变更
113
+
114
+ 用户明确确认后,才继续 Step 2。若用户要求调整,继续 brainstorming 迭代,直到用户确认。
98
115
 
99
116
  ### 2. 更新 Comet 状态
100
117
 
101
- 先记录 design_doc 路径,再运行 guard 自动流转:
118
+ 先记录 design_doc 路径。如果 Step 1c 回写了 delta spec(新增或修改了 `specs/*/spec.md`),必须重新生成 handoff 以更新 hash:
102
119
 
103
120
  ```bash
104
121
  # 记录 design_doc 路径
105
122
  bash "$COMET_STATE" set <name> design_doc docs/superpowers/specs/YYYY-MM-DD-topic-design.md
106
123
 
124
+ # 如有 delta spec 变更,重新生成 handoff(更新 hash)
125
+ bash "$COMET_HANDOFF" <change-name> design --write
126
+
107
127
  # 自动流转到下一阶段
108
128
  bash "$COMET_GUARD" <change-name> design --apply
109
129
  ```
110
130
 
111
- 状态文件自动更新,无需手动编辑其他字段。
131
+ 如果没有 delta spec 变更,跳过 handoff 重新生成步骤。状态文件自动更新,无需手动编辑其他字段。
112
132
 
113
133
  ## 退出条件
114
134