@rpamis/comet 0.3.4 → 0.3.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.
- package/LICENSE +21 -21
- package/README.md +14 -2
- package/assets/skills/comet/SKILL.md +40 -22
- package/assets/skills/comet/scripts/comet-archive.sh +4 -2
- package/assets/skills/comet/scripts/comet-env.sh +57 -2
- package/assets/skills/comet/scripts/comet-guard.sh +14 -12
- package/assets/skills/comet/scripts/comet-handoff.sh +4 -2
- package/assets/skills/comet/scripts/comet-state.sh +185 -4
- package/assets/skills/comet/scripts/comet-yaml-validate.sh +3 -1
- package/assets/skills/comet-archive/SKILL.md +3 -3
- package/assets/skills/comet-build/SKILL.md +52 -19
- package/assets/skills/comet-design/SKILL.md +24 -12
- package/assets/skills/comet-hotfix/SKILL.md +9 -9
- package/assets/skills/comet-open/SKILL.md +29 -5
- package/assets/skills/comet-tweak/SKILL.md +9 -9
- package/assets/skills/comet-verify/SKILL.md +33 -19
- package/assets/skills-zh/comet/SKILL.md +40 -22
- package/assets/skills-zh/comet-archive/SKILL.md +3 -3
- package/assets/skills-zh/comet-build/SKILL.md +52 -19
- package/assets/skills-zh/comet-design/SKILL.md +24 -12
- package/assets/skills-zh/comet-hotfix/SKILL.md +9 -9
- package/assets/skills-zh/comet-open/SKILL.md +29 -5
- package/assets/skills-zh/comet-tweak/SKILL.md +9 -9
- package/assets/skills-zh/comet-verify/SKILL.md +33 -19
- package/bin/comet.js +3 -3
- package/package.json +1 -1
- package/scripts/postinstall.js +44 -44
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
# set <change-name> <field> <val> — Update a field value
|
|
9
9
|
# transition <change-name> <event> — Apply a validated state transition
|
|
10
10
|
# check <change-name> <phase> — Verify entry requirements for a phase
|
|
11
|
+
# check <change-name> <phase> --recover — Output structured recovery context for compaction resume
|
|
11
12
|
# scale <change-name> — Assess and set verification mode based on metrics
|
|
12
13
|
#
|
|
13
14
|
# Workflows: full, hotfix, tweak
|
|
@@ -204,6 +205,7 @@ cmd_init() {
|
|
|
204
205
|
workflow: $workflow
|
|
205
206
|
phase: $phase
|
|
206
207
|
build_mode: $build_mode
|
|
208
|
+
build_pause: null
|
|
207
209
|
isolation: $isolation
|
|
208
210
|
verify_mode: $verify_mode
|
|
209
211
|
base_ref: $base_ref
|
|
@@ -263,13 +265,13 @@ cmd_set() {
|
|
|
263
265
|
yellow "WARNING: Setting 'phase' directly bypasses state machine constraints." >&2
|
|
264
266
|
yellow " Consider using: comet-state.sh transition <change-name> <event>" >&2
|
|
265
267
|
;;
|
|
266
|
-
workflow|build_mode|isolation|verify_mode|verify_result|verification_report|branch_status|archived|design_doc|plan|verified_at|created_at|direct_override|build_command|verify_command|handoff_context|handoff_hash|base_ref)
|
|
268
|
+
workflow|build_mode|build_pause|isolation|verify_mode|verify_result|verification_report|branch_status|archived|design_doc|plan|verified_at|created_at|direct_override|build_command|verify_command|handoff_context|handoff_hash|base_ref)
|
|
267
269
|
# Valid field
|
|
268
270
|
;;
|
|
269
271
|
*)
|
|
270
272
|
red "ERROR: Unknown field: '$field'" >&2
|
|
271
273
|
red "Valid fields:" >&2
|
|
272
|
-
red " workflow, phase, design_doc, plan, build_mode, isolation," >&2
|
|
274
|
+
red " workflow, phase, design_doc, plan, build_mode, build_pause, isolation," >&2
|
|
273
275
|
red " verify_mode, verify_result, verification_report, branch_status," >&2
|
|
274
276
|
red " verified_at, created_at, archived, base_ref, direct_override," >&2
|
|
275
277
|
red " build_command, verify_command, handoff_context, handoff_hash" >&2
|
|
@@ -288,6 +290,9 @@ cmd_set() {
|
|
|
288
290
|
build_mode)
|
|
289
291
|
validate_enum "$value" "subagent-driven-development" "executing-plans" "direct"
|
|
290
292
|
;;
|
|
293
|
+
build_pause)
|
|
294
|
+
validate_enum "$value" "null" "plan-ready"
|
|
295
|
+
;;
|
|
291
296
|
isolation)
|
|
292
297
|
validate_enum "$value" "branch" "worktree"
|
|
293
298
|
;;
|
|
@@ -589,6 +594,177 @@ cmd_check() {
|
|
|
589
594
|
fi
|
|
590
595
|
}
|
|
591
596
|
|
|
597
|
+
# --- Recovery context for compaction resume ---
|
|
598
|
+
|
|
599
|
+
field_status() {
|
|
600
|
+
# Args: field_name value [file_path]
|
|
601
|
+
# Prints: "field_name: DONE (value)" or "field_name: PENDING"
|
|
602
|
+
local field="$1"
|
|
603
|
+
local value="$2"
|
|
604
|
+
local file_path="${3:-}"
|
|
605
|
+
|
|
606
|
+
if [ -z "$value" ] || [ "$value" = "null" ]; then
|
|
607
|
+
echo " - ${field}: PENDING"
|
|
608
|
+
elif [ -n "$file_path" ] && [ ! -f "$file_path" ]; then
|
|
609
|
+
echo " - ${field}: BROKEN (path ${value} does not exist)"
|
|
610
|
+
else
|
|
611
|
+
echo " - ${field}: DONE (${value})"
|
|
612
|
+
fi
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
cmd_recover() {
|
|
616
|
+
local change_name="$1"
|
|
617
|
+
|
|
618
|
+
validate_change_name "$change_name"
|
|
619
|
+
|
|
620
|
+
local change_dir="openspec/changes/$change_name"
|
|
621
|
+
local yaml_file="$change_dir/.comet.yaml"
|
|
622
|
+
|
|
623
|
+
if [ ! -f "$yaml_file" ]; then
|
|
624
|
+
red "ERROR: .comet.yaml not found at $yaml_file"
|
|
625
|
+
exit 1
|
|
626
|
+
fi
|
|
627
|
+
|
|
628
|
+
local phase workflow
|
|
629
|
+
phase=$(cmd_get "$change_name" "phase")
|
|
630
|
+
workflow=$(cmd_get "$change_name" "workflow")
|
|
631
|
+
|
|
632
|
+
echo "=== Recovery Context: ${change_name} ==="
|
|
633
|
+
echo "Phase: ${phase}"
|
|
634
|
+
echo "Workflow: ${workflow}"
|
|
635
|
+
echo ""
|
|
636
|
+
|
|
637
|
+
# Read all relevant fields
|
|
638
|
+
local design_doc plan verify_result verify_mode verification_report
|
|
639
|
+
local branch_status handoff_context handoff_hash isolation build_mode build_pause direct_override
|
|
640
|
+
design_doc=$(cmd_get "$change_name" "design_doc")
|
|
641
|
+
plan=$(cmd_get "$change_name" "plan")
|
|
642
|
+
verify_result=$(cmd_get "$change_name" "verify_result")
|
|
643
|
+
verify_mode=$(cmd_get "$change_name" "verify_mode")
|
|
644
|
+
verification_report=$(cmd_get "$change_name" "verification_report")
|
|
645
|
+
branch_status=$(cmd_get "$change_name" "branch_status")
|
|
646
|
+
handoff_context=$(cmd_get "$change_name" "handoff_context")
|
|
647
|
+
handoff_hash=$(cmd_get "$change_name" "handoff_hash")
|
|
648
|
+
isolation=$(cmd_get "$change_name" "isolation")
|
|
649
|
+
build_mode=$(cmd_get "$change_name" "build_mode")
|
|
650
|
+
build_pause=$(cmd_get "$change_name" "build_pause" 2>/dev/null || true)
|
|
651
|
+
direct_override=$(cmd_get "$change_name" "direct_override" 2>/dev/null || true)
|
|
652
|
+
|
|
653
|
+
echo "State fields:"
|
|
654
|
+
|
|
655
|
+
# Phase-specific field reporting
|
|
656
|
+
case "$phase" in
|
|
657
|
+
open)
|
|
658
|
+
echo " Artifacts:"
|
|
659
|
+
for f in proposal.md design.md tasks.md; do
|
|
660
|
+
if file_nonempty "$change_dir/$f"; then
|
|
661
|
+
echo " - ${f}: DONE"
|
|
662
|
+
else
|
|
663
|
+
echo " - ${f}: PENDING"
|
|
664
|
+
fi
|
|
665
|
+
done
|
|
666
|
+
echo ""
|
|
667
|
+
echo "Recovery action: Create or complete missing artifacts, then use AskUserQuestion for user confirmation."
|
|
668
|
+
;;
|
|
669
|
+
design)
|
|
670
|
+
echo " Artifacts:"
|
|
671
|
+
for f in proposal.md design.md tasks.md; do
|
|
672
|
+
if file_nonempty "$change_dir/$f"; then
|
|
673
|
+
echo " - ${f}: DONE"
|
|
674
|
+
else
|
|
675
|
+
echo " - ${f}: MISSING (unexpected in design phase)"
|
|
676
|
+
fi
|
|
677
|
+
done
|
|
678
|
+
echo ""
|
|
679
|
+
echo " Design progress:"
|
|
680
|
+
field_status "handoff_context" "$handoff_context" "$handoff_context"
|
|
681
|
+
field_status "handoff_hash" "$handoff_hash"
|
|
682
|
+
field_status "design_doc" "$design_doc" "$design_doc"
|
|
683
|
+
echo ""
|
|
684
|
+
if [ -n "$design_doc" ] && [ "$design_doc" != "null" ] && [ -f "$design_doc" ]; then
|
|
685
|
+
echo "Recovery action: Design Doc already created and linked. Run guard to transition to build."
|
|
686
|
+
elif [ -n "$handoff_context" ] && [ "$handoff_context" != "null" ] && [ -f "$handoff_context" ]; then
|
|
687
|
+
echo "Recovery action: Handoff generated but Design Doc not yet created. Resume from brainstorming confirmation (Step 1c)."
|
|
688
|
+
else
|
|
689
|
+
echo "Recovery action: No handoff generated yet. Start from Step 1a (generate handoff package)."
|
|
690
|
+
fi
|
|
691
|
+
;;
|
|
692
|
+
build)
|
|
693
|
+
echo " Build decisions:"
|
|
694
|
+
field_status "isolation" "$isolation"
|
|
695
|
+
field_status "build_mode" "$build_mode"
|
|
696
|
+
field_status "build_pause" "$build_pause"
|
|
697
|
+
if [ "$build_mode" = "direct" ] && [ "$workflow" != "hotfix" ] && [ "$workflow" != "tweak" ]; then
|
|
698
|
+
field_status "direct_override" "$direct_override"
|
|
699
|
+
fi
|
|
700
|
+
echo ""
|
|
701
|
+
echo " Plan:"
|
|
702
|
+
field_status "plan" "$plan" "$plan"
|
|
703
|
+
echo ""
|
|
704
|
+
# Count completed vs pending tasks
|
|
705
|
+
local tasks_file="$change_dir/tasks.md"
|
|
706
|
+
local total=0 done=0 pending=0
|
|
707
|
+
if [ -f "$tasks_file" ]; then
|
|
708
|
+
total=$(grep -c '^\- \[' "$tasks_file" 2>/dev/null || echo "0")
|
|
709
|
+
done=$(grep -c '^\- \[x\]' "$tasks_file" 2>/dev/null || echo "0")
|
|
710
|
+
pending=$((total - done))
|
|
711
|
+
echo " Tasks: ${done}/${total} done, ${pending} pending"
|
|
712
|
+
else
|
|
713
|
+
echo " Tasks: tasks.md MISSING"
|
|
714
|
+
fi
|
|
715
|
+
echo ""
|
|
716
|
+
if [ "$build_pause" = "plan-ready" ] && [ -n "$plan" ] && [ "$plan" != "null" ] && [ -f "$plan" ] && { [ "$isolation" = "null" ] || [ -z "$isolation" ] || [ "$build_mode" = "null" ] || [ -z "$build_mode" ]; }; then
|
|
717
|
+
echo "Recovery action: Plan-ready pause detected. Ask the user whether to continue, then choose isolation and build mode without regenerating the plan."
|
|
718
|
+
elif [ "$build_pause" = "plan-ready" ] && { [ -z "$plan" ] || [ "$plan" = "null" ] || [ ! -f "$plan" ]; }; then
|
|
719
|
+
echo "Recovery action: Plan-ready pause is recorded, but the plan file is missing. Restore the plan file or rerun writing-plans before choosing execution."
|
|
720
|
+
elif [ "$build_pause" = "plan-ready" ]; then
|
|
721
|
+
echo "Recovery action: Plan-ready pause is stale because build decisions are already selected. Clear build_pause to null, then continue from the first unchecked task."
|
|
722
|
+
elif [ "$isolation" = "null" ] || [ -z "$isolation" ]; then
|
|
723
|
+
echo "Recovery action: Isolation not selected. Use AskUserQuestion to ask user for branch/worktree choice."
|
|
724
|
+
elif [ "$build_mode" = "null" ] || [ -z "$build_mode" ]; then
|
|
725
|
+
echo "Recovery action: Build mode not selected. Use AskUserQuestion to ask user for execution method."
|
|
726
|
+
elif [ ! -f "$tasks_file" ]; then
|
|
727
|
+
echo "Recovery action: tasks.md missing. Verify change directory integrity."
|
|
728
|
+
elif [ "$pending" -gt 0 ]; then
|
|
729
|
+
echo "Recovery action: Read tasks.md and continue from first unchecked task."
|
|
730
|
+
else
|
|
731
|
+
echo "Recovery action: All tasks done. Run guard to transition to verify."
|
|
732
|
+
fi
|
|
733
|
+
;;
|
|
734
|
+
verify)
|
|
735
|
+
echo " Verification:"
|
|
736
|
+
field_status "verify_result" "$verify_result"
|
|
737
|
+
field_status "verify_mode" "$verify_mode"
|
|
738
|
+
field_status "verification_report" "$verification_report" "$verification_report"
|
|
739
|
+
field_status "branch_status" "$branch_status"
|
|
740
|
+
echo ""
|
|
741
|
+
if [ "$verify_result" = "pass" ] && [ "$branch_status" = "handled" ]; then
|
|
742
|
+
echo "Recovery action: Verification complete. Run guard to transition to archive."
|
|
743
|
+
elif [ "$verify_result" = "pass" ]; then
|
|
744
|
+
echo "Recovery action: Verification passed but branch not yet handled. Complete branch handling and set branch_status to handled."
|
|
745
|
+
elif [ "$verify_result" = "fail" ]; then
|
|
746
|
+
echo "Recovery action: Verification failed and rolled back to build. Resume from /comet-build."
|
|
747
|
+
else
|
|
748
|
+
echo "Recovery action: Verification not yet started or in progress. Run scale assessment then verify."
|
|
749
|
+
fi
|
|
750
|
+
;;
|
|
751
|
+
archive)
|
|
752
|
+
echo " Archive:"
|
|
753
|
+
field_status "verify_result" "$verify_result"
|
|
754
|
+
field_status "archived" "$(cmd_get "$change_name" "archived")"
|
|
755
|
+
echo ""
|
|
756
|
+
echo "Recovery action: Run /comet-archive to complete archiving."
|
|
757
|
+
;;
|
|
758
|
+
*)
|
|
759
|
+
red "ERROR: Unknown phase: $phase"
|
|
760
|
+
exit 1
|
|
761
|
+
;;
|
|
762
|
+
esac
|
|
763
|
+
|
|
764
|
+
echo ""
|
|
765
|
+
echo "=== End Recovery Context ==="
|
|
766
|
+
}
|
|
767
|
+
|
|
592
768
|
cmd_scale() {
|
|
593
769
|
local change_name="$1"
|
|
594
770
|
|
|
@@ -694,11 +870,16 @@ case "$SUBCOMMAND" in
|
|
|
694
870
|
;;
|
|
695
871
|
check)
|
|
696
872
|
if [ $# -lt 2 ]; then
|
|
697
|
-
red "Usage: comet-state.sh check <change-name> <phase>" >&2
|
|
873
|
+
red "Usage: comet-state.sh check <change-name> <phase> [--recover]" >&2
|
|
698
874
|
red "Phases: open, design, build, verify, archive" >&2
|
|
699
875
|
exit 1
|
|
700
876
|
fi
|
|
701
|
-
|
|
877
|
+
# Detect --recover flag (3rd argument)
|
|
878
|
+
if [ "${3:-}" = "--recover" ]; then
|
|
879
|
+
cmd_recover "$1"
|
|
880
|
+
else
|
|
881
|
+
cmd_check "$@"
|
|
882
|
+
fi
|
|
702
883
|
;;
|
|
703
884
|
scale)
|
|
704
885
|
if [ $# -lt 1 ]; then
|
|
@@ -126,6 +126,7 @@ validate_enum() {
|
|
|
126
126
|
workflow=$(field_value "workflow")
|
|
127
127
|
phase=$(field_value "phase")
|
|
128
128
|
build_mode=$(field_value "build_mode")
|
|
129
|
+
build_pause=$(field_value "build_pause")
|
|
129
130
|
isolation=$(field_value "isolation")
|
|
130
131
|
verify_mode=$(field_value "verify_mode")
|
|
131
132
|
verify_result=$(field_value "verify_result")
|
|
@@ -140,6 +141,7 @@ handoff_hash=$(field_value "handoff_hash")
|
|
|
140
141
|
validate_enum "workflow" "$workflow" "full hotfix tweak"
|
|
141
142
|
validate_enum "phase" "$phase" "open design build verify archive"
|
|
142
143
|
validate_enum "build_mode" "$build_mode" "subagent-driven-development executing-plans direct"
|
|
144
|
+
validate_enum "build_pause" "$build_pause" "null plan-ready"
|
|
143
145
|
validate_enum "isolation" "$isolation" "branch worktree"
|
|
144
146
|
validate_enum "verify_mode" "$verify_mode" "light full"
|
|
145
147
|
validate_enum "verify_result" "$verify_result" "pending pass fail"
|
|
@@ -174,7 +176,7 @@ if [ -n "$handoff_hash" ] && [ "$handoff_hash" != "null" ]; then
|
|
|
174
176
|
fi
|
|
175
177
|
|
|
176
178
|
# --- Unknown keys check ---
|
|
177
|
-
KNOWN_KEYS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verification_report branch_status verified_at created_at archived direct_override build_command verify_command handoff_context handoff_hash base_ref"
|
|
179
|
+
KNOWN_KEYS="workflow phase design_doc plan build_mode build_pause isolation verify_mode verify_result verification_report branch_status verified_at created_at archived direct_override build_command verify_command handoff_context handoff_hash base_ref"
|
|
178
180
|
while IFS=: read -r key _; do
|
|
179
181
|
key="${key// /}"
|
|
180
182
|
[ -z "$key" ] && continue
|
|
@@ -24,7 +24,7 @@ if [ -z "$COMET_ENV" ]; then
|
|
|
24
24
|
return 1
|
|
25
25
|
fi
|
|
26
26
|
. "$COMET_ENV"
|
|
27
|
-
|
|
27
|
+
"$COMET_BASH" "$COMET_STATE" check <name> archive
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
@@ -34,7 +34,7 @@ Proceed to Step 1 after verification passes. The script outputs specific failure
|
|
|
34
34
|
Run the archive script to automatically complete all steps:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
|
|
37
|
+
"$COMET_BASH" "$COMET_ARCHIVE" "<change-name>"
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
The script automatically executes:
|
|
@@ -66,7 +66,7 @@ brainstorming → delta spec → implementation → verification → main spec o
|
|
|
66
66
|
- Archive directory `openspec/changes/archive/YYYY-MM-DD-<change-name>/` exists
|
|
67
67
|
- Archived `.comet.yaml` contains `archived: true`
|
|
68
68
|
|
|
69
|
-
The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`. After successful archive, **do not run** `
|
|
69
|
+
The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`. After successful archive, **do not run** `"$COMET_BASH" "$COMET_GUARD" <change-name> archive` against the old active change name; the active directory no longer exists. Archive completeness is determined by script exit code and archived directory state.
|
|
70
70
|
|
|
71
71
|
## Complete
|
|
72
72
|
|
|
@@ -23,14 +23,16 @@ if [ -z "$COMET_ENV" ]; then
|
|
|
23
23
|
return 1
|
|
24
24
|
fi
|
|
25
25
|
. "$COMET_ENV"
|
|
26
|
-
|
|
26
|
+
"$COMET_BASH" "$COMET_STATE" check <name> build
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
30
30
|
|
|
31
|
+
**Idempotency**: All build phase operations can be safely re-executed. Read `.comet.yaml` `phase` field to confirm still in build, read plan header `base-ref`, then read tasks.md to find the first unchecked task. Already-committed tasks must not be re-committed.
|
|
32
|
+
|
|
31
33
|
### 1. Create Plan
|
|
32
34
|
|
|
33
|
-
**Immediately execute:** Use the Skill tool to load the `
|
|
35
|
+
**Immediately execute:** Use the Skill tool to load the Superpowers `writing-plans` skill. Skipping this step is prohibited.
|
|
34
36
|
|
|
35
37
|
After the skill loads, follow its guidance to create a plan. Plan requirements:
|
|
36
38
|
- Save to `docs/superpowers/plans/YYYY-MM-DD-<feature>.md`
|
|
@@ -51,18 +53,49 @@ base-ref: <git rev-parse HEAD before implementation>
|
|
|
51
53
|
git rev-parse HEAD
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
### 2. Update Plan Status
|
|
56
|
+
### 2. Update Plan Status and Provide Plan-Ready Pause Point
|
|
55
57
|
|
|
56
58
|
Record plan path:
|
|
57
59
|
|
|
58
60
|
```bash
|
|
59
|
-
|
|
61
|
+
"$COMET_BASH" "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
No manual phase update needed — guard auto-transitions when exit conditions are met.
|
|
63
65
|
|
|
66
|
+
After the plan is recorded, immediately provide a new user decision point:
|
|
67
|
+
|
|
68
|
+
| Option | Behavior | Description |
|
|
69
|
+
|--------|----------|-------------|
|
|
70
|
+
| A | Continue execution | Stay in the current model and proceed to Step 3 to choose workspace isolation and execution method |
|
|
71
|
+
| B | Pause to switch model | Record `build_pause: plan-ready`, stop this `/comet-build` invocation, and allow the user to resume later from `/comet` or `/comet-build` |
|
|
72
|
+
|
|
73
|
+
This is a user decision point. **Must use the AskUserQuestion tool to pause and wait for the user to explicitly choose**. Must not auto-continue and must not write the pause into `build_mode`.
|
|
74
|
+
|
|
75
|
+
When the user chooses to continue:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_pause null
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
When the user chooses to pause:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_pause plan-ready
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
After setting `build_pause: plan-ready`, stop the current invocation. Do not choose `isolation` or `build_mode`, and do not load an execution skill.
|
|
88
|
+
|
|
64
89
|
### 3. Select Workflow Configuration
|
|
65
90
|
|
|
91
|
+
If resuming with `build_pause: plan-ready` and the `plan` file exists, do not rerun `writing-plans`. First tell the user the workflow is stopped at the plan-ready pause point; after the user confirms continuing, set:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_pause null
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Then continue this step to choose workspace isolation and execution method.
|
|
98
|
+
|
|
66
99
|
Plan has been written to the current branch. Before starting execution, **ask the user to choose both workspace isolation and execution method in a single interaction**:
|
|
67
100
|
|
|
68
101
|
**Workspace Isolation**:
|
|
@@ -80,21 +113,21 @@ Plan has been written to the current branch. Before starting execution, **ask th
|
|
|
80
113
|
|
|
81
114
|
| Option | Skill | Applicable Scenario |
|
|
82
115
|
|------|------|-------------------|
|
|
83
|
-
| A | `
|
|
84
|
-
| B | `
|
|
116
|
+
| A | Superpowers `subagent-driven-development` | Independent tasks, high complexity, requires two-phase review |
|
|
117
|
+
| B | Superpowers `executing-plans` | Simple tasks, no subagent environment, lightweight and fast |
|
|
85
118
|
|
|
86
119
|
**Execution method recommendation rules**:
|
|
87
120
|
- Task count ≥ 3 → Recommend A
|
|
88
121
|
- Task count ≤ 2 and no cross-module dependencies → Recommend B
|
|
89
122
|
- From hotfix path → Recommend B
|
|
90
123
|
|
|
91
|
-
This is a user decision point. Must pause and wait for the user to explicitly choose both isolation method and execution method
|
|
124
|
+
This is a user decision point. **Must use the AskUserQuestion tool to pause and wait for the user to explicitly choose both isolation method and execution method**. Must not choose `branch` or `worktree` based on recommendation rules, and must not choose the execution method based on recommendation rules. Recommendation rules are for suggestion only, not a substitute for user confirmation. Must not just output a text prompt and then continue executing.
|
|
92
125
|
|
|
93
126
|
After user selection, update `isolation` and `build_mode` fields:
|
|
94
127
|
|
|
95
128
|
```bash
|
|
96
|
-
|
|
97
|
-
|
|
129
|
+
"$COMET_BASH" "$COMET_STATE" set <name> isolation <branch|worktree>
|
|
130
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
|
|
98
131
|
```
|
|
99
132
|
|
|
100
133
|
`isolation` is a script-enforced hard constraint. Full workflow init may temporarily leave it as `null`, but only before this step. If it remains `null`, both the `build → verify` guard and `comet-state transition build-complete` will fail.
|
|
@@ -102,8 +135,8 @@ bash "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing
|
|
|
102
135
|
`build_mode` defaults to `direct` only for hotfix/tweak presets. Full workflow must not default to `direct`. Use it only when the user explicitly asks to bypass the plan execution skills and you record an explicit override:
|
|
103
136
|
|
|
104
137
|
```bash
|
|
105
|
-
|
|
106
|
-
|
|
138
|
+
"$COMET_BASH" "$COMET_STATE" set <name> direct_override true
|
|
139
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_mode direct
|
|
107
140
|
```
|
|
108
141
|
|
|
109
142
|
Without `direct_override: true`, `build_mode=direct` in full workflow is blocked by both guard and state transition.
|
|
@@ -111,7 +144,7 @@ Without `direct_override: true`, `build_mode=direct` in full workflow is blocked
|
|
|
111
144
|
**Execute isolation**:
|
|
112
145
|
|
|
113
146
|
- **branch**: Run `git checkout -b <change-name>`, subsequent work on the new branch
|
|
114
|
-
- **worktree**: Must use the Skill tool to load `
|
|
147
|
+
- **worktree**: Must use the Skill tool to load the Superpowers `using-git-worktrees` skill to create isolated workspace. Do not bypass this skill with plain shell commands or native tools; if the skill is unavailable, stop the process and prompt to install or enable Superpowers skills.
|
|
115
148
|
|
|
116
149
|
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed).
|
|
117
150
|
|
|
@@ -131,10 +164,10 @@ When the initial spec is found incomplete during implementation, handle by scale
|
|
|
131
164
|
| Scale | Trigger Conditions | Approach |
|
|
132
165
|
|------|-------------------|----------|
|
|
133
166
|
| Small | Missing acceptance scenarios, edge cases | Directly edit delta spec + design.md, append tasks.md tasks |
|
|
134
|
-
| Medium | Interface changes, new components, data flow changes |
|
|
135
|
-
| Large | Brand-new capability requirements | Must pause and wait for user
|
|
167
|
+
| Medium | Interface changes, new components, data flow changes | **Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm**, then must use Skill tool to load the Superpowers `brainstorming` skill to update Design Doc + delta spec |
|
|
168
|
+
| Large | Brand-new capability requirements | **Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm the split**; after user confirms, create independent change through `/comet-open` |
|
|
136
169
|
|
|
137
|
-
**50% Threshold Determination**: Using initial task count in tasks.md as baseline, if new tasks exceed half of that total, it's considered outside original plan scope, must pause and wait for the user to decide whether to split into new change.
|
|
170
|
+
**50% Threshold Determination**: Using initial task count in tasks.md as baseline, if new tasks exceed half of that total, it's considered outside original plan scope, **must use the AskUserQuestion tool to pause and wait for the user to decide whether to split into a new change**. Must not just output a text prompt and then continue executing.
|
|
138
171
|
|
|
139
172
|
When creating an independent change, must invoke `/comet-open`, not `/opsx:new` directly. `/comet-open` creates both OpenSpec artifacts and `.comet.yaml`, preventing the new change from leaving the Comet state machine.
|
|
140
173
|
|
|
@@ -149,7 +182,7 @@ When creating an independent change, must invoke `/comet-open`, not `/opsx:new`
|
|
|
149
182
|
Build is the longest phase and may span many tasks. To support resume after context compaction:
|
|
150
183
|
|
|
151
184
|
- **After each task**: immediately check off tasks.md and commit code so `.comet.yaml` and file state are durable
|
|
152
|
-
- **After context compaction**:
|
|
185
|
+
- **After context compaction**: first run `"$COMET_BASH" "$COMET_STATE" check <change-name> build --recover` — the script outputs structured recovery context (isolation/build_mode status, plan path, task progress, recovery action). Follow the Recovery action to determine next step.
|
|
153
186
|
- **User manual-change resume**: handle uncommitted changes through `comet/reference/dirty-worktree.md`. That protocol defines checks, attribution, and prohibitions. Build-specific handling:
|
|
154
187
|
1. After attribution, if the diff implies plan or spec changes, handle it through Step 4 "Spec Incremental Updates"
|
|
155
188
|
- **Long task split**: if a single task exceeds 200 lines of code changes, consider splitting it into multiple subtasks and commits
|
|
@@ -161,7 +194,7 @@ Build is the longest phase and may span many tasks. To support resume after cont
|
|
|
161
194
|
- Project-specific build/tests explicitly run and pass; do not rely only on guard auto-detection
|
|
162
195
|
- `isolation` has been written as `branch` or `worktree`
|
|
163
196
|
- `build_mode` has been written as `subagent-driven-development`, `executing-plans`, or `direct` with explicit override
|
|
164
|
-
- **Phase guard**: Run `
|
|
197
|
+
- **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`; after all PASS, state advances to `phase: verify`
|
|
165
198
|
|
|
166
199
|
Guard reads project command configuration first:
|
|
167
200
|
|
|
@@ -176,13 +209,13 @@ Only when no command is configured does guard fall back to `npm run build`, Mave
|
|
|
176
209
|
Before exit, run guard to auto-transition:
|
|
177
210
|
|
|
178
211
|
```bash
|
|
179
|
-
|
|
212
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply
|
|
180
213
|
```
|
|
181
214
|
|
|
182
215
|
State file is automatically updated to `phase: verify`, `verify_result: pending`.
|
|
183
216
|
|
|
184
217
|
## Automatic Transition
|
|
185
218
|
|
|
186
|
-
After exit conditions are met
|
|
219
|
+
After exit conditions are met (including user selecting workflow configuration), auto-transition to next phase:
|
|
187
220
|
|
|
188
221
|
> **REQUIRED NEXT SKILL:** Invoke `comet-verify` skill to enter the verification and completion phase.
|
|
@@ -23,17 +23,19 @@ if [ -z "$COMET_ENV" ]; then
|
|
|
23
23
|
return 1
|
|
24
24
|
fi
|
|
25
25
|
. "$COMET_ENV"
|
|
26
|
-
|
|
26
|
+
"$COMET_BASH" "$COMET_STATE" check <name> design
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
30
30
|
|
|
31
|
+
**Idempotency**: All design phase operations can be safely re-executed. If `handoff_context` and `handoff_hash` already exist, confirm they match current artifacts before deciding whether to regenerate.
|
|
32
|
+
|
|
31
33
|
### 1a. Generate OpenSpec → Superpowers Handoff Package
|
|
32
34
|
|
|
33
35
|
**Must be generated by script. Agent writing summaries on the fly is not allowed.**
|
|
34
36
|
|
|
35
37
|
```bash
|
|
36
|
-
|
|
38
|
+
"$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
The script generates and records:
|
|
@@ -58,7 +60,7 @@ The default handoff package is a **compact traceable excerpt**, not an agent sum
|
|
|
58
60
|
If full context is genuinely needed, explicitly run:
|
|
59
61
|
|
|
60
62
|
```bash
|
|
61
|
-
|
|
63
|
+
"$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write --full
|
|
62
64
|
```
|
|
63
65
|
|
|
64
66
|
Handoff package sources come from OpenSpec open phase artifacts:
|
|
@@ -69,7 +71,7 @@ Handoff package sources come from OpenSpec open phase artifacts:
|
|
|
69
71
|
|
|
70
72
|
### 1b. Execute Brainstorming (with Context)
|
|
71
73
|
|
|
72
|
-
**Immediately execute:** Use the Skill tool to load the `
|
|
74
|
+
**Immediately execute:** Use the Skill tool to load the Superpowers `brainstorming` skill, ARGUMENTS containing:
|
|
73
75
|
|
|
74
76
|
```
|
|
75
77
|
Change: <change-name>
|
|
@@ -92,7 +94,7 @@ Skip redundant context exploration, proceed directly to design questions.
|
|
|
92
94
|
|
|
93
95
|
Skipping this step is prohibited. Proceeding without loading this skill is prohibited.
|
|
94
96
|
|
|
95
|
-
If `
|
|
97
|
+
If the Superpowers `brainstorming` skill is unavailable, stop the process and prompt to install or enable Superpowers skills. Do not substitute this step with normal conversation.
|
|
96
98
|
|
|
97
99
|
After the skill loads, follow its guidance to produce design proposals (presented as conversation):
|
|
98
100
|
- Technical approach: architecture, data flow, key technology choices and risks
|
|
@@ -103,7 +105,7 @@ The brainstorming phase does not write to the Design Doc file; it only produces
|
|
|
103
105
|
|
|
104
106
|
### 1c. User Confirms Design Proposal (Blocking Point)
|
|
105
107
|
|
|
106
|
-
After brainstorming produces a design proposal, **must pause and wait for the user to explicitly confirm the design proposal**. Must not create the final Design Doc, write `design_doc`, run design guard, or enter `/comet-build` before user confirmation.
|
|
108
|
+
After brainstorming produces a design proposal, **must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm the design proposal**. Must not create the final Design Doc, write `design_doc`, run design guard, or enter `/comet-build` before user confirmation. Must not just output a text prompt and then continue executing.
|
|
107
109
|
|
|
108
110
|
When pausing, only present essential summary:
|
|
109
111
|
- Technical approach adopted
|
|
@@ -119,13 +121,13 @@ First record the design_doc path. If Step 1c wrote back delta spec (added or mod
|
|
|
119
121
|
|
|
120
122
|
```bash
|
|
121
123
|
# Record design_doc path
|
|
122
|
-
|
|
124
|
+
"$COMET_BASH" "$COMET_STATE" set <name> design_doc docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
123
125
|
|
|
124
126
|
# If delta spec changes exist, regenerate handoff (update hash)
|
|
125
|
-
|
|
127
|
+
"$COMET_BASH" "$COMET_HANDOFF" <change-name> design --write
|
|
126
128
|
|
|
127
129
|
# Auto-transition to next phase
|
|
128
|
-
|
|
130
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply
|
|
129
131
|
```
|
|
130
132
|
|
|
131
133
|
If there are no delta spec changes, skip the handoff regeneration step. The state file updates automatically; no manual editing of other fields needed.
|
|
@@ -139,16 +141,26 @@ If there are no delta spec changes, skip the handoff regeneration step. The stat
|
|
|
139
141
|
- `design-context.md` must be script-generated and contain source path, mode, sha256 traceability markers (enforced by guard)
|
|
140
142
|
- If new capabilities or supplementary acceptance scenarios exist, OpenSpec delta spec has been created/updated
|
|
141
143
|
- `design_doc` written to `.comet.yaml`
|
|
142
|
-
- **Phase guard**: Run `
|
|
144
|
+
- **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply`; after all PASS, auto-transitions to `phase: build`
|
|
143
145
|
|
|
144
146
|
Must use `--apply` before exit:
|
|
145
147
|
|
|
146
148
|
```bash
|
|
147
|
-
|
|
149
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> design --apply
|
|
148
150
|
```
|
|
149
151
|
|
|
152
|
+
## Context Compaction Recovery
|
|
153
|
+
|
|
154
|
+
The design phase may trigger context compaction during brainstorming. To recover, first run:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
"$COMET_BASH" "$COMET_STATE" check <change-name> design --recover
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The script outputs structured recovery context (phase, completed fields, pending fields, recovery action). Follow the Recovery action to determine next step.
|
|
161
|
+
|
|
150
162
|
## Automatic Transition
|
|
151
163
|
|
|
152
|
-
After exit conditions are met
|
|
164
|
+
After exit conditions are met (including user confirming the design proposal), auto-transition to next phase:
|
|
153
165
|
|
|
154
166
|
> **REQUIRED NEXT SKILL:** Invoke `comet-build` skill to enter the plan and build phase.
|
|
@@ -46,24 +46,24 @@ After the skill loads, follow its guidance to create streamlined artifacts:
|
|
|
46
46
|
Initialize Comet state file:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
|
|
49
|
+
"$COMET_BASH" "$COMET_STATE" init <name> hotfix
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
Verify initialized state:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
|
|
55
|
+
"$COMET_BASH" "$COMET_STATE" check <name> open
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
Run phase guard to transition open → build:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
|
|
61
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
### 2. Direct Build (preset build)
|
|
65
65
|
|
|
66
|
-
Use hotfix defaults: `build_mode: direct`. Skip `
|
|
66
|
+
Use hotfix defaults: `build_mode: direct`. Skip Superpowers `brainstorming` and `writing-plans` (unless tasks > 3; if exceeds 3 tasks, transfer to `/comet-build`'s plan and execution method selection).
|
|
67
67
|
|
|
68
68
|
Before continuing or starting changes, handle uncommitted changes through `comet/reference/dirty-worktree.md`. If attribution shows the fix scope exceeds hotfix, handle it through this file's "Upgrade Conditions".
|
|
69
69
|
|
|
@@ -97,7 +97,7 @@ Before continuing or starting changes, handle uncommitted changes through `comet
|
|
|
97
97
|
After root cause is confirmed eliminated, run phase guard to transition build → verify:
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
|
-
|
|
100
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
State automatically updates to `phase: verify`, `verify_result: pending`, then enter verification.
|
|
@@ -126,7 +126,7 @@ If there is delta spec, sync to main spec according to comet-archive rules, and
|
|
|
126
126
|
<IMPORTANT>
|
|
127
127
|
Hotfix workflow is **one-time continuous execution**. After invoking `/comet-hotfix`, agent must automatically advance through hotfix steps, without pausing to wait for user input mid-way. But the following situations must pause and wait for user confirmation:
|
|
128
128
|
|
|
129
|
-
1. Encountering upgrade conditions (see "Upgrade Conditions" section).
|
|
129
|
+
1. Encountering upgrade conditions (see "Upgrade Conditions" section). **Must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm** upgrading to full workflow
|
|
130
130
|
2. workspace isolation and execution-method selection when tasks exceed 3 and transfer to `/comet-build`
|
|
131
131
|
3. verify phase (comet-verify) verification-failure and branch-handling decisions
|
|
132
132
|
|
|
@@ -149,12 +149,12 @@ Upgrade to full `/comet` when **any** of the following conditions are met:
|
|
|
149
149
|
| Introduces new public API | Fix creates new external interface |
|
|
150
150
|
| Fix scope exceeds single function/module | Requires coordinated changes |
|
|
151
151
|
|
|
152
|
-
When upgrade conditions are met, must pause and wait for the user to explicitly confirm upgrading to the full `/comet` workflow. Do not directly enter `/comet-design`, and do not automatically supplement Design Doc.
|
|
152
|
+
When upgrade conditions are met, **must use the AskUserQuestion tool to pause and wait for the user to explicitly confirm** upgrading to the full `/comet` workflow. Do not directly enter `/comet-design`, and do not automatically supplement Design Doc. Must not just output a text prompt and then continue executing.
|
|
153
153
|
|
|
154
154
|
After user confirms upgrade, **must first update the workflow field** before entering full flow:
|
|
155
155
|
|
|
156
156
|
```bash
|
|
157
|
-
|
|
157
|
+
"$COMET_BASH" "$COMET_STATE" set <name> workflow full
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
Then on current change basis, supplement Design Doc: **Immediately use the Skill tool to load the `comet-design` skill**, proceed normally with full workflow. If user does not confirm upgrade, stop hotfix and report that current change has exceeded hotfix scope.
|
|
@@ -166,4 +166,4 @@ Then on current change basis, supplement Design Doc: **Immediately use the Skill
|
|
|
166
166
|
- Bug fixed, tests pass
|
|
167
167
|
- Change archived
|
|
168
168
|
- If spec changes, synced to main spec
|
|
169
|
-
- **Phase guard**: Before build → verify run `
|
|
169
|
+
- **Phase guard**: Before build → verify run `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`; before verify → archive follow `/comet-verify` and run `"$COMET_BASH" "$COMET_GUARD" <change-name> verify --apply`
|