@rpamis/comet 0.1.7 → 0.2.0

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 (67) hide show
  1. package/README.md +45 -13
  2. package/assets/manifest.json +2 -0
  3. package/assets/skills/comet/SKILL.md +214 -219
  4. package/assets/skills/comet/scripts/comet-archive.sh +8 -2
  5. package/assets/skills/comet/scripts/comet-guard.sh +32 -22
  6. package/assets/skills/comet/scripts/comet-state.sh +496 -0
  7. package/assets/skills/comet-archive/SKILL.md +6 -19
  8. package/assets/skills/comet-build/SKILL.md +16 -23
  9. package/assets/skills/comet-design/SKILL.md +7 -23
  10. package/assets/skills/comet-hotfix/SKILL.md +136 -167
  11. package/assets/skills/comet-open/SKILL.md +9 -31
  12. package/assets/skills/comet-tweak/SKILL.md +122 -154
  13. package/assets/skills/comet-verify/SKILL.md +11 -33
  14. package/assets/skills-zh/comet/SKILL.md +87 -92
  15. package/assets/skills-zh/comet-archive/SKILL.md +63 -76
  16. package/assets/skills-zh/comet-build/SKILL.md +153 -160
  17. package/assets/skills-zh/comet-design/SKILL.md +91 -107
  18. package/assets/skills-zh/comet-hotfix/SKILL.md +18 -49
  19. package/assets/skills-zh/comet-open/SKILL.md +70 -92
  20. package/assets/skills-zh/comet-tweak/SKILL.md +19 -51
  21. package/assets/skills-zh/comet-verify/SKILL.md +114 -136
  22. package/dist/cli/index.js +28 -1
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/commands/doctor.d.ts +6 -0
  25. package/dist/commands/doctor.d.ts.map +1 -0
  26. package/dist/commands/doctor.js +168 -0
  27. package/dist/commands/doctor.js.map +1 -0
  28. package/dist/commands/init.d.ts +9 -0
  29. package/dist/commands/init.d.ts.map +1 -0
  30. package/dist/commands/init.js +183 -0
  31. package/dist/commands/init.js.map +1 -0
  32. package/dist/commands/status.d.ts +6 -0
  33. package/dist/commands/status.d.ts.map +1 -0
  34. package/dist/commands/status.js +89 -0
  35. package/dist/commands/status.js.map +1 -0
  36. package/dist/commands/update.d.ts +8 -0
  37. package/dist/commands/update.d.ts.map +1 -0
  38. package/dist/commands/update.js +47 -0
  39. package/dist/commands/update.js.map +1 -0
  40. package/dist/core/detect.d.ts +8 -0
  41. package/dist/core/detect.d.ts.map +1 -0
  42. package/dist/core/detect.js +73 -0
  43. package/dist/core/detect.js.map +1 -0
  44. package/dist/core/openspec.d.ts +5 -0
  45. package/dist/core/openspec.d.ts.map +1 -0
  46. package/dist/core/openspec.js +58 -0
  47. package/dist/core/openspec.js.map +1 -0
  48. package/dist/core/platforms.d.ts.map +1 -1
  49. package/dist/core/platforms.js +6 -1
  50. package/dist/core/platforms.js.map +1 -1
  51. package/dist/core/skills.d.ts +22 -0
  52. package/dist/core/skills.d.ts.map +1 -0
  53. package/dist/core/skills.js +59 -0
  54. package/dist/core/skills.js.map +1 -0
  55. package/dist/core/superpowers.d.ts +5 -0
  56. package/dist/core/superpowers.d.ts.map +1 -0
  57. package/dist/core/superpowers.js +60 -0
  58. package/dist/core/superpowers.js.map +1 -0
  59. package/dist/core/types.d.ts +2 -0
  60. package/dist/core/types.d.ts.map +1 -0
  61. package/dist/core/types.js +2 -0
  62. package/dist/core/types.js.map +1 -0
  63. package/package.json +61 -50
  64. package/dist/core/init.d.ts +0 -14
  65. package/dist/core/init.d.ts.map +0 -1
  66. package/dist/core/init.js +0 -492
  67. package/dist/core/init.js.map +0 -1
