@rpamis/comet 0.1.2 → 0.1.3

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.
@@ -11,6 +11,31 @@ description: "Comet 阶段 1:开启。用 /comet-open 调用。通过 OpenSpec
11
11
 
12
12
  ## 步骤
13
13
 
14
+ ### 0. 入口状态验证(Entry Check)
15
+
16
+ 在执行任何操作之前,读取并验证当前状态:
17
+
18
+ **检查清单:**
19
+ 1. `openspec/changes/<name>/` 目录已存在(由 openspec-new-change 创建)
20
+ 2. `openspec/changes/<name>/.comet.yaml` 文件不存在(尚未初始化)
21
+ 3. `openspec/changes/<name>/proposal.md` 存在且非空
22
+ 4. `openspec/changes/<name>/design.md` 存在且非空
23
+ 5. `openspec/changes/<name>/tasks.md` 存在且非空
24
+
25
+ **验证方式:**
26
+ - 读取以上路径确认存在/不存在
27
+ - 如 `.comet.yaml` 已存在,读取其 `phase` 字段:如 phase 不为空,输出 `[HARD STOP]` 并提示可能已有活跃 change
28
+
29
+ **失败输出:**
30
+ ```
31
+ [HARD STOP] Entry check failed for comet-open
32
+ Expected: .comet.yaml does not exist, proposal.md + design.md + tasks.md exist
33
+ Actual: phase=<实际值>, design_doc=<实际值> (或文件不存在)
34
+ Suggestion: Check if another change with the same name is already active.
35
+ ```
36
+
37
+ 验证通过后才进入步骤 1。
38
+
14
39
  ### 1. 探索想法
15
40
 
16
41
  **立即执行:** 使用 Skill 工具加载 `openspec-explore` 技能。禁止跳过此步骤。
@@ -19,13 +44,14 @@ description: "Comet 阶段 1:开启。用 /comet-open 调用。通过 OpenSpec
19
44
 
20
45
  ### 2. 创建 Change 结构
21
46
 
22
- **立即执行:** 使用 Skill 工具加载 `openspec-new-change` 技能(或 `openspec-propose` 如需先提建议)。
47
+ **立即执行:** 使用 Skill 工具加载 `openspec-new-change` 技能。若用户意图未明确、需要先形成建议,改为加载 `openspec-propose`。禁止跳过此步骤。
23
48
 
24
49
  确认以下产物已创建:
25
50
 
26
51
  ```
27
52
  openspec/changes/<name>/
28
53
  ├── .openspec.yaml
54
+ ├── .comet.yaml
29
55
  ├── proposal.md # Why + What:问题、目标、范围
30
56
  ├── design.md # How(高层):架构决策、方案选型
31
57
  └── tasks.md # 任务清单(勾选框)
@@ -47,27 +73,37 @@ cp openspec/specs/<capability>/spec.md openspec/changes/<name>/specs/<capability
47
73
  ```
48
74
 
49
75
  3. 在复制的 delta spec 中,按 delta 格式组织变更(`## ADDED`、`## MODIFIED`、`## REMOVED`)
50
- 4. 在 proposal.md 中注明 `基于已有 capability: <capability-name>`
51
-
52
- **好处**:避免从零编写 delta spec,确保增量修改有完整上下文。
76
+ 4. 在 proposal.md 中注明 `基于已有 capability: <capability-name>`
53
77
 
54
78
  ### 3. 初始化 Comet 状态
55
79
 
56
- 在 `openspec/changes/<name>/.openspec.yaml` 中写入或合并以下元数据:
80
+ 在 `openspec/changes/<name>/` 下创建独立的 `.comet.yaml` 文件:
57
81
 
58
82
  ```yaml
59
- comet:
60
- workflow: full
61
- phase: design
62
- design_doc: null
63
- plan: null
64
- build_mode: null
65
- verify_mode: null
66
- verify_result: pending
67
- verified_at: null
68
- archived: false
83
+ workflow: full
84
+ phase: design
85
+ design_doc: null
86
+ plan: null
87
+ build_mode: null
88
+ verify_mode: null
89
+ verify_result: pending
90
+ verified_at: null
91
+ archived: false
69
92
  ```
