@rpamis/comet 0.1.4 → 0.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.
@@ -1,151 +1,151 @@
1
- ---
2
- name: comet-archive
3
- description: "Comet 阶段 5:归档。用 /comet-archive 调用。同步 delta spec 到主 spec,归档 change"
4
- ---
5
-
6
- # Comet 阶段 5:归档(Archive
7
-
8
- ## 前置条件
9
-
10
- - 验证已通过(阶段 4 完成)
11
- - 分支已处理
12
- - `openspec/changes/<name>/.comet.yaml` 中 `verify_result: pass`
13
-
14
- ## 步骤
15
-
16
- ### 0. 入口状态验证(Entry Check
17
-
18
- 在执行任何操作之前,读取并验证当前状态:
19
-
20
- **检查清单:**
21
- 1. `openspec/changes/<name>/.comet.yaml` 存在
22
- 2. `phase` 字段的值为 `"archive"`
23
- 3. `verify_result` 字段的值为 `"pass"`
24
- 4. `archived` 字段为 `"false"` null(尚未归档)
25
-
26
- **验证方式:**
27
- - `cat openspec/changes/<name>/.comet.yaml` 读取全部字段
28
- - `verify_result` 不是 `"pass"`,必须先完成验证
29
-
30
- **失败输出:**
31
- ```
32
- [HARD STOP] Entry check failed for comet-archive
33
- Expected: phase=archive, verify_result=pass, archived=false|null
34
- Actual: phase=<实际值>, verify_result=<实际值>, archived=<实际值>
35
- Suggestion: Run comet-verify first, or this change was already archived.
36
- ```
37
-
38
- 验证通过后才进入步骤 1
39
-
40
- ### 1. 执行归档
41
-
42
- 归档前如 `verify_result` 不是 `pass`,停止归档并返回 `/comet-verify`。
43
-
44
- **立即执行:** 使用 Skill 工具加载 `openspec-archive-change` 技能。禁止跳过此步骤。
45
-
46
- 技能加载后,按其指引归档。自动检查:
47
- 1. artifact 完成状态(proposaldesignspecstasks
48
- 2. 所有任务已标记 `[x]`
49
- 3. delta specs 同步状态
50
-
51
- ### 1b. 移动 Comet 状态文件
52
-
53
- `openspec-archive-change` 不感知 `.comet.yaml`,因此 Comet 需要在 OpenSpec 归档完成后自行移动该文件:
54
-
55
- ```bash
56
- mv openspec/changes/<name>/.comet.yaml openspec/changes/archive/YYYY-MM-DD-<name>/.comet.yaml
57
- ```
58
-
59
- 【写入验证】移动完成后必须验证:
60
- test -f openspec/changes/archive/YYYY-MM-DD-<name>/.comet.yaml
61
- 确认归档目录中 .comet.yaml 存在
62
- 如文件不在预期位置,检查 mv 命令是否成功执行。
63
-
64
- ### 2. Delta Spec 同步
65
-
66
- 归档时将 delta specs 同步到主 specs
67
-
68
- ```
69
- openspec/changes/<name>/specs/<capability>/spec.md
70
- 同步
71
- openspec/specs/<capability>/spec.md ← spec(持久化)
72
- ```
73
-
74
- ### 3. Design Doc & Plan 处理
75
-
76
- 归档时同步处理 `docs/superpowers/` 下的关联文件。若目标文件已有 YAML frontmatter,将归档字段合并到现有 frontmatter;若没有 frontmatter,才新建一组 frontmatter
77
-
78
- **3a. Design Doc 一致性标注**
79
-
80
- 查找 `docs/superpowers/specs/` 中与当前 change 关联的设计文档:
81
- - 对比 delta spec 最终版与 design doc 内容
82
- - 如有偏差(实施过程中 spec 发生了增量修改),在 design doc YAML frontmatter 中设置以下元数据:
83
-
84
- ```yaml
85
- ---
86
- archived-with: YYYY-MM-DD-<name>
87
- status: superseded-by-main-spec
88
- implementation-notes: |
89
- <简述实施过程中偏离原设计的关键变化>
90
- ---
91
- ```
92
-
93
- - 如完全一致,仅设置:
94
-
95
- ```yaml
96
- ---
97
- archived-with: YYYY-MM-DD-<name>
98
- status: final
99
- ---
100
- ```
101
-
102
- **3b. Plan 关联标注**
103
-
104
- 查找 `docs/superpowers/plans/` 中与当前 change 关联的实施计划,在 YAML frontmatter 中设置相同的 `archived-with` 元数据。
105
-
106
- ### 4. 归档目录
107
-
108
- change 移入归档目录:
109
-
110
- ```
111
- openspec/changes/archive/YYYY-MM-DD-<name>/
112
- ├── .openspec.yaml
113
- ├── .comet.yaml
114
- ├── proposal.md
115
- ├── design.md
116
- ├── specs/<capability>/spec.md
117
- └── tasks.md
118
- ```
119
-
120
- ### 5. 生命周期闭环
121
-
122
- Spec 生命周期在此完成:
123
- ```
124
- brainstorming → delta spec → 实施(增量修改)→ 验证 spec 同步 → design doc 标注归档
125
- ```
126
-
127
- ## 退出条件
128
-
129
- - change 已归档(从活跃列表移除)
130
- - specs 已更新(delta → main 同步完成)
131
- - 关联 design doc 已标注归档状态
132
- - 关联 plan 已标注归档状态
133
- - `.comet.yaml` `archived` 已记录为 `true`
134
- - **阶段守卫**:运行 `bash $COMET_GUARD <change-name> archive`,全部 PASS 后确认归档完整
135
-
136
- 归档完成后,在归档目录的 `.comet.yaml` 中更新:
137
-
138
- ```yaml
139
- phase: archive
140
- archived: true
141
- ```
142
-
143
- 【写入验证】更新完成后必须验证:
144
- cat openspec/changes/archive/YYYY-MM-DD-<name>/.comet.yaml
145
- 确认 phase 行的值为 "archive"
146
- 确认 archived 行的值为 "true"
147
- 如任一字段不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
148
-
149
- ## 完成
150
-
151
- Comet 流程全部完成。如需开始新工作,调用 `/comet` `/comet-open`。
1
+ ---
2
+ name: comet-archive
3
+ description: "Comet Phase 5: Archive. Invoke with /comet-archive. Sync delta spec to main spec, archive change."
4
+ ---
5
+
6
+ # Comet Phase 5: Archive (Archive)
7
+
8
+ ## Prerequisites
9
+
10
+ - Verification passed (Phase 4 complete)
11
+ - Branch handled
12
+ - `verify_result: pass` in `openspec/changes/<name>/.comet.yaml`
13
+
14
+ ## Steps
15
+
16
+ ### 0. Entry State Verification (Entry Check)
17
+
18
+ Before performing any operations, read and verify the current state:
19
+
20
+ **Checklist:**
21
+ 1. `openspec/changes/<name>/.comet.yaml` exists
22
+ 2. `phase` field value is `"archive"`
23
+ 3. `verify_result` field value is `"pass"`
24
+ 4. `archived` field is `"false"` or null (not yet archived)
25
+
26
+ **Verification method:**
27
+ - `cat openspec/changes/<name>/.comet.yaml` to read all fields
28
+ - If `verify_result` is not `"pass"`, must complete verification first
29
+
30
+ **Failure output:**
31
+ ```
32
+ [HARD STOP] Entry check failed for comet-archive
33
+ Expected: phase=archive, verify_result=pass, archived=false|null
34
+ Actual: phase=<actual-value>, verify_result=<actual-value>, archived=<actual-value>
35
+ Suggestion: Run comet-verify first, or this change was already archived.
36
+ ```
37
+
38
+ Proceed to Step 1 only after verification passes.
39
+
40
+ ### 1. Execute Archive
41
+
42
+ Before archiving, if `verify_result` is not `pass`, stop archiving and return to `/comet-verify`.
43
+
44
+ **Immediately execute:** Use the Skill tool to load the `openspec-archive-change` skill. Skipping this step is prohibited.
45
+
46
+ After the skill loads, follow its guidance to archive. Automatic checks:
47
+ 1. Artifact completion status (proposal, design, specs, tasks)
48
+ 2. All tasks marked `[x]`
49
+ 3. Delta specs sync status
50
+
51
+ ### 1b. Move Comet State File
52
+
53
+ `openspec-archive-change` is not aware of `.comet.yaml`, so Comet needs to move this file itself after OpenSpec archiving completes:
54
+
55
+ ```bash
56
+ mv openspec/changes/<name>/.comet.yaml openspec/changes/archive/YYYY-MM-DD-<name>/.comet.yaml
57
+ ```
58
+
59
+ 【Write verification】After move completion, must verify:
60
+ test -f openspec/changes/archive/YYYY-MM-DD-<name>/.comet.yaml
61
+ Confirm .comet.yaml exists in archive directory
62
+ If file is not at expected location, check if mv command executed successfully.
63
+
64
+ ### 2. Delta Spec Sync
65
+
66
+ Sync delta specs to main specs during archiving:
67
+
68
+ ```
69
+ openspec/changes/<name>/specs/<capability>/spec.md
70
+ sync
71
+ openspec/specs/<capability>/spec.md ← main spec (persistent)
72
+ ```
73
+
74
+ ### 3. Design Doc & Plan Handling
75
+
76
+ Handle associated files under `docs/superpowers/` during archiving. If target file already has YAML frontmatter, merge archive fields into existing frontmatter; if no frontmatter, create new frontmatter.
77
+
78
+ **3a. Design Doc Consistency Annotation**
79
+
80
+ Find design documents associated with current change in `docs/superpowers/specs/`:
81
+ - Compare delta spec final version with design doc content
82
+ - If there are discrepancies (incremental spec modifications during implementation), set the following metadata in design doc's YAML frontmatter:
83
+
84
+ ```yaml
85
+ ---
86
+ archived-with: YYYY-MM-DD-<name>
87
+ status: superseded-by-main-spec
88
+ implementation-notes: |
89
+ <briefly describe key changes deviating from original design during implementation>
90
+ ---
91
+ ```
92
+
93
+ - If completely consistent, only set:
94
+
95
+ ```yaml
96
+ ---
97
+ archived-with: YYYY-MM-DD-<name>
98
+ status: final
99
+ ---
100
+ ```
101
+
102
+ **3b. Plan Association Annotation**
103
+
104
+ Find implementation plans associated with current change in `docs/superpowers/plans/`, set the same `archived-with` metadata in YAML frontmatter.
105
+
106
+ ### 4. Archive Directory
107
+
108
+ Change moves to archive directory:
109
+
110
+ ```
111
+ openspec/changes/archive/YYYY-MM-DD-<name>/
112
+ ├── .openspec.yaml
113
+ ├── .comet.yaml
114
+ ├── proposal.md
115
+ ├── design.md
116
+ ├── specs/<capability>/spec.md
117
+ └── tasks.md
118
+ ```
119
+
120
+ ### 5. Lifecycle Closed Loop
121
+
122
+ Spec lifecycle completes here:
123
+ ```
124
+ brainstorming → delta spec → implementation (incremental modifications) verification → main spec sync → design doc annotationarchive
125
+ ```
126
+
127
+ ## Exit Conditions
128
+
129
+ - Change archived (removed from active list)
130
+ - Main specs updated (delta → main sync complete)
131
+ - Associated design doc annotated with archive status
132
+ - Associated plan annotated with archive status
133
+ - `.comet.yaml` `archived` recorded as `true`
134
+ - **Phase guard**: Run `bash $COMET_GUARD <change-name> archive`, confirm archive complete after all PASS
135
+
136
+ After archiving completes, update `.comet.yaml` in archive directory:
137
+
138
+ ```yaml
139
+ phase: archive
140
+ archived: true
141
+ ```
142
+
143
+ 【Write verification】After update completion, must verify:
144
+ cat openspec/changes/archive/YYYY-MM-DD-<name>/.comet.yaml
145
+ Confirm phase line value is "archive"
146
+ Confirm archived line value is "true"
147
+ If any field does not match, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
148
+
149
+ ## Complete
150
+
151
+ Comet workflow complete. To start new work, invoke `/comet` or `/comet-open`.