@@ -1,154 +1,122 @@
1
- ---
2
- name: comet-tweak
3
- description: "Comet preset path: Non-bug small changes (tweak). Skip brainstorming and full plan, directly open → lightweight build → light verify → archive. Applicable for copy, configuration, documentation or prompt local optimization."
4
- ---
5
-
6
- # Comet Preset Path: Tweak
7
-
8
- Tweak is a preset workflow of Comet's five-phase capabilities, not a separate parallel process. It reuses open, build, verify, archive capabilities, only skipping brainstorming and full plan.
9
-
10
- Applicable for small-scale non-bug changes, such as copy adjustments, configuration adjustments, documentation or prompt local optimization.
11
-
12
- **Applicable conditions** (all must be met):
13
- 1. No new capability
14
- 2. No architecture changes
15
- 3. No interface changes involved
16
- 4. Usually not exceeding 3 tasks, 5 files
17
-
18
- **Not applicable**: If change process discovers need for capability, architecture, or interface adjustments, should upgrade to full `/comet` workflow.
19
-
20
- ---
21
-
22
- ## Process (preset workflow, 4 phases)
23
-
24
- ### 0. Entry State Verification (Entry Check)
25
-
26
- Before performing any operations, verify current state:
27
-
28
- **Checklist:**
29
- 1. `openspec/changes/<name>/` directory does not exist, or directory exists but `.comet.yaml` does not exist (no conflict)
30
-
31
- **Verification method:**
32
- - `test -d openspec/changes/<name>` to check directory
33
- - If directory exists, `test -f openspec/changes/<name>/.comet.yaml` to check config file
34
- - If `.comet.yaml` exists, read `phase` to check if it's an incomplete tweak
35
-
36
- **Failure output (has conflict):**
37
- ```
38
- [HARD STOP] Entry check failed for comet-tweak
39
- Expected: openspec/changes/<name>/.comet.yaml does not exist (new change)
40
- Actual: .comet.yaml exists with phase=<actual-value>
41
- Suggestion: Pick a different change name, or check if an existing tweak is in progress.
42
- ```
43
-
44
- Proceed to process steps only after verification passes.
45
-
46
- Execution chain: open → lightweight build → light verify → archive. Tweak provides default decisions for each phase: streamlined open, lightweight build, lightweight verification, archive after verification passes.
47
-
48
- ### 1. Quick Open (preset open)
49
-
50
- Reuse Comet open capability to create change, but use tweak defaults: do not execute `openspec-explore` long exploration, directly enter streamlined change creation.
51
-
52
- **Immediately execute:** Use the Skill tool to load the `openspec-new-change` skill. Skipping this step is prohibited.
53
-
54
- After the skill loads, follow its guidance to create streamlined artifacts:
55
- - `proposal.md` change motivation + goals + scope
56
- - `design.md` — brief implementation description (no solution comparison needed)
57
- - `tasks.md` not exceeding 3 tasks
58
- - **No delta spec needed** (unless change changes existing spec acceptance scenarios; once delta spec needed, upgrade to full `/comet`)
59
-
60
- Create independent `.comet.yaml` file under `openspec/changes/<name>/`:
61
-
62
- ```yaml
63
- workflow: tweak
64
- phase: build
65
- design_doc: null
66
- plan: null
67
- build_mode: direct
68
- isolation: branch
69
- verify_mode: light
70
- verify_result: pending
71
- verified_at: null
72
- archived: false
73
- ```
74
-
75
- 【Write verification】After creation completion, must verify:
76
- cat openspec/changes/<name>/.comet.yaml
77
- Confirm workflow line value is "tweak"
78
- Confirm phase line value is "build"
79
- Confirm design_doc line value is "null"
80
- Confirm plan line value is "null"
81
- Confirm build_mode line value is "direct"
82
- Confirm isolation line value is "branch"
83
- Confirm verify_mode line value is "light"
84
- Confirm verify_result line value is "pending"
85
- Confirm verified_at line value is "null"
86
- Confirm archived line value is "false"
87
- If any field does not match, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
88
-
89
- ### 2. Lightweight Build (preset build)
90
-
91
- Use tweak defaults: `build_mode: direct`. Skip `superpowers:brainstorming` and `superpowers:writing-plans`.
92
-
93
- **Immediately execute:** Execute tasks one by one according to tasks.md:
94
-
95
- 1. Read `openspec/changes/<name>/tasks.md`, get incomplete task list
96
- 2. For each incomplete task:
97
- - Modify target file according to task description
98
- - Run `mvn spotless:apply` to format
99
- - Run related tests to confirm pass
100
- - Check corresponding `- [ ]` to `- [x]` in tasks.md
101
- - Commit code, commit message format: `tweak: <brief change description>`
102
- 3. After all tasks complete, enter verification
103
-
104
- ### 3. Lightweight Verification (preset verify)
105
-
106
- Reuse `/comet-verify`. Tweak must maintain lightweight verification conditions: ≤ 3 tasks, ≤ 5 files, no delta spec, no new capability.
107
-
108
- **Immediately execute:** Use the Skill tool to load the `comet-verify` skill. Skipping this step is prohibited.
109
-
110
- If scale assessment enters full verification path, stop tweak, upgrade to full `/comet`.
111
-
112
- After verification passes, record `.comet.yaml` `verify_result` as `pass` according to `/comet-verify` rules, must not skip this status before archiving.
113
-
114
- ### 4. Archive (preset archive)
115
-
116
- Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving.
117
-
118
- **Immediately execute:** Use the Skill tool to load the `comet-archive` skill to archive. Skipping this step is prohibited.
119
-
120
- ---
121
-
122
- ## Continuous Execution Mode
123
-
124
- <IMPORTANT>
125
- Tweak workflow is **one-time continuous execution**. After invoking `/comet-tweak`, agent must automatically complete all 4 phases, without pausing to wait for user input mid-way (unless encountering upgrade conditions requiring user confirmation).
126
-
127
- Execution order: quick open → lightweight build → lightweight verification → archive → complete
128
-
129
- After each phase completes, immediately enter next phase, no need for user input again. Within each phase, must still call corresponding Comet/OpenSpec/Superpowers skill according to above requirements.
130
- </IMPORTANT>
131
-
132
- ---
133
-
134
- ## Upgrade Conditions
135
-
136
- When the following situations occur during execution, stop tweak workflow, upgrade to full `/comet`:
137
-
138
- 1. Need new capability
139
- 2. Need architecture adjustments
140
- 3. Need interface changes
141
- 4. Impact scope expands to > 5 files
142
- 5. Task count exceeds 3
143
- 6. Need delta spec
144
-
145
- Upgrade method: On current change basis, supplement Design Doc (execute `/comet-design`), then proceed normally with full workflow.
146
-
147
- ---
148
-
149
- ## Exit Conditions
150
-
151
- - Small change completed, tests pass
152
- - Change archived
153
- - No new capability, architecture adjustments, or interface changes
154
- - **Phase guard**: Before build → verify run `bash $COMET_GUARD <change-name> build`, before verify → archive run `bash $COMET_GUARD <change-name> verify`
1
+ ---
2
+ name: comet-tweak
3
+ description: "Comet preset path: Non-bug small changes (tweak). Skip brainstorming and full plan, directly open → lightweight build → light verify → archive. Applicable for copy, configuration, documentation or prompt local optimization."
4
+ ---
5
+
6
+ # Comet Preset Path: Tweak
7
+
8
+ Tweak is a preset workflow of Comet's five-phase capabilities, not a separate parallel process. It reuses open, build, verify, archive capabilities, only skipping brainstorming and full plan.
9
+
10
+ Applicable for small-scale non-bug changes, such as copy adjustments, configuration adjustments, documentation or prompt local optimization.
11
+
12
+ **Applicable conditions** (all must be met):
13
+ 1. No new capability
14
+ 2. No architecture changes
15
+ 3. No interface changes involved
16
+ 4. Usually not exceeding 3 tasks, 5 files
17
+
18
+ **Not applicable**: If change process discovers need for capability, architecture, or interface adjustments, should upgrade to full `/comet` workflow.
19
+
20
+ ---
21
+
22
+ ## Process (preset workflow, 4 phases)
23
+
24
+ ### 0. Entry State Verification (Entry Check)
25
+
26
+ Execute entry verification:
27
+
28
+ ```bash
29
+ COMET_STATE="${COMET_STATE:-$(find . -path '*/comet/scripts/comet-state.sh' -type f -print -quit)}"
30
+ bash "$COMET_STATE" check <name> open
31
+ ```
32
+
33
+ Proceed to process steps after verification passes. The script outputs specific failure reasons when verification fails.
34
+
35
+ Execution chain: open → lightweight build → light verify → archive. Tweak provides default decisions for each phase: streamlined open, lightweight build, lightweight verification, archive after verification passes.
36
+
37
+ ### 1. Quick Open (preset open)
38
+
39
+ Reuse Comet open capability to create change, but use tweak defaults: do not execute `openspec-explore` long exploration, directly enter streamlined change creation.
40
+
41
+ **Immediately execute:** Use the Skill tool to load the `openspec-new-change` skill. Skipping this step is prohibited.
42
+
43
+ After the skill loads, follow its guidance to create streamlined artifacts:
44
+ - `proposal.md` change motivation + goals + scope
45
+ - `design.md` — brief implementation description (no solution comparison needed)
46
+ - `tasks.md` not exceeding 3 tasks
47
+ - **No delta spec needed** (unless change changes existing spec acceptance scenarios; once delta spec needed, upgrade to full `/comet`)
48
+
49
+ Initialize Comet state file:
50
+
51
+ ```bash
52
+ bash "$COMET_STATE" init <name> tweak
53
+ ```
54
+
55
+ ### 2. Lightweight Build (preset build)
56
+
57
+ Use tweak defaults: `build_mode: direct`. Skip `superpowers:brainstorming` and `superpowers:writing-plans`.
58
+
59
+ **Immediately execute:** Execute tasks one by one according to tasks.md:
60
+
61
+ 1. Read `openspec/changes/<name>/tasks.md`, get incomplete task list
62
+ 2. For each incomplete task:
63
+ - Modify target file according to task description
64
+ - Run project formatter (e.g., `mvn spotless:apply`, `npm run format`)
65
+ - Run related tests to confirm pass
66
+ - Check corresponding `- [ ]` to `- [x]` in tasks.md
67
+ - Commit code, commit message format: `tweak: <brief change description>`
68
+ 3. After all tasks complete, enter verification
69
+
70
+ ### 3. Lightweight Verification (preset verify)
71
+
72
+ Reuse `/comet-verify`. Tweak must maintain lightweight verification conditions: ≤ 3 tasks, ≤ 5 files, no delta spec, no new capability.
73
+
74
+ **Immediately execute:** Use the Skill tool to load the `comet-verify` skill. Skipping this step is prohibited.
75
+
76
+ If scale assessment enters full verification path, stop tweak, upgrade to full `/comet`.
77
+
78
+ After verification passes, record `.comet.yaml` `verify_result` as `pass` according to `/comet-verify` rules, must not skip this status before archiving.
79
+
80
+ ### 4. Archive (preset archive)
81
+
82
+ Reuse `/comet-archive`. Must satisfy `verify_result: pass` in `.comet.yaml` before archiving.
83
+
84
+ **Immediately execute:** Use the Skill tool to load the `comet-archive` skill to archive. Skipping this step is prohibited.
85
+
86
+ ---
87
+
88
+ ## Continuous Execution Mode
89
+
90
+ <IMPORTANT>
91
+ Tweak workflow is **one-time continuous execution**. After invoking `/comet-tweak`, agent must automatically complete all 4 phases, without pausing to wait for user input mid-way (unless encountering upgrade conditions requiring user confirmation).
92
+
93
+ Execution order: quick open lightweight build lightweight verification → archive → complete
94
+
95
+ After each phase completes, immediately enter next phase, no need for user input again. Within each phase, must still call corresponding Comet/OpenSpec/Superpowers skill according to above requirements.
96
+ </IMPORTANT>
97
+
98
+ ---
99
+
100
+ ## Upgrade Conditions
101
+
102
+ Upgrade to full `/comet` when **any** of the following conditions are met:
103
+
104
+ | Condition | Explanation |
105
+ |-----------|-------------|
106
+ | Change involves **5+ files** | Exceeds small change scope |
107
+ | Cross-module coordination required | Needs coordination across components |
108
+ | **5+** new test cases needed | Change complexity increasing |
109
+ | Config item additions or deletions | Non-value config changes |
110
+ | New capability needed | Exceeds local optimization |
111
+ | Delta spec needed | Affects existing specifications |
112
+
113
+ Upgrade method: On current change basis, supplement Design Doc (execute `/comet-design`), then proceed normally with full workflow.
114
+
115
+ ---
116
+
117
+ ## Exit Conditions
118
+
119
+ - Small change completed, tests pass
120
+ - Change archived
121
+ - No new capability, architecture adjustments, or interface changes
122
+ - **Phase guard**: Before build → verify run `bash $COMET_GUARD <change-name> build`, before verify → archive run `bash $COMET_GUARD <change-name> verify`
@@ -14,44 +14,24 @@ description: "Comet Phase 4: Verify and Complete. Invoke with /comet-verify. Ver
14
14
 