70
93
 
94
+ 【写入验证】创建完成后必须验证:
95
+ cat openspec/changes/<name>/.comet.yaml
96
+ 确认 workflow 行的值为 "full"
97
+ 确认 phase 行的值为 "design"
98
+ 确认 design_doc 行的值为 "null"
99
+ 确认 plan 行的值为 "null"
100
+ 确认 build_mode 行的值为 "null"
101
+ 确认 verify_mode 行的值为 "null"
102
+ 确认 verify_result 行的值为 "pending"
103
+ 确认 verified_at 行的值为 "null"
104
+ 确认 archived 行的值为 "false"
105
+ 如任一字段不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
106
+
71
107
  ### 4. 内容完整性检查
72
108
 
73
109
  确认三个文档内容完整:
@@ -21,6 +21,28 @@ Tweak 是 Comet 五阶段能力的预设工作流,不是独立的平行流程
21
21
 
22
22
  ## 流程(preset workflow,4 阶段)
23
23
 
24
+ ### 0. 入口状态验证(Entry Check)
25
+
26
+ 在执行任何操作之前,验证当前状态:
27
+
28
+ **检查清单:**
29
+ 1. `openspec/changes/<name>/` 目录不存在,或目录存在但 `.comet.yaml` 不存在(无冲突)
30
+
31
+ **验证方式:**
32
+ - `test -d openspec/changes/<name>` 检查目录
33
+ - 如目录存在,`test -f openspec/changes/<name>/.comet.yaml` 检查配置文件
34
+ - 如 `.comet.yaml` 已存在,读取 `phase` 检查是否为未完成的 tweak
35
+
36
+ **失败输出(有冲突):**
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=<实际值>
41
+ Suggestion: Pick a different change name, or check if an existing tweak is in progress.
42
+ ```
43
+
44
+ 验证通过后才进入流程步骤。
45
+
24
46
  执行链路:open → lightweight build → light verify → archive。Tweak 为每个阶段提供默认决策:精简开启、轻量构建、轻量验证、验证通过后归档。
25
47
 
26
48
  ### 1. 快速开启(preset open)
@@ -35,21 +57,33 @@ Tweak 是 Comet 五阶段能力的预设工作流,不是独立的平行流程
35
57
  - `tasks.md` — 不超过 3 个任务
36
58
  - **无需 delta spec**(除非变更改变了已有 spec 的验收场景;一旦需要 delta spec,升级为完整 `/comet`)
37
59
 
38
- 在 `openspec/changes/<name>/.openspec.yaml` 中写入或合并 tweak 状态:
60
+ 在 `openspec/changes/<name>/` 下创建独立的 `.comet.yaml` 文件:
39
61
 
40
62
  ```yaml
