@rpamis/comet 0.2.3 → 0.2.4
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.
- package/README.md +34 -13
- package/assets/manifest.json +1 -1
- package/assets/skills/comet/SKILL.md +50 -14
- package/assets/skills/comet/scripts/comet-archive.sh +2 -2
- package/assets/skills/comet/scripts/comet-guard.sh +50 -48
- package/assets/skills/comet/scripts/comet-state.sh +158 -39
- package/assets/skills/comet/scripts/comet-yaml-validate.sh +9 -3
- package/assets/skills/comet-archive/SKILL.md +7 -4
- package/assets/skills/comet-build/SKILL.md +21 -6
- package/assets/skills/comet-design/SKILL.md +12 -19
- package/assets/skills/comet-hotfix/SKILL.md +36 -26
- package/assets/skills/comet-open/SKILL.md +19 -7
- package/assets/skills/comet-tweak/SKILL.md +23 -12
- package/assets/skills/comet-verify/SKILL.md +32 -7
- package/assets/skills-zh/comet/SKILL.md +64 -21
- package/assets/skills-zh/comet-archive/SKILL.md +7 -4
- package/assets/skills-zh/comet-build/SKILL.md +21 -6
- package/assets/skills-zh/comet-design/SKILL.md +12 -19
- package/assets/skills-zh/comet-hotfix/SKILL.md +42 -26
- package/assets/skills-zh/comet-open/SKILL.md +30 -16
- package/assets/skills-zh/comet-tweak/SKILL.md +29 -12
- package/assets/skills-zh/comet-verify/SKILL.md +46 -6
- package/package.json +2 -2
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
# init <change-name> <workflow> — Initialize .comet.yaml with workflow defaults
|
|
7
7
|
# get <change-name> <field> — Read a field value from .comet.yaml
|
|
8
8
|
# set <change-name> <field> <val> — Update a field value
|
|
9
|
-
#
|
|
9
|
+
# transition <change-name> <event> — Apply a validated state transition
|
|
10
|
+
# check <change-name> <phase> — Verify entry requirements for a phase
|
|
10
11
|
# scale <change-name> — Assess and set verification mode based on metrics
|
|
11
12
|
#
|
|
12
13
|
# Workflows: full, hotfix, tweak
|
|
@@ -77,6 +78,24 @@ file_nonempty() {
|
|
|
77
78
|
[ -f "$1" ] && [ -s "$1" ]
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
change_dir_for() {
|
|
82
|
+
local change_name="$1"
|
|
83
|
+
if [ -d "openspec/changes/$change_name" ]; then
|
|
84
|
+
echo "openspec/changes/$change_name"
|
|
85
|
+
elif [ -d "openspec/changes/archive/$change_name" ]; then
|
|
86
|
+
echo "openspec/changes/archive/$change_name"
|
|
87
|
+
else
|
|
88
|
+
echo "openspec/changes/$change_name"
|
|
89
|
+
fi
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
yaml_file_for() {
|
|
93
|
+
local change_name="$1"
|
|
94
|
+
local change_dir
|
|
95
|
+
change_dir=$(change_dir_for "$change_name")
|
|
96
|
+
echo "$change_dir/.comet.yaml"
|
|
97
|
+
}
|
|
98
|
+
|
|
80
99
|
# --- Subcommands ---
|
|
81
100
|
|
|
82
101
|
cmd_init() {
|
|
@@ -86,8 +105,9 @@ cmd_init() {
|
|
|
86
105
|
validate_change_name "$change_name"
|
|
87
106
|
validate_enum "$workflow" "full" "hotfix" "tweak"
|
|
88
107
|
|
|
89
|
-
local change_dir
|
|
90
|
-
|
|
108
|
+
local change_dir yaml_file
|
|
109
|
+
change_dir=$(change_dir_for "$change_name")
|
|
110
|
+
yaml_file=$(yaml_file_for "$change_name")
|
|
91
111
|
|
|
92
112
|
# Check if .comet.yaml already exists
|
|
93
113
|
if [ -f "$yaml_file" ]; then
|
|
@@ -100,16 +120,15 @@ cmd_init() {
|
|
|
100
120
|
|
|
101
121
|
# Set workflow-appropriate defaults
|
|
102
122
|
local phase build_mode isolation verify_mode
|
|
123
|
+
phase="open"
|
|
103
124
|
|
|
104
125
|
case "$workflow" in
|
|
105
126
|
full)
|
|
106
|
-
phase="design"
|
|
107
127
|
build_mode="null"
|
|
108
128
|
isolation="null"
|
|
109
129
|
verify_mode="null"
|
|
110
130
|
;;
|
|
111
131
|
hotfix|tweak)
|
|
112
|
-
phase="build"
|
|
113
132
|
build_mode="direct"
|
|
114
133
|
isolation="branch"
|
|
115
134
|
verify_mode="light"
|
|
@@ -126,6 +145,8 @@ verify_mode: $verify_mode
|
|
|
126
145
|
design_doc: null
|
|
127
146
|
plan: null
|
|
128
147
|
verify_result: pending
|
|
148
|
+
verification_report: null
|
|
149
|
+
branch_status: pending
|
|
129
150
|
verified_at: null
|
|
130
151
|
archived: false
|
|
131
152
|
EOF
|
|
@@ -139,8 +160,8 @@ cmd_get() {
|
|
|
139
160
|
|
|
140
161
|
validate_change_name "$change_name"
|
|
141
162
|
|
|
142
|
-
local
|
|
143
|
-
|
|
163
|
+
local yaml_file
|
|
164
|
+
yaml_file=$(yaml_file_for "$change_name")
|
|
144
165
|
|
|
145
166
|
# Check if .comet.yaml exists
|
|
146
167
|
if [ ! -f "$yaml_file" ]; then
|
|
@@ -161,8 +182,8 @@ cmd_set() {
|
|
|
161
182
|
|
|
162
183
|
validate_change_name "$change_name"
|
|
163
184
|
|
|
164
|
-
local
|
|
165
|
-
|
|
185
|
+
local yaml_file
|
|
186
|
+
yaml_file=$(yaml_file_for "$change_name")
|
|
166
187
|
|
|
167
188
|
# Check if .comet.yaml exists
|
|
168
189
|
if [ ! -f "$yaml_file" ]; then
|
|
@@ -172,12 +193,12 @@ cmd_set() {
|
|
|
172
193
|
|
|
173
194
|
# Validate field name
|
|
174
195
|
case "$field" in
|
|
175
|
-
workflow|phase|build_mode|isolation|verify_mode|verify_result|archived|design_doc|plan|verified_at)
|
|
196
|
+
workflow|phase|build_mode|isolation|verify_mode|verify_result|verification_report|branch_status|archived|design_doc|plan|verified_at)
|
|
176
197
|
# Valid field
|
|
177
198
|
;;
|
|
178
199
|
*)
|
|
179
200
|
red "ERROR: Unknown field: '$field'" >&2
|
|
180
|
-
red "Valid fields: workflow, phase, design_doc, plan, build_mode, isolation, verify_mode, verify_result, verified_at, archived" >&2
|
|
201
|
+
red "Valid fields: workflow, phase, design_doc, plan, build_mode, isolation, verify_mode, verify_result, verification_report, branch_status, verified_at, archived" >&2
|
|
181
202
|
exit 1
|
|
182
203
|
;;
|
|
183
204
|
esac
|
|
@@ -188,7 +209,7 @@ cmd_set() {
|
|
|
188
209
|
validate_enum "$value" "full" "hotfix" "tweak"
|
|
189
210
|
;;
|
|
190
211
|
phase)
|
|
191
|
-
validate_enum "$value" "design" "build" "verify" "archive"
|
|
212
|
+
validate_enum "$value" "open" "design" "build" "verify" "archive"
|
|
192
213
|
;;
|
|
193
214
|
build_mode)
|
|
194
215
|
validate_enum "$value" "subagent-driven-development" "executing-plans" "direct"
|
|
@@ -202,10 +223,13 @@ cmd_set() {
|
|
|
202
223
|
verify_result)
|
|
203
224
|
validate_enum "$value" "pending" "pass" "fail"
|
|
204
225
|
;;
|
|
226
|
+
branch_status)
|
|
227
|
+
validate_enum "$value" "pending" "handled"
|
|
228
|
+
;;
|
|
205
229
|
archived)
|
|
206
230
|
validate_enum "$value" "true" "false"
|
|
207
231
|
;;
|
|
208
|
-
design_doc|plan|verified_at)
|
|
232
|
+
design_doc|plan|verification_report|verified_at)
|
|
209
233
|
# No validation for path fields and date fields
|
|
210
234
|
;;
|
|
211
235
|
esac
|
|
@@ -222,6 +246,85 @@ cmd_set() {
|
|
|
222
246
|
green "[SET] ${field}=${value}"
|
|
223
247
|
}
|
|
224
248
|
|
|
249
|
+
require_phase() {
|
|
250
|
+
local change_name="$1"
|
|
251
|
+
local expected="$2"
|
|
252
|
+
local actual
|
|
253
|
+
actual=$(cmd_get "$change_name" "phase")
|
|
254
|
+
if [ "$actual" != "$expected" ]; then
|
|
255
|
+
red "ERROR: Cannot transition '$change_name': expected phase ${expected}, got ${actual}" >&2
|
|
256
|
+
exit 1
|
|
257
|
+
fi
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
require_verification_evidence() {
|
|
261
|
+
local change_name="$1"
|
|
262
|
+
local report branch_status
|
|
263
|
+
report=$(cmd_get "$change_name" "verification_report")
|
|
264
|
+
branch_status=$(cmd_get "$change_name" "branch_status")
|
|
265
|
+
|
|
266
|
+
if [ -z "$report" ] || [ "$report" = "null" ] || [ ! -f "$report" ]; then
|
|
267
|
+
red "ERROR: Cannot transition '$change_name': verification_report must point to an existing report file" >&2
|
|
268
|
+
exit 1
|
|
269
|
+
fi
|
|
270
|
+
|
|
271
|
+
if [ "$branch_status" != "handled" ]; then
|
|
272
|
+
red "ERROR: Cannot transition '$change_name': branch_status must be handled" >&2
|
|
273
|
+
exit 1
|
|
274
|
+
fi
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
cmd_transition() {
|
|
278
|
+
local change_name="$1"
|
|
279
|
+
local event="$2"
|
|
280
|
+
|
|
281
|
+
validate_change_name "$change_name"
|
|
282
|
+
validate_enum "$event" "open-complete" "design-complete" "build-complete" "verify-pass" "verify-fail" "archived"
|
|
283
|
+
|
|
284
|
+
case "$event" in
|
|
285
|
+
open-complete)
|
|
286
|
+
require_phase "$change_name" "open"
|
|
287
|
+
local workflow
|
|
288
|
+
workflow=$(cmd_get "$change_name" "workflow")
|
|
289
|
+
if [ "$workflow" = "full" ]; then
|
|
290
|
+
cmd_set "$change_name" phase design
|
|
291
|
+
else
|
|
292
|
+
cmd_set "$change_name" phase build
|
|
293
|
+
fi
|
|
294
|
+
;;
|
|
295
|
+
design-complete)
|
|
296
|
+
require_phase "$change_name" "design"
|
|
297
|
+
cmd_set "$change_name" phase build
|
|
298
|
+
;;
|
|
299
|
+
build-complete)
|
|
300
|
+
require_phase "$change_name" "build"
|
|
301
|
+
cmd_set "$change_name" phase verify
|
|
302
|
+
cmd_set "$change_name" verify_result pending
|
|
303
|
+
cmd_set "$change_name" verification_report null
|
|
304
|
+
cmd_set "$change_name" branch_status pending
|
|
305
|
+
;;
|
|
306
|
+
verify-pass)
|
|
307
|
+
require_phase "$change_name" "verify"
|
|
308
|
+
require_verification_evidence "$change_name"
|
|
309
|
+
cmd_set "$change_name" verify_result pass
|
|
310
|
+
cmd_set "$change_name" phase archive
|
|
311
|
+
cmd_set "$change_name" verified_at "$(date +%Y-%m-%d)"
|
|
312
|
+
;;
|
|
313
|
+
verify-fail)
|
|
314
|
+
require_phase "$change_name" "verify"
|
|
315
|
+
cmd_set "$change_name" verify_result fail
|
|
316
|
+
cmd_set "$change_name" phase build
|
|
317
|
+
cmd_set "$change_name" branch_status pending
|
|
318
|
+
;;
|
|
319
|
+
archived)
|
|
320
|
+
require_phase "$change_name" "archive"
|
|
321
|
+
cmd_set "$change_name" archived true
|
|
322
|
+
;;
|
|
323
|
+
esac
|
|
324
|
+
|
|
325
|
+
green "[TRANSITION] ${event}"
|
|
326
|
+
}
|
|
327
|
+
|
|
225
328
|
# --- Check helpers for entry verification ---
|
|
226
329
|
|
|
227
330
|
CHECK_BLOCK=0
|
|
@@ -283,8 +386,8 @@ check_file_not_exists() {
|
|
|
283
386
|
}
|
|
284
387
|
|
|
285
388
|
cmd_check() {
|
|
286
|
-
local
|
|
287
|
-
local
|
|
389
|
+
local change_name="$1"
|
|
390
|
+
local phase="$2"
|
|
288
391
|
|
|
289
392
|
validate_change_name "$change_name"
|
|
290
393
|
validate_enum "$phase" "open" "design" "build" "verify" "archive"
|
|
@@ -297,21 +400,17 @@ cmd_check() {
|
|
|
297
400
|
|
|
298
401
|
echo "=== Entry Check: comet-${phase} ==="
|
|
299
402
|
|
|
300
|
-
#
|
|
301
|
-
if [
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
exit 1
|
|
305
|
-
fi
|
|
403
|
+
# .comet.yaml must exist for all phases (state machine core)
|
|
404
|
+
if [ ! -f "$yaml_file" ]; then
|
|
405
|
+
red "ERROR: .comet.yaml not found at $yaml_file"
|
|
406
|
+
exit 1
|
|
306
407
|
fi
|
|
307
408
|
|
|
308
409
|
# Phase-specific checks
|
|
309
410
|
case "$phase" in
|
|
310
411
|
open)
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
check_nonempty "design.md" "$design_file"
|
|
314
|
-
check_nonempty "tasks.md" "$tasks_file"
|
|
412
|
+
check_pass ".comet.yaml exists"
|
|
413
|
+
check_yaml_is "phase" "open" "$change_name"
|
|
315
414
|
;;
|
|
316
415
|
design)
|
|
317
416
|
check_pass ".comet.yaml exists"
|
|
@@ -325,13 +424,19 @@ cmd_check() {
|
|
|
325
424
|
build)
|
|
326
425
|
check_pass ".comet.yaml exists"
|
|
327
426
|
check_yaml_is "phase" "build" "$change_name"
|
|
328
|
-
#
|
|
329
|
-
local
|
|
330
|
-
|
|
331
|
-
if [
|
|
332
|
-
|
|
427
|
+
# design_doc required for full workflow only
|
|
428
|
+
local workflow
|
|
429
|
+
workflow=$(cmd_get "$change_name" "workflow")
|
|
430
|
+
if [ "$workflow" = "full" ]; then
|
|
431
|
+
local design_doc
|
|
432
|
+
design_doc=$(cmd_get "$change_name" "design_doc")
|
|
433
|
+
if [ -n "$design_doc" ] && [ "$design_doc" != "null" ] && [ -f "$design_doc" ]; then
|
|
434
|
+
check_pass "design_doc=${design_doc} (file exists)"
|
|
435
|
+
else
|
|
436
|
+
check_fail "design_doc=${design_doc} (expected: non-null and file exists)"
|
|
437
|
+
fi
|
|
333
438
|
else
|
|
334
|
-
|
|
439
|
+
check_pass "workflow=${workflow} (design_doc not required)"
|
|
335
440
|
fi
|
|
336
441
|
check_nonempty "proposal.md" "$proposal_file"
|
|
337
442
|
check_nonempty "tasks.md" "$tasks_file"
|
|
@@ -405,14 +510,19 @@ cmd_scale() {
|
|
|
405
510
|
delta_spec_count=$(find "$change_dir/specs" -name "spec.md" -type f 2>/dev/null | wc -l | tr -d ' ')
|
|
406
511
|
fi
|
|
407
512
|
|
|
408
|
-
# 3. Changed files:
|
|
513
|
+
# 3. Changed files: prefer plan base-ref, fall back to worktree diff
|
|
409
514
|
local changed_files=0
|
|
410
515
|
if git rev-parse --git-dir > /dev/null 2>&1; then
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
516
|
+
local plan_file base_ref
|
|
517
|
+
plan_file=$(cmd_get "$change_name" "plan" 2>/dev/null || true)
|
|
518
|
+
if [ -n "$plan_file" ] && [ "$plan_file" != "null" ] && [ -f "$plan_file" ]; then
|
|
519
|
+
base_ref=$(grep '^base-ref:' "$plan_file" 2>/dev/null | head -1 | sed 's/^base-ref: *//')
|
|
520
|
+
fi
|
|
521
|
+
|
|
522
|
+
if [ -n "${base_ref:-}" ] && git rev-parse --verify "$base_ref" >/dev/null 2>&1; then
|
|
523
|
+
changed_files=$(git diff --name-only "$base_ref"...HEAD 2>/dev/null | wc -l | tr -d ' ')
|
|
524
|
+
else
|
|
525
|
+
changed_files=$(git diff --name-only HEAD 2>/dev/null | wc -l | tr -d ' ')
|
|
416
526
|
fi
|
|
417
527
|
fi
|
|
418
528
|
|
|
@@ -463,9 +573,17 @@ case "$SUBCOMMAND" in
|
|
|
463
573
|
fi
|
|
464
574
|
cmd_set "$@"
|
|
465
575
|
;;
|
|
576
|
+
transition)
|
|
577
|
+
if [ $# -lt 2 ]; then
|
|
578
|
+
red "Usage: comet-state.sh transition <change-name> <event>" >&2
|
|
579
|
+
red "Events: open-complete, design-complete, build-complete, verify-pass, verify-fail, archived" >&2
|
|
580
|
+
exit 1
|
|
581
|
+
fi
|
|
582
|
+
cmd_transition "$@"
|
|
583
|
+
;;
|
|
466
584
|
check)
|
|
467
585
|
if [ $# -lt 2 ]; then
|
|
468
|
-
red "Usage: comet-state.sh check <
|
|
586
|
+
red "Usage: comet-state.sh check <change-name> <phase>" >&2
|
|
469
587
|
red "Phases: open, design, build, verify, archive" >&2
|
|
470
588
|
exit 1
|
|
471
589
|
fi
|
|
@@ -487,7 +605,8 @@ case "$SUBCOMMAND" in
|
|
|
487
605
|
echo " init <change-name> <workflow> — Initialize .comet.yaml with workflow defaults" >&2
|
|
488
606
|
echo " get <change-name> <field> — Read a field value from .comet.yaml" >&2
|
|
489
607
|
echo " set <change-name> <field> <val> — Update a field value in .comet.yaml" >&2
|
|
490
|
-
echo "
|
|
608
|
+
echo " transition <change-name> <event> — Apply a validated state transition" >&2
|
|
609
|
+
echo " check <change-name> <phase> — Verify entry requirements for a phase" >&2
|
|
491
610
|
echo " scale <change-name> — Assess and set verification mode based on metrics" >&2
|
|
492
611
|
echo "" >&2
|
|
493
612
|
echo "Workflows: full, hotfix, tweak" >&2
|
|
@@ -33,7 +33,11 @@ validate_change_name() {
|
|
|
33
33
|
validate_change_name "$1"
|
|
34
34
|
|
|
35
35
|
CHANGE="$1"
|
|
36
|
-
|
|
36
|
+
CHANGE_DIR="openspec/changes/$CHANGE"
|
|
37
|
+
if [ ! -d "$CHANGE_DIR" ] && [ -d "openspec/changes/archive/$CHANGE" ]; then
|
|
38
|
+
CHANGE_DIR="openspec/changes/archive/$CHANGE"
|
|
39
|
+
fi
|
|
40
|
+
YAML="$CHANGE_DIR/.comet.yaml"
|
|
37
41
|
|
|
38
42
|
ERRORS=0
|
|
39
43
|
WARNINGS=0
|
|
@@ -81,16 +85,18 @@ build_mode=$(field_value "build_mode")
|
|
|
81
85
|
isolation=$(field_value "isolation")
|
|
82
86
|
verify_mode=$(field_value "verify_mode")
|
|
83
87
|
verify_result=$(field_value "verify_result")
|
|
88
|
+
branch_status=$(field_value "branch_status")
|
|
84
89
|
archived=$(field_value "archived")
|
|
85
90
|
design_doc=$(field_value "design_doc")
|
|
86
91
|
plan=$(field_value "plan")
|
|
87
92
|
|
|
88
93
|
validate_enum "workflow" "$workflow" "full hotfix tweak"
|
|
89
|
-
validate_enum "phase" "$phase" "design build verify archive"
|
|
94
|
+
validate_enum "phase" "$phase" "open design build verify archive"
|
|
90
95
|
validate_enum "build_mode" "$build_mode" "subagent-driven-development executing-plans direct"
|
|
91
96
|
validate_enum "isolation" "$isolation" "branch worktree"
|
|
92
97
|
validate_enum "verify_mode" "$verify_mode" "light full"
|
|
93
98
|
validate_enum "verify_result" "$verify_result" "pending pass fail"
|
|
99
|
+
validate_enum "branch_status" "$branch_status" "pending handled"
|
|
94
100
|
validate_enum "archived" "$archived" "true false"
|
|
95
101
|
|
|
96
102
|
# --- Path validation ---
|
|
@@ -108,7 +114,7 @@ if [ -n "$plan" ] && [ "$plan" != "null" ]; then
|
|
|
108
114
|
fi
|
|
109
115
|
|
|
110
116
|
# --- Unknown keys check ---
|
|
111
|
-
KNOWN_KEYS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verified_at archived"
|
|
117
|
+
KNOWN_KEYS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verification_report branch_status verified_at archived"
|
|
112
118
|
while IFS=: read -r key _; do
|
|
113
119
|
key="${key// /}"
|
|
114
120
|
[ -z "$key" ] && continue
|
|
@@ -18,7 +18,8 @@ description: "Comet Phase 5: Archive. Invoke with /comet-archive. Sync delta spe
|
|
|
18
18
|
Execute entry verification:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
|
|
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)}"
|
|
22
23
|
bash "$COMET_STATE" check <name> archive
|
|
23
24
|
```
|
|
24
25
|
|
|
@@ -29,7 +30,6 @@ Proceed to Step 1 after verification passes. The script outputs specific failure
|
|
|
29
30
|
Run the archive script to automatically complete all steps:
|
|
30
31
|
|
|
31
32
|
```bash
|
|
32
|
-
COMET_ARCHIVE="${COMET_ARCHIVE:-$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)}"
|
|
33
33
|
bash "$COMET_ARCHIVE" "<change-name>"
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -39,7 +39,7 @@ The script automatically executes:
|
|
|
39
39
|
3. Design doc frontmatter annotation (archived-with, status)
|
|
40
40
|
4. Plan frontmatter annotation (archived-with)
|
|
41
41
|
5. Move change to archive directory
|
|
42
|
-
6. Update archived: true
|
|
42
|
+
6. Update `archived: true` through `comet-state transition <archive-name> archived`
|
|
43
43
|
|
|
44
44
|
If script returns non-zero exit code, report error and stop.
|
|
45
45
|
If script returns zero exit code, archive is complete.
|
|
@@ -56,7 +56,10 @@ brainstorming → delta spec → implementation → verification → main spec o
|
|
|
56
56
|
## Exit Conditions
|
|
57
57
|
|
|
58
58
|
- Archive script executed successfully (exit code 0)
|
|
59
|
-
-
|
|
59
|
+
- Archive directory `openspec/changes/archive/YYYY-MM-DD-<change-name>/` exists
|
|
60
|
+
- Archived `.comet.yaml` contains `archived: true`
|
|
61
|
+
|
|
62
|
+
The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`. After successful archive, do not run `bash "$COMET_GUARD" <change-name> archive` against the old active change name; the active directory no longer exists. Archive completeness is determined by the script exit code and archived directory state.
|
|
60
63
|
|
|
61
64
|
## Complete
|
|
62
65
|
|
|
@@ -17,7 +17,9 @@ description: "Comet Phase 3: Plan and Build. Invoke with /comet-build. Create pl
|
|
|
17
17
|
Execute entry verification:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
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)}"
|
|
21
23
|
bash "$COMET_STATE" check <name> build
|
|
22
24
|
```
|
|
23
25
|
|
|
@@ -36,9 +38,16 @@ After the skill loads, follow its guidance to create a plan. Plan requirements:
|
|
|
36
38
|
---
|
|
37
39
|
change: <openspec-change-name>
|
|
38
40
|
design-doc: docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md
|
|
41
|
+
base-ref: <git rev-parse HEAD before implementation>
|
|
39
42
|
---
|
|
40
43
|
```
|
|
41
44
|
|
|
45
|
+
`base-ref` is used during verification to measure committed changes across the full implementation range. Record the current commit when creating the plan:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git rev-parse HEAD
|
|
49
|
+
```
|
|
50
|
+
|
|
42
51
|
### 2. Update Plan Status
|
|
43
52
|
|
|
44
53
|
Record plan path:
|
|
@@ -127,21 +136,27 @@ When the initial spec is found incomplete during implementation, handle by scale
|
|
|
127
136
|
- Delta spec is a living document, can be modified at any time during this phase
|
|
128
137
|
- Each update should be committed with commit message explaining the change reason
|
|
129
138
|
- Do not sync to main spec in advance, sync uniformly during archiving
|
|
130
|
-
- If incremental tasks exceed 50% of initial tasks.md total task count, consider splitting into new change
|
|
131
139
|
- For small-scale incremental direct delta spec edits, note in commit message to facilitate design doc drift assessment during archiving
|
|
132
140
|
|
|
141
|
+
### 6. Context Management
|
|
142
|
+
|
|
143
|
+
Build is the longest phase and may span many tasks. To support resume after context compaction:
|
|
144
|
+
|
|
145
|
+
- **After each task**: immediately check off tasks.md and commit code so `.comet.yaml` and file state are durable
|
|
146
|
+
- **After context compaction**: read `.comet.yaml` to confirm the phase is still build, read the plan header `base-ref`, then read tasks.md to find the next unchecked task
|
|
147
|
+
- **Long task split**: if a single task exceeds 200 lines of code changes, consider splitting it into multiple subtasks and commits
|
|
148
|
+
|
|
133
149
|
## Exit Conditions
|
|
134
150
|
|
|
135
151
|
- All tasks.md checked
|
|
136
152
|
- Code committed
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
- **Phase guard**: Run `bash $COMET_GUARD <change-name> build`, allow transition only after all PASS
|
|
153
|
+
- Project-specific build/tests explicitly run and pass; do not rely only on guard auto-detection
|
|
154
|
+
- **Phase guard**: Run `bash "$COMET_GUARD" <change-name> build --apply`; after all PASS, state advances to `phase: verify`
|
|
140
155
|
|
|
141
156
|
Before exit, run guard to auto-transition:
|
|
142
157
|
|
|
143
158
|
```bash
|
|
144
|
-
bash $COMET_GUARD <change-name> build --apply
|
|
159
|
+
bash "$COMET_GUARD" <change-name> build --apply
|
|
145
160
|
```
|
|
146
161
|
|
|
147
162
|
State file is automatically updated to `phase: verify`, `verify_result: pending`.
|
|
@@ -17,7 +17,9 @@ description: "Comet Phase 2: Deep Design. Invoke with /comet-design. Produce Des
|
|
|
17
17
|
Execute entry verification:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
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)}"
|
|
21
23
|
bash "$COMET_STATE" check <name> design
|
|
22
24
|
```
|
|
23
25
|
|
|
@@ -57,32 +59,23 @@ Record design_doc path, then run guard to auto-transition:
|
|
|
57
59
|
bash "$COMET_STATE" set <name> design_doc docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
58
60
|
|
|
59
61
|
# Auto-transition to next phase
|
|
60
|
-
bash $COMET_GUARD <change-name> design --apply
|
|
62
|
+
bash "$COMET_GUARD" <change-name> design --apply
|
|
61
63
|
```
|
|
62
64
|
|
|
63
65
|
State file is updated automatically. No manual editing of other fields required.
|
|
64
66
|
|
|
65
|
-
### 3. Dual Spec Division of Labor
|
|
66
|
-
|
|
67
|
-
| Spec Type | Belongs To | Location | Definition |
|
|
68
|
-
|-----------|-----------|----------|------------|
|
|
69
|
-
| Capability specification | OpenSpec | `openspec/changes/<name>/specs/` | What the system should do (requirements + acceptance scenarios) |
|
|
70
|
-
| Design document | Superpowers | `docs/superpowers/specs/` | How to build (technical architecture + implementation details) |
|
|
71
|
-
|
|
72
|
-
### 4. Document Hierarchy Confirmation
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
proposal.md (Phase 1) → Why + What
|
|
76
|
-
design.md (Phase 1, OpenSpec) → High-level architectural decisions
|
|
77
|
-
Design document (Phase 2, Superpowers) → Deep technical design
|
|
78
|
-
Capability specification (Phase 2, delta) → Requirements + acceptance scenarios
|
|
79
|
-
```
|
|
80
|
-
|
|
81
67
|
## Exit Conditions
|
|
82
68
|
|
|
83
69
|
- Design Doc has been created and saved
|
|
84
70
|
- Delta spec has been created if there are new capabilities
|
|
85
|
-
-
|
|
71
|
+
- `design_doc` written to `.comet.yaml`
|
|
72
|
+
- **Phase guard**: Run `bash "$COMET_GUARD" <change-name> design --apply`; after all PASS, state advances to `phase: build`
|
|
73
|
+
|
|
74
|
+
You must use `--apply` before exiting:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bash "$COMET_GUARD" <change-name> design --apply
|
|
78
|
+
```
|
|
86
79
|
|
|
87
80
|
## Automatic Transition
|
|
88
81
|
|
|
@@ -5,14 +5,12 @@ description: "Comet preset path: Bug fix / hotfix. Skip brainstorming, directly
|
|
|
5
5
|
|
|
6
6
|
# Comet Preset Path: Hotfix
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Applicable for bug fixes, hotfixes, small-scale behavior corrections. Does not involve new capability design, does not require deep brainstorming.
|
|
8
|
+
Quick bug fix workflow: open → build → verify → archive. Skip brainstorming and full plan, applicable for behavior fixes not involving new capability design.
|
|
11
9
|
|
|
12
10
|
**Applicable conditions** (all must be met):
|
|
13
11
|
1. Fix bugs in existing functionality, no new capability
|
|
14
12
|
2. No interface changes or architecture adjustments
|
|
15
|
-
3. Change scope is predictable (usually
|
|
13
|
+
3. Change scope is predictable (usually ≤ 2 files)
|
|
16
14
|
|
|
17
15
|
**Not applicable**: If fix process discovers need for architecture adjustments, should upgrade to full `/comet` workflow.
|
|
18
16
|
|
|
@@ -20,19 +18,17 @@ Applicable for bug fixes, hotfixes, small-scale behavior corrections. Does not i
|
|
|
20
18
|
|
|
21
19
|
## Process (preset workflow, 4 phases)
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
Execution chain: open → build → verify → archive. Hotfix provides default decisions for each phase: streamlined open, direct build, scale-based verification, archive after verification passes.
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Locate Comet scripts before starting:
|
|
26
24
|
|
|
27
25
|
```bash
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
COMET_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
|
|
27
|
+
COMET_STATE="${COMET_STATE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-state.sh' -type f -print -quit 2>/dev/null)}"
|
|
28
|
+
COMET_GUARD="${COMET_GUARD:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-guard.sh' -type f -print -quit 2>/dev/null)}"
|
|
29
|
+
COMET_ARCHIVE="${COMET_ARCHIVE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-archive.sh' -type f -print -quit 2>/dev/null)}"
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Proceed to process steps after verification passes. The script outputs specific failure reasons when verification fails.
|
|
33
|
-
|
|
34
|
-
Execution chain: open → build → verify → archive. Hotfix provides default decisions for each phase: streamlined open, direct build, scale-based verification, archive after verification passes.
|
|
35
|
-
|
|
36
32
|
### 1. Quick Open (preset open)
|
|
37
33
|
|
|
38
34
|
Reuse Comet open capability to create change, but use hotfix defaults: do not execute `openspec-explore` long exploration, directly enter streamlined change creation.
|
|
@@ -51,6 +47,12 @@ Initialize Comet state file:
|
|
|
51
47
|
bash "$COMET_STATE" init <name> hotfix
|
|
52
48
|
```
|
|
53
49
|
|
|
50
|
+
Run phase guard to transition open → build:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bash "$COMET_GUARD" <change-name> open --apply
|
|
54
|
+
```
|
|
55
|
+
|
|
54
56
|
### 2. Direct Build (preset build)
|
|
55
57
|
|
|
56
58
|
Use hotfix defaults: `build_mode: direct`. Skip `superpowers:brainstorming` and `superpowers:writing-plans` (unless tasks > 3; if exceeds 3 tasks, transfer to `/comet-build`'s plan and execution method selection).
|
|
@@ -64,30 +66,38 @@ Use hotfix defaults: `build_mode: direct`. Skip `superpowers:brainstorming` and
|
|
|
64
66
|
- Run related tests to confirm pass
|
|
65
67
|
- Check corresponding `- [ ]` to `- [x]` in tasks.md
|
|
66
68
|
- Commit code, commit message format: `fix: <brief fix description>`
|
|
67
|
-
3. After all tasks complete,
|
|
69
|
+
3. After all tasks complete, explicitly run relevant project tests and build commands
|
|
70
|
+
4. Run phase guard to transition build → verify:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
bash "$COMET_GUARD" <change-name> build --apply
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
State automatically updates to `phase: verify`, `verify_result: pending`, then enter verification.
|
|
68
77
|
|
|
69
78
|
**If fix affects existing spec acceptance scenarios**:
|
|
70
79
|
- Create delta spec in `openspec/changes/<name>/specs/<capability>/spec.md`
|
|
71
80
|
- Only include `## MODIFIED Requirements` section
|
|
72
81
|
|
|
73
|
-
###
|
|
82
|
+
### 3a. Hotfix-Exclusive Check: Root Cause Elimination
|
|
74
83
|
|
|
75
|
-
|
|
84
|
+
**Execute before loading comet-verify**, ensuring the fix actually eliminates the root cause:
|
|
76
85
|
|
|
77
|
-
|
|
86
|
+
1. Read bug description and root cause in proposal.md
|
|
87
|
+
2. Search and verify problem code no longer exists
|
|
88
|
+
3. If root cause not eliminated, return to Step 2 to continue fix
|
|
78
89
|
|
|
79
|
-
|
|
90
|
+
**Upgrade conditions**:
|
|
91
|
+
- Root cause check reveals deep architecture issues → Stop hotfix, upgrade to `/comet`
|
|
92
|
+
- Fix requires additional interface changes → Stop hotfix, upgrade to `/comet`
|
|
80
93
|
|
|
81
|
-
|
|
94
|
+
### 3b. Verification (preset verify)
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
- Read bug description and root cause in proposal.md
|
|
85
|
-
- Search and verify problem code no longer exists
|
|
86
|
-
- If root cause not eliminated, return to Step 2 to continue fix
|
|
96
|
+
After root cause elimination check passes, reuse `/comet-verify`, with comet-verify's scale assessment deciding lightweight or full verification.
|
|
87
97
|
|
|
88
|
-
**
|
|
89
|
-
|
|
90
|
-
-
|
|
98
|
+
**Immediately execute:** Use the Skill tool to load the `comet-verify` skill. Skipping this step is prohibited.
|
|
99
|
+
|
|
100
|
+
Small-scale hotfixes without delta spec usually meet lightweight verification conditions (≤ 3 tasks, ≤ 2 files), comet-verify's scale assessment will select lightweight verification path (5 quick checks). If hotfix created delta spec, enter full verification path according to comet-verify's scale assessment rules.
|
|
91
101
|
|
|
92
102
|
After verification passes, record `.comet.yaml` `verify_result` as `pass` according to `/comet-verify` rules, must not skip this status before archiving.
|
|
93
103
|
|
|
@@ -133,4 +143,4 @@ Upgrade method: On current change basis, supplement Design Doc (execute `/comet-
|
|
|
133
143
|
- Bug fixed, tests pass
|
|
134
144
|
- Change archived
|
|
135
145
|
- If spec changes, synced to main spec
|
|
136
|
-
- **Phase guard**: Before build → verify run `bash $COMET_GUARD <change-name> build
|
|
146
|
+
- **Phase guard**: Before build → verify run `bash "$COMET_GUARD" <change-name> build --apply`; before verify → archive follow `/comet-verify` and run `bash "$COMET_GUARD" <change-name> verify --apply`
|