15
15
  ### 0. Entry State Verification (Entry Check)
16
16
 
17
- Before performing any operations, read and verify the current state:
17
+ Execute entry verification:
18
18
 
19
- **Checklist:**
20
- 1. `openspec/changes/<name>/.comet.yaml` exists
21
- 2. `phase` field value is `"verify"`
22
- 3. `verify_result` field is `"pending"` or null (not yet verified)
23
-
24
- **Verification method:**
25
- - `cat openspec/changes/<name>/.comet.yaml` to read all fields
26
- - If `verify_result` is already `"pass"`, this change has already been verified
27
-
28
- **Failure output:**
29
- ```
30
- [HARD STOP] Entry check failed for comet-verify
31
- Expected: phase=verify, verify_result=pending|null
32
- Actual: phase=<actual-value>, verify_result=<actual-value>
33
- Suggestion: Run comet-build first, or this change was already verified.
19
+ ```bash
20
+ COMET_STATE="${COMET_STATE:-$(find . -path '*/comet/scripts/comet-state.sh' -type f -print -quit)}"
21
+ bash "$COMET_STATE" check <name> verify
34
22
  ```
35
23
 
36
- Proceed to Step 1 only after verification passes.
24
+ Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
37
25
 
38
26
  ### 1. Change Scale Assessment
39
27
 
40
- Determine change scale based on the following metrics:
28
+ Execute scale assessment:
41
29
 
42
- | Metric | Small (lightweight verification) | Large (full verification) |
43
- |------|-------------------------------|--------------------------|
44
- | tasks.md task count | ≤ 3 | > 3 |
45
- | Changed file count (git diff --stat) | ≤ 5 | > 5 |
46
- | Has delta spec | No | Yes |
47
- | New capability added | No | Yes |
48
-
49
- **Decision rule**: Any metric hitting "large" → full verification. All hitting "small" → lightweight verification.
50
-
51
- After determination, record actual verification mode in `openspec/changes/<name>/.comet.yaml`. `verify_mode` only allows one of the following values:
30
+ ```bash
31
+ bash "$COMET_STATE" scale <name>
32
+ ```
52
33
 
53
- - `light`
54
- - `full`
34
+ 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.
55
35
 
56
36
  ### 2a. Lightweight Verification (Small Changes)
57
37
 
@@ -59,7 +39,7 @@ When scale assessment result is "small", skip `openspec-verify-change`, directly
59
39
 
60
40
  1. All tasks in tasks.md completed `[x]`
61
41
  2. Changed files consistent with tasks.md description (`git diff --stat`对照 tasks content)
62
- 3. Build passes (for Maven projects, first execute `mvn spotless:apply`, then execute `mvn compile` or equivalent command)
42
+ 3. Build passes (run project-appropriate build command, e.g., `npm run build`, `mvn compile`, `cargo build`)
63
43
  4. Related tests pass
64
44
  5. No obvious security issues (no hardcoded secrets, no new unsafe operations)
65
45
 
@@ -109,9 +89,7 @@ After the skill loads, follow its guidance to complete. Branch handling options:
109
89
  4. Discard work
110
90
 
111
91
  **Confirmation items**:
112
- - Maven test or build commands have executed `mvn spotless:apply`
113
92
  - All tests pass
114
- - No remaining spotless formatting issues
115
93
  - No hardcoded secrets or security issues
116
94
 
117
95
  ## Exit Conditions
@@ -5,7 +5,7 @@ description: "Comet — OpenSpec + Superpowers 双星开发流程。用 /comet
5
5
 
6
6
  # Comet — OpenSpec + Superpowers 双星开发流程
7
7
 
8
- OpenSpec 与 Superpowers 如双星系统围绕同一目标运转。OpenSpec 负责 WHAT,Superpowers 负责 HOW。
8
+ OpenSpec 与 Superpowers 如双星系统围绕同一目标运转。
9
9
 
10
10
  ```