41
- comet:
42
- workflow: tweak
43
- phase: build
44
- design_doc: null
45
- plan: null
46
- build_mode: direct
47
- verify_mode: light
48
- verify_result: pending
49
- verified_at: null
50
- archived: false
63
+ workflow: tweak
64
+ phase: build
65
+ design_doc: null
66
+ plan: null
67
+ build_mode: direct
68
+ verify_mode: light
69
+ verify_result: pending
70
+ verified_at: null
71
+ archived: false
51
72
  ```
52
73
 
74
+ 【写入验证】创建完成后必须验证:
75
+ cat openspec/changes/<name>/.comet.yaml
76
+ 确认 workflow 行的值为 "tweak"
77
+ 确认 phase 行的值为 "build"
78
+ 确认 design_doc 行的值为 "null"
79
+ 确认 plan 行的值为 "null"
80
+ 确认 build_mode 行的值为 "direct"
81
+ 确认 verify_mode 行的值为 "light"
82
+ 确认 verify_result 行的值为 "pending"
83
+ 确认 verified_at 行的值为 "null"
84
+ 确认 archived 行的值为 "false"
85
+ 如任一字段不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
86
+
53
87
  ### 2. 轻量构建(preset build)
54
88
 
55
89
  使用 tweak 默认值:`build_mode: direct`。跳过 `superpowers:brainstorming` 和 `superpowers:writing-plans`。
@@ -73,11 +107,11 @@ comet:
73
107
 
74
108
  如规模评估进入完整验证路径,停止 tweak,升级为完整 `/comet`。
75
109
 
76
- 验证通过后,按 `/comet-verify` 的规则将 `comet.verify_result` 记录为 `pass`,归档前不得跳过该状态。
110
+ 验证通过后,按 `/comet-verify` 的规则将 `.comet.yaml` 的 `verify_result` 记录为 `pass`,归档前不得跳过该状态。
77
111
 
78
112
  ### 4. 归档(preset archive)
79
113
 
80
- 复用 `/comet-archive`。归档前必须满足 `comet.verify_result: pass`。
114
+ 复用 `/comet-archive`。归档前必须满足 `.comet.yaml` 中 `verify_result: pass`。
81
115
 
82
116
  **立即执行:** 使用 Skill 工具加载 `comet-archive` 技能进行归档。禁止跳过此步骤。
83
117
 
@@ -12,6 +12,29 @@ description: "Comet 阶段 4:验证与收尾。用 /comet-verify 调用。验
12
12
 
13
13
  ## 步骤
14
14
 
15
+ ### 0. 入口状态验证(Entry Check)
16
+
17
+ 在执行任何操作之前,读取并验证当前状态:
18
+
19
+ **检查清单:**
20
+ 1. `openspec/changes/<name>/.comet.yaml` 存在
21
+ 2. `phase` 字段的值为 `"verify"`
22
+ 3. `verify_result` 字段为 `"pending"` 或 null(尚未验证通过)
23
+
24
+ **验证方式:**
25
+ - `cat openspec/changes/<name>/.comet.yaml` 读取全部字段
26
+ - 如 `verify_result` 已是 `"pass"`,说明此 change 已验证过
27
+
28
+ **失败输出:**
29
+ ```
30
+ [HARD STOP] Entry check failed for comet-verify
31
+ Expected: phase=verify, verify_result=pending|null
32
+ Actual: phase=<实际值>, verify_result=<实际值>
33
+ Suggestion: Run comet-build first, or this change was already verified.
34
+ ```
35
+
36
+ 验证通过后才进入步骤 1。
37
+
15
38
  ### 1. 改动规模评估
16
39
 
17
40
  根据以下指标判定改动规模:
@@ -25,7 +48,7 @@ description: "Comet 阶段 4:验证与收尾。用 /comet-verify 调用。验
25
48
 
26
49
  **判定规则**:任一指标命中"大" → 完整验证。全部命中"小" → 轻量验证。
27
50
 
28
- 判定完成后,在 `openspec/changes/<name>/.openspec.yaml` 中记录实际验证模式。`verify_mode` 只允许以下值之一:
51
+ 判定完成后,在 `openspec/changes/<name>/.comet.yaml` 中记录实际验证模式。`verify_mode` 只允许以下值之一:
29
52
 
30
53
  - `light`
31
54
  - `full`
@@ -34,20 +57,23 @@ Few-shot 示例:
34
57
 
35
58
  ```yaml
36
59
  # 全部指标命中“小”
37
- comet:
38
- phase: verify
39
- verify_mode: light
40
- verify_result: pending
60
+ phase: verify
61
+ verify_mode: light
62
+ verify_result: pending
41
63
  ```
42
64
 
43
65
  ```yaml
44
- # 任一指标命中“大”
45
- comet:
46
- phase: verify
47
- verify_mode: full
48
- verify_result: pending
66
+ # 任一指标命中”大”
67
+ phase: verify
68
+ verify_mode: full
69
+ verify_result: pending
49
70
  ```
50
71
 
72
+ 【写入验证】更新完成后必须验证:
73
+ cat openspec/changes/<name>/.comet.yaml
74
+ 确认 verify_mode 行的值为 “<light 或 full>”
75
+ 如不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
76
+
51
77
  ### 2a. 轻量验证(小改动)
52
78
 
53
79
  当规模评估结果为"小"时,跳过 `openspec-verify-change`,直接执行以下检查:
@@ -113,18 +139,24 @@ comet:
113
139
 
114
140
  - 验证报告通过
115
141
  - 分支已处理
116
- - `.openspec.yaml` 中 `comet.verify_result` 已记录为 `pass`
142
+ - `.comet.yaml` 中 `verify_result` 已记录为 `pass`
117
143
  - **阶段守卫**:运行 `bash $COMET_GUARD <change-name> verify`,全部 PASS 后才允许流转
118
144
 
119
- 退出前合并更新:
145
+ 退出前在 `.comet.yaml` 中合并更新以下字段(保留其他字段不变):
120
146
 
121
147
  ```yaml
122
- comet:
123
- phase: archive
124
- verify_result: pass
125
- verified_at: YYYY-MM-DD
148
+ phase: archive
149
+ verify_result: pass
150
+ verified_at: YYYY-MM-DD
126
151
  ```
127
152
 
153
+ 【写入验证】更新完成后必须验证:
154
+ cat openspec/changes/<name>/.comet.yaml
155
+ 确认 phase 行的值为 "archive"
156
+ 确认 verify_result 行的值为 "pass"
157
+ 确认 verified_at 行的值非空(格式为 YYYY-MM-DD)
158
+ 如任一字段不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
159
+
128
160
  ## 自动流转
129
161
 
130
162
  退出条件满足后,**无需等待用户再次输入**,直接执行下一阶段:
package/bin/comet.js CHANGED
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
-
3
- import '../dist/cli/index.js';
1
+ #!/usr/bin/env node
2
+
3
+ import '../dist/cli/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpamis/comet",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "OpenSpec + Superpowers dual-star development workflow",
5
5
  "keywords": [
6
6
  "comet",
@@ -1,44 +1,44 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Postinstall script that hints about comet init.
5
- *
6
- * The tip is suppressed when:
7
- * - CI=true environment variable is set
8
- * - COMET_NO_HINTS=1 environment variable is set
9
- * - dist/ directory doesn't exist (dev setup scenario)
10
- */
11
-
12
- import { promises as fs } from 'fs';
13
- import path from 'path';
14
- import { fileURLToPath } from 'url';
15
-
16
- const __filename = fileURLToPath(import.meta.url);
17
- const __dirname = path.dirname(__filename);
18
-
19
- function shouldSkip() {
20
- if (process.env.CI === 'true' || process.env.CI === '1') return true;
21
- if (process.env.COMET_NO_HINTS === '1') return true;
22
- return false;
23
- }
24
-
25
- async function distExists() {
26
- try {
27
- const stat = await fs.stat(path.join(__dirname, '..', 'dist'));
28
- return stat.isDirectory();
29
- } catch {
30
- return false;
31
- }
32
- }
33
-
34
- async function main() {
35
- try {
36
- if (shouldSkip()) return;
37
- if (!(await distExists())) return;
38
- console.log(`\nTip: Run 'comet init' to set up Comet workflow in your project`);
39
- } catch {
40
- // Never break npm install
41
- }
42
- }
43
-
44
- main().catch(() => process.exit(0));
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Postinstall script that hints about comet init.
5
+ *
6
+ * The tip is suppressed when:
7
+ * - CI=true environment variable is set
8
+ * - COMET_NO_HINTS=1 environment variable is set
9
+ * - dist/ directory doesn't exist (dev setup scenario)
10
+ */
11
+
12
+ import { promises as fs } from 'fs';
13
+ import path from 'path';
14
+ import { fileURLToPath } from 'url';
15
+
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = path.dirname(__filename);
18
+
19
+ function shouldSkip() {
20
+ if (process.env.CI === 'true' || process.env.CI === '1') return true;
21
+ if (process.env.COMET_NO_HINTS === '1') return true;
22
+ return false;
23
+ }
24
+
25
+ async function distExists() {
26
+ try {
27
+ const stat = await fs.stat(path.join(__dirname, '..', 'dist'));
28
+ return stat.isDirectory();
29
+ } catch {
30
+ return false;
31
+ }
32
+ }
33
+
34
+ async function main() {
35
+ try {
36
+ if (shouldSkip()) return;
37
+ if (!(await distExists())) return;
38
+ console.log(`\nTip: Run 'comet init' to set up Comet workflow in your project`);
39
+ } catch {
40
+ // Never break npm install
41
+ }
42
+ }
43
+
44
+ main().catch(() => process.exit(0));