11
11
  OpenSpec 负责 WHAT — 大纲、提案、spec 生命周期、归档
@@ -14,105 +14,89 @@ Superpowers 负责 HOW — 技术设计、计划、执行、收尾
14
14
 
15
15
  **核心原则:brainstorming 必不可跳过。每次变更都必须经过深度设计(hotfix 和 tweak preset 除外)。**
16
16
 
17
- <IMPORTANT>
18
- ## 阶段衔接
19
-
20
- 单次 `/comet` 调用会从检测到的阶段开始执行,并在每个阶段退出条件满足后提示或进入下一阶段。
21
-
22
- 流转链:open → design → build → verify → archive
23
-
24
- 需要用户参与的节点:
25
- 1. brainstorming 过程中确认设计方案
26
- 2. build 阶段选择执行方式
27
- 3. verify 不通过时决定修复或接受偏差
28
- 4. finishing-branch 选择分支处理方式
29
- 5. 遇到升级条件(hotfix/tweak → 完整流程)
17
+ ---
30
18
 
31
- agent 不应跳过这些决策点;其他明确无歧义的阶段衔接可以继续推进。
32
- </IMPORTANT>
19
+ ## 决策核心(Decision Core)
33
20
 
34
- ## 阶段自动检测
21
+ agent 做决策只需读本节,参考附录按需查阅。
35
22
 
36
- ### Step 0: 活跃 Change 发现
23
+ ### 阶段自动检测
37
24
 
38
- **立即执行:**
25
+ **Step 0: 活跃 Change 发现**
39
26
 
40
27
  1. 运行 `openspec list --json` 获取所有活跃 change
41
28
  2. 对每个 change,检查 `docs/superpowers/specs/` 和 `docs/superpowers/plans/` 匹配关联文件,判断阶段和进度
42
29
 
43
- **分支逻辑:**
44
-
45
30
  | 情况 | 行为 |
46
31
  |------|------|
47
32
  | 无活跃 change | → 调用 `/comet-open` |
48
- | 恰好 1 个活跃 change | → 自动选中,进入阶段判定(Step 1 |
33
+ | 恰好 1 个活跃 change | → 自动选中,进入 Step 1 |
49
34
  | 多个活跃 change | → 列出清单让用户选择 |
50
35
 
51
- **多 change 选择**:使用 AskUserQuestion 展示,格式示例:
36
+ **Preset 检测**:
37
+ - 用户明确描述为 bug fix / 热修复 + 满足 hotfix 条件 → 直接 `/comet-hotfix`
38
+ - 用户明确描述为文案/配置/文档/prompt 小调整 + 满足 tweak 条件 → 直接 `/comet-tweak`
52
39
 
53
- ```
54
- | # | Change 名称 | 当前阶段 | 任务进度 |
55
- |---|------------|---------|---------|
56
- | 1 | xxx-feature | Build | 3/5 tasks |
57
- | 2 | yyy-fix | Design | No design doc |
58
- ```
40
+ **Step 1: 读取 `.comet.yaml` 状态元数据**
59
41
 
60
- 用户选择后,对选中的 change 进入阶段判定。
42
+ 优先读取 `openspec/changes/<name>/.comet.yaml`。不存在时回退到 `openspec status --change "<name>" --json`、`tasks.md` 和 `docs/superpowers/` 文件检查。
61
43
 
62
- **Preset 检测**:
63
- - 如用户明确描述为 bug fix / 热修复,且满足 hotfix 适用条件,直接调用 `/comet-hotfix`(跳过选择)。
64
- - 如用户明确描述为文案、配置、文档、prompt 或小范围非 bug 调整,且满足 tweak 适用条件,直接调用 `/comet-tweak`(跳过选择)。
44
+ **Step 2: 阶段判定**(按顺序,命中即停)
65
45
 
66
- ### Step 1: Comet 状态元数据读取
46
+ 1. `archived: true` 或 change 已移入 archive → 流程已完成
47
+ 2. `verify_result: pass` 且 `archived` 不是 `true` → `/comet-archive`
48
+ 3. `phase: verify` 或 tasks.md 全部勾选 → `/comet-verify`
49
+ 4. `phase: build` 或已有 Design Doc 但计划/执行未完成 → `/comet-build`
50
+ 5. `phase: design` 或有 change 但无 Design Doc → `/comet-design`
51
+ 6. 无活跃 change 或状态无法判定 → `/comet-open`
67
52
 
68
- 优先读取 `openspec/changes/<name>/.comet.yaml`。若该文件不存在,再回退到 `openspec status --change "<name>" --json`、`tasks.md` 和 `docs/superpowers/` 文件检查。
53
+ 如果元数据与文件状态冲突,以文件状态为准,修正 `.comet.yaml` 后继续。
69
54
 
70
- 推荐元数据结构:
55
+ ### 预设升级条件
71
56
 
72
- ```yaml
73
- workflow: full
74
- phase: build
75
- design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
76
- plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
77
- build_mode: subagent-driven-development
78
- isolation: branch
79
- verify_mode: light
80
- verify_result: pending
81
- verified_at: null
82
- archived: false
83
- ```
57
+ **hotfix → full**(满足任一即升级):
58
+ - 改动涉及 **3+ 文件**
59
+ - 涉及架构变更(新模块、新接口、新依赖)
60
+ - 涉及数据库 schema 变更
61
+ - 修复引入新的 public API
62
+ - 修复范围超出单一函数/模块
84
63
 
85
- 字段含义:
64
+ **tweak → full**(满足任一即升级):
65
+ - 改动涉及 **5+ 文件**
66
+ - 涉及多个模块的协调修改
67
+ - 需要新增测试用例 **5+**
68
+ - 涉及配置项的新增或删除(非值修改)
86
69
 
87
- | 字段 | 含义 |
88
- |------|------|
89
- | `workflow` | `full`、`hotfix` 或 `tweak` |
90
- | `phase` | 当前阶段:`open`、`design`、`build`、`verify`、`archive` |
91
- | `design_doc` | 关联的 Superpowers Design Doc 路径,可为空 |
92
- | `plan` | 关联的 Superpowers Plan 路径,可为空 |
93
- | `build_mode` | 已选择的执行方式,可为空 |
94
- | `isolation` | `branch` 或 `worktree`,工作区隔离方式,默认 `branch` |
95
- | `verify_mode` | `light` 或 `full`,可为空 |
96
- | `verify_result` | `pending`、`pass` 或 `fail` |
97
- | `verified_at` | 验证通过时间,可为空 |
98
- | `archived` | change 是否已归档 |
70
+ ### 错误处理速查
99
71
 
100
- ### Step 2: 阶段判定
72
+ | 场景 | 处理方式 |
73
+ |------|---------|
74
+ | `openspec list --json` 失败 | 检查 openspec 是否已安装,提示 `openspec init` |
75
+ | 子 skill 不可用 | 停止流程,提示安装或启用对应 skill |
76
+ | `.comet.yaml` 格式异常或缺失 | 以文件状态为准,用 `bash $COMET_STATE set` 修正后继续 |
77
+ | Maven 编译/测试失败 | 返回 build 阶段修复,不进入 verify |
78
+ | change 目录结构不完整 | 按 `comet-open` 产物要求补齐 |
79
+
80
+ ### 阶段衔接
101
81
 
102
- 对选中的 change,按以下顺序判断当前状态:
82
+ <IMPORTANT>
83
+ 单次 `/comet` 调用从检测到的阶段开始,退出条件满足后进入下一阶段。
103
84
 
104
- 1. **`archived: true` change 已移入 archive**流程已完成
105
- 2. **`verify_result: pass` 且 `archived` 不是 `true`** → 调用 `/comet-archive`
106
- 3. **`phase: verify` 或 tasks.md 全部勾选** → 调用 `/comet-verify`
107
- 4. **`phase: build` 或已有 Design Doc 但计划/执行未完成** → 调用 `/comet-build`
108
- 5. **`phase: design` 或有 change 但无 Design Doc** → 调用 `/comet-design`
109
- 6. **无活跃 change 或状态无法判定** → 调用 `/comet-open`
85
+ 流转链:open design build verifyarchive
110
86
 
111
- 如果元数据与文件状态冲突,以可验证的文件状态为准,并在继续阶段前修正 `.comet.yaml`。
87
+ 需要用户参与的节点:
88
+ 1. brainstorming 确认设计方案
89
+ 2. build 阶段选择执行方式
90
+ 3. verify 不通过时决定修复或接受偏差
91
+ 4. finishing-branch 选择分支处理方式
92
+ 5. 遇到升级条件(hotfix/tweak → 完整流程)
93
+
94
+ agent 不应跳过这些决策点;其他明确无歧义的阶段衔接可以继续推进。
95
+ </IMPORTANT>
112
96
 
113
97
  ---
114
98
 
115
- ## 子命令
99
+ ## 子命令速查
116
100
 
117
101
  | 命令 | 阶段 | 归属 | 产物 |
118
102
  |------|------|------|------|
@@ -124,10 +108,6 @@ archived: false
124
108
  | `/comet-hotfix` | 预设路径 | Both | 快速修复(跳过 brainstorming) |
125
109
  | `/comet-tweak` | 预设路径 | Both | 小改动(跳过 brainstorming 和完整 plan) |
126
110
 
127
- ---
128
-
129
- ## 流程图
130
-
131
111
  ```
132
112
  /comet
133
113
  ↓ 自动检测
@@ -145,28 +125,44 @@ archived: false
145
125
 
146
126
  ---
147
127
 
148
- ## 错误处理
128
+ ## 参考附录(Reference Appendix)
149
129
 
150
- | 场景 | 处理方式 |
151
- |------|---------|
152
- | `openspec list --json` 失败 | 检查 openspec 是否已安装,提示用户运行 `openspec init` |
153
- | 子 skill 不可用(如 `superpowers:brainstorming`) | 停止流程,提示安装或启用对应 skill |
154
- | `.comet.yaml` 格式异常或缺失 | 以文件状态为准(tasks.md、docs/superpowers/),修正元数据后继续 |
155
- | Maven 编译/测试失败 | 返回 build 阶段修复,不进入 verify |
156
- | change 目录结构不完整 | 按 `comet-open` 的产物要求补齐缺失文件 |
130
+ ### .comet.yaml 字段说明
157
131
 
158
- ---
132
+ ```yaml
133
+ workflow: full
134
+ phase: build
135
+ design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
136
+ plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
137
+ build_mode: subagent-driven-development
138
+ isolation: branch
139
+ verify_mode: light
140
+ verify_result: pending
141
+ verified_at: null
142
+ archived: false
143
+ ```
159
144
 
160
- ## 快速参考
145
+ | 字段 | 含义 |
146
+ |------|------|
147
+ | `workflow` | `full`、`hotfix` 或 `tweak` |
148
+ | `phase` | 当前阶段:`open`、`design`、`build`、`verify`、`archive` |
149
+ | `design_doc` | 关联的 Superpowers Design Doc 路径,可为空 |
150
+ | `plan` | 关联的 Superpowers Plan 路径,可为空 |
151
+ | `build_mode` | 已选择的执行方式,可为空 |
152
+ | `isolation` | `branch` 或 `worktree`,工作区隔离方式,默认 `branch` |
153
+ | `verify_mode` | `light` 或 `full`,可为空 |
154
+ | `verify_result` | `pending`、`pass` 或 `fail` |
155
+ | `verified_at` | 验证通过时间,可为空 |
156
+ | `archived` | change 是否已归档 |
161
157
 
162
158
  ### 脚本定位
163
159
 
164
- Comet 阶段守卫脚本 `comet-guard.sh` 和归档脚本 `comet-archive.sh` 随 skill 包分发,位于 `comet/scripts/` 目录。
165
- **不硬编码平台路径**,运行时通过以下命令自定位:
160
+ Comet 脚本随 skill 包分发在 `comet/scripts/` 下。**不硬编码路径** — 定位一次,缓存到环境变量:
166
161
 
167
162
  ```bash
168
- COMET_GUARD=$(find . -path '*/comet/scripts/comet-guard.sh' -type f -print -quit)
169
- bash "$COMET_GUARD" <change-name> <phase>
163
+ COMET_GUARD="${COMET_GUARD:-$(find . -path '*/comet/scripts/comet-guard.sh' -type f -print -quit)}"
164
+ COMET_STATE="${COMET_STATE:-$(find . -path '*/comet/scripts/comet-state.sh' -type f -print -quit)}"
165
+ COMET_ARCHIVE="${COMET_ARCHIVE:-$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)}"
170
166
  ```
171
167
 
172
168
  **自动状态更新**:guard 支持 `--apply` 参数,验证通过后自动更新 `.comet.yaml` 状态字段:
@@ -178,11 +174,10 @@ bash "$COMET_GUARD" <change-name> <phase> --apply
178
174
  **归档脚本**:一键完成归档全部步骤:
179
175
 
180
176
  ```bash
181
- COMET_ARCHIVE=$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)
182
177
  bash "$COMET_ARCHIVE" <change-name>
183
178
  ```
184
179
 
185
- 后续文档中 `bash $COMET_GUARD <change> <phase>` 均指此命令。加载 comet 后,agent 应在 shell 环境中缓存 `COMET_GUARD` 路径,避免重复 `find`。
180
+ 加载 comet 后,agent 应执行以上三条变量赋值一次,后续全程复用 `$COMET_GUARD`、`$COMET_STATE`、`$COMET_ARCHIVE`。
186
181
 
187
182
  ### 文件结构
188
183
 
@@ -215,5 +210,5 @@ docs/superpowers/ # Superpowers — HOW
215
210
  6. **增量更新分级** — 小编辑、中重 brainstorming、大新 change
216
211
  7. **Plan 必须关联 change** — 文件头包含 `change:` 和 `design-doc:` 元数据
217
212
  8. **归档闭环** — design doc 和 plan 必须标注 `archived-with` 状态
218
- 9. **增量修改已有功能** — 直接 open 新 change,brainstorming 会读取已有 main spec 作为上下文
213
+ 9. **修改已有功能** — 直接 open 新 change 即可
219
214
  10. **Preset 有上限** — hotfix/tweak 满足升级条件时及时切换到完整流程