@rpamis/comet 0.1.6 → 0.1.7
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 +4 -3
- package/assets/skills/comet/SKILL.md +16 -3
- package/assets/skills/comet/scripts/comet-archive.sh +252 -0
- package/assets/skills/comet/scripts/comet-guard.sh +41 -1
- package/assets/skills/comet-archive/SKILL.md +16 -91
- package/assets/skills/comet-build/SKILL.md +10 -53
- package/assets/skills/comet-design/SKILL.md +8 -9
- package/assets/skills/comet-open/SKILL.md +0 -31
- package/assets/skills/comet-verify/SKILL.md +4 -32
- package/assets/skills-zh/comet/SKILL.md +16 -3
- package/assets/skills-zh/comet-archive/SKILL.md +16 -91
- package/assets/skills-zh/comet-build/SKILL.md +10 -53
- package/assets/skills-zh/comet-design/SKILL.md +8 -9
- package/assets/skills-zh/comet-open/SKILL.md +0 -31
- package/assets/skills-zh/comet-verify/SKILL.md +4 -32
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,6 +153,7 @@ Comet uses a decoupled state architecture with separate YAML files:
|
|
|
153
153
|
- `design_doc`: Path to Superpowers Design Doc
|
|
154
154
|
- `plan`: Path to implementation plan
|
|
155
155
|
- `build_mode`: `subagent-driven-development`, `executing-plans`, or `direct`
|
|
156
|
+
- `isolation`: `branch` or `worktree`, workspace isolation method
|
|
156
157
|
- `verify_mode`: `light` or `full`
|
|
157
158
|
- `verify_result`: `pending`, `pass`, or `fail`
|
|
158
159
|
- `archived`: Boolean indicating if change is archived
|
|
@@ -170,8 +171,8 @@ Comet includes three-layer defense to ensure agent execution reliability:
|
|
|
170
171
|
- Automatic retry mechanism (up to 2 attempts) on mismatch
|
|
171
172
|
|
|
172
173
|
3. **Schema Validation** — `comet-yaml-validate.sh` ensures data integrity
|
|
173
|
-
- Validates required fields (
|
|
174
|
-
- Validates enum values (
|
|
174
|
+
- Validates required fields (10 fields)
|
|
175
|
+
- Validates enum values (7 enum types)
|
|
175
176
|
- Validates referenced file paths exist
|
|
176
177
|
- Detects unknown/typos fields
|
|
177
178
|
|
|
@@ -208,7 +209,7 @@ your-project/
|
|
|
208
209
|
|
|
209
210
|
```bash
|
|
210
211
|
# Clone
|
|
211
|
-
git clone https://github.com/
|
|
212
|
+
git clone https://github.com/rpamis/comet
|
|
212
213
|
cd comet
|
|
213
214
|
|
|
214
215
|
# Install dependencies
|
|
@@ -161,7 +161,7 @@ If metadata conflicts with file state, use verifiable file state as source of tr
|
|
|
161
161
|
|
|
162
162
|
### Script Location
|
|
163
163
|
|
|
164
|
-
Comet phase guard script `comet-guard.sh`
|
|
164
|
+
Comet phase guard script `comet-guard.sh` and archive script `comet-archive.sh` are distributed with the skill package, located in `comet/scripts/` directory.
|
|
165
165
|
**Do not hardcode platform paths**, self-locate at runtime with:
|
|
166
166
|
|
|
167
167
|
```bash
|
|
@@ -169,6 +169,19 @@ COMET_GUARD=$(find . -path '*/comet/scripts/comet-guard.sh' -type f -print -quit
|
|
|
169
169
|
bash "$COMET_GUARD" <change-name> <phase>
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
+
**Auto state update**: Guard supports `--apply` flag, automatically updating `.comet.yaml` state fields after checks pass:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
bash "$COMET_GUARD" <change-name> <phase> --apply
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Archive script**: Complete all archive steps in one command:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
COMET_ARCHIVE=$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)
|
|
182
|
+
bash "$COMET_ARCHIVE" <change-name>
|
|
183
|
+
```
|
|
184
|
+
|
|
172
185
|
In subsequent documentation, `bash $COMET_GUARD <change> <phase>` refers to this command. After loading comet, agents should cache `COMET_GUARD` path in shell environment to avoid repeated `find`.
|
|
173
186
|
|
|
174
187
|
### File Structure
|
|
@@ -185,7 +198,7 @@ openspec/ # OpenSpec — WHAT
|
|
|
185
198
|
│ │ ├── specs/<capability>/spec.md # Delta capability spec
|
|
186
199
|
│ │ └── tasks.md # Task checklist
|
|
187
200
|
│ └── archive/YYYY-MM-DD-<name>/ # Archived
|
|
188
|
-
└── specs/<capability>/spec.md # Main specs (
|
|
201
|
+
└── specs/<capability>/spec.md # Main specs (overwritten from delta at archive)
|
|
189
202
|
|
|
190
203
|
docs/superpowers/ # Superpowers — HOW
|
|
191
204
|
├── specs/YYYY-MM-DD-<topic>-design.md # Design doc (technical RFC, mark status at archive)
|
|
@@ -202,5 +215,5 @@ docs/superpowers/ # Superpowers — HOW
|
|
|
202
215
|
6. **Classify incremental updates** — Small edits, medium brainstorming, large new changes
|
|
203
216
|
7. **Plan must associate with change** — File header contains `change:` and `design-doc:` metadata
|
|
204
217
|
8. **Archive closure** — design doc and plan must mark `archived-with` status
|
|
205
|
-
9. **
|
|
218
|
+
9. **Modifying existing features** — Just open a new change; brainstorming reads existing specs as context naturally
|
|
206
219
|
10. **Preset has limits** — Switch to full workflow promptly when hotfix/tweak meet upgrade conditions
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Comet Archive — automates the archive phase in one command
|
|
3
|
+
# Usage: comet-archive.sh <change-name> [--dry-run]
|
|
4
|
+
# Exit 0 = archive complete, exit 1 = fatal error
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
red() { echo -e "\033[31m$1\033[0m" >&2; }
|
|
9
|
+
green() { echo -e "\033[32m$1\033[0m" >&2; }
|
|
10
|
+
yellow() { echo -e "\033[33m$1\033[0m" >&2; }
|
|
11
|
+
|
|
12
|
+
DRY_RUN=0
|
|
13
|
+
if [[ "${2:-}" == "--dry-run" ]]; then
|
|
14
|
+
DRY_RUN=1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Input validation
|
|
18
|
+
validate_change_name() {
|
|
19
|
+
local name="$1"
|
|
20
|
+
if [ -z "$name" ]; then
|
|
21
|
+
red "FATAL: Change name cannot be empty"
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
if [[ ! "$name" =~ ^[a-zA-Z0-9_-]+$ ]]; then
|
|
25
|
+
red "FATAL: Invalid change name: '$name'"
|
|
26
|
+
red "Valid characters: a-z, A-Z, 0-9, -, _"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
if [[ "$name" =~ \.\. ]]; then
|
|
30
|
+
red "FATAL: Change name cannot contain '..'"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
CHANGE="$1"
|
|
36
|
+
validate_change_name "$CHANGE"
|
|
37
|
+
|
|
38
|
+
CHANGE_DIR="openspec/changes/$CHANGE"
|
|
39
|
+
YAML="$CHANGE_DIR/.comet.yaml"
|
|
40
|
+
TODAY=$(date +%Y-%m-%d)
|
|
41
|
+
ARCHIVE_NAME="${TODAY}-${CHANGE}"
|
|
42
|
+
ARCHIVE_DIR="openspec/changes/archive/${ARCHIVE_NAME}"
|
|
43
|
+
|
|
44
|
+
STEPS_OK=0
|
|
45
|
+
STEPS_TOTAL=0
|
|
46
|
+
|
|
47
|
+
step_ok() {
|
|
48
|
+
green " [OK] $1"
|
|
49
|
+
STEPS_OK=$((STEPS_OK + 1))
|
|
50
|
+
STEPS_TOTAL=$((STEPS_TOTAL + 1))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
step_fail() {
|
|
54
|
+
red " [FAIL] $1"
|
|
55
|
+
STEPS_TOTAL=$((STEPS_TOTAL + 1))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
echo "=== Comet Archive: $CHANGE ===" >&2
|
|
59
|
+
|
|
60
|
+
# --- Step 1: Read .comet.yaml, extract paths ---
|
|
61
|
+
|
|
62
|
+
yaml_field() {
|
|
63
|
+
local field="$1"
|
|
64
|
+
if [ -f "$YAML" ]; then
|
|
65
|
+
grep "^${field}:" "$YAML" | sed "s/^${field}: *//" | tr -d '"' | tr -d "'"
|
|
66
|
+
fi
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if [ ! -f "$YAML" ]; then
|
|
70
|
+
red "FATAL: .comet.yaml not found in $CHANGE_DIR/"
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
DESIGN_DOC=$(yaml_field "design_doc")
|
|
75
|
+
PLAN_PATH=$(yaml_field "plan")
|
|
76
|
+
|
|
77
|
+
# --- Step 2: Validate entry state ---
|
|
78
|
+
|
|
79
|
+
PHASE_VAL=$(yaml_field "phase")
|
|
80
|
+
VERIFY_VAL=$(yaml_field "verify_result")
|
|
81
|
+
ARCHIVED_VAL=$(yaml_field "archived")
|
|
82
|
+
|
|
83
|
+
if [ "$PHASE_VAL" != "archive" ]; then
|
|
84
|
+
red "FATAL: phase is '$PHASE_VAL', expected 'archive'"
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
if [ "$VERIFY_VAL" != "pass" ]; then
|
|
89
|
+
red "FATAL: verify_result is '$VERIFY_VAL', expected 'pass'. Run comet-verify first."
|
|
90
|
+
exit 1
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
if [ "$ARCHIVED_VAL" = "true" ]; then
|
|
94
|
+
red "FATAL: change already archived"
|
|
95
|
+
exit 1
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
step_ok "Entry state verified"
|
|
99
|
+
|
|
100
|
+
# --- Step 3: Check archive target ---
|
|
101
|
+
|
|
102
|
+
if [ -d "$ARCHIVE_DIR" ]; then
|
|
103
|
+
red "FATAL: archive target already exists: $ARCHIVE_DIR"
|
|
104
|
+
exit 1
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
step_ok "Archive target available"
|
|
108
|
+
|
|
109
|
+
# --- Step 4: Sync delta specs → main specs ---
|
|
110
|
+
|
|
111
|
+
sync_delta_specs() {
|
|
112
|
+
local delta_root="$CHANGE_DIR/specs"
|
|
113
|
+
if [ ! -d "$delta_root" ]; then
|
|
114
|
+
return 0
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
for delta_spec_dir in "$delta_root"/*/; do
|
|
118
|
+
[ -d "$delta_spec_dir" ] || continue
|
|
119
|
+
local capability
|
|
120
|
+
capability=$(basename "$delta_spec_dir")
|
|
121
|
+
local delta_spec="$delta_spec_dir/spec.md"
|
|
122
|
+
local main_spec="openspec/specs/$capability/spec.md"
|
|
123
|
+
|
|
124
|
+
if [ ! -f "$delta_spec" ]; then
|
|
125
|
+
continue
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
STEPS_TOTAL=$((STEPS_TOTAL + 1))
|
|
129
|
+
|
|
130
|
+
if [ "$DRY_RUN" -eq 1 ]; then
|
|
131
|
+
yellow " [DRY-RUN] Would sync: $capability → $main_spec"
|
|
132
|
+
STEPS_OK=$((STEPS_OK + 1))
|
|
133
|
+
continue
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
if [ ! -f "$main_spec" ]; then
|
|
137
|
+
mkdir -p "openspec/specs/$capability"
|
|
138
|
+
fi
|
|
139
|
+
cp "$delta_spec" "$main_spec"
|
|
140
|
+
|
|
141
|
+
step_ok "Delta spec synced: $capability → openspec/specs/$capability/spec.md"
|
|
142
|
+
done
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
sync_delta_specs
|
|
146
|
+
|
|
147
|
+
# --- Step 5: Annotate design doc frontmatter ---
|
|
148
|
+
|
|
149
|
+
annotate_frontmatter() {
|
|
150
|
+
local file="$1"
|
|
151
|
+
local extra_fields="$2"
|
|
152
|
+
|
|
153
|
+
if [ ! -f "$file" ]; then
|
|
154
|
+
return 0
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
STEPS_TOTAL=$((STEPS_TOTAL + 1))
|
|
158
|
+
|
|
159
|
+
if [ "$DRY_RUN" -eq 1 ]; then
|
|
160
|
+
yellow " [DRY-RUN] Would annotate: $file"
|
|
161
|
+
STEPS_OK=$((STEPS_OK + 1))
|
|
162
|
+
return 0
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
if head -1 "$file" | grep -q '^---'; then
|
|
166
|
+
local tmp_file
|
|
167
|
+
tmp_file=$(mktemp)
|
|
168
|
+
awk -v archive="$ARCHIVE_NAME" -v extra="$extra_fields" '
|
|
169
|
+
/^archived-with:/ { next }
|
|
170
|
+
NR==1 && /^---/ { print; next }
|
|
171
|
+
/^---/ && NR>1 {
|
|
172
|
+
print "archived-with: " archive
|
|
173
|
+
if (extra != "") print extra
|
|
174
|
+
print; next
|
|
175
|
+
}
|
|
176
|
+
{ print }
|
|
177
|
+
' "$file" > "$tmp_file"
|
|
178
|
+
mv "$tmp_file" "$file"
|
|
179
|
+
else
|
|
180
|
+
local tmp_file
|
|
181
|
+
tmp_file=$(mktemp)
|
|
182
|
+
{
|
|
183
|
+
echo "---"
|
|
184
|
+
echo "archived-with: $ARCHIVE_NAME"
|
|
185
|
+
if [ -n "$extra_fields" ]; then
|
|
186
|
+
echo "$extra_fields"
|
|
187
|
+
fi
|
|
188
|
+
echo "status: final"
|
|
189
|
+
echo "---"
|
|
190
|
+
cat "$file"
|
|
191
|
+
} > "$tmp_file"
|
|
192
|
+
mv "$tmp_file" "$file"
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
step_ok "Annotated: $file"
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if [ -n "$DESIGN_DOC" ] && [ "$DESIGN_DOC" != "null" ]; then
|
|
199
|
+
annotate_frontmatter "$DESIGN_DOC" "status: final"
|
|
200
|
+
fi
|
|
201
|
+
|
|
202
|
+
# --- Step 6: Annotate plan frontmatter ---
|
|
203
|
+
|
|
204
|
+
if [ -n "$PLAN_PATH" ] && [ "$PLAN_PATH" != "null" ]; then
|
|
205
|
+
annotate_frontmatter "$PLAN_PATH" ""
|
|
206
|
+
fi
|
|
207
|
+
|
|
208
|
+
# --- Step 7: Move change to archive ---
|
|
209
|
+
|
|
210
|
+
STEPS_TOTAL=$((STEPS_TOTAL + 1))
|
|
211
|
+
|
|
212
|
+
if [ "$DRY_RUN" -eq 1 ]; then
|
|
213
|
+
yellow " [DRY-RUN] Would move: $CHANGE_DIR → $ARCHIVE_DIR"
|
|
214
|
+
STEPS_OK=$((STEPS_OK + 1))
|
|
215
|
+
else
|
|
216
|
+
mkdir -p "openspec/changes/archive"
|
|
217
|
+
mv "$CHANGE_DIR" "$ARCHIVE_DIR"
|
|
218
|
+
step_ok "Moved to: $ARCHIVE_DIR"
|
|
219
|
+
fi
|
|
220
|
+
|
|
221
|
+
# --- Step 8: Update archived: true in .comet.yaml ---
|
|
222
|
+
|
|
223
|
+
STEPS_TOTAL=$((STEPS_TOTAL + 1))
|
|
224
|
+
|
|
225
|
+
ARCHIVE_YAML="$ARCHIVE_DIR/.comet.yaml"
|
|
226
|
+
|
|
227
|
+
if [ "$DRY_RUN" -eq 1 ]; then
|
|
228
|
+
yellow " [DRY-RUN] Would set archived: true in $ARCHIVE_YAML"
|
|
229
|
+
STEPS_OK=$((STEPS_OK + 1))
|
|
230
|
+
else
|
|
231
|
+
if [ -f "$ARCHIVE_YAML" ]; then
|
|
232
|
+
sed -i 's/^archived:.*/archived: true/' "$ARCHIVE_YAML"
|
|
233
|
+
step_ok "archived: true"
|
|
234
|
+
else
|
|
235
|
+
step_fail "archived: true (.comet.yaml not found after move)"
|
|
236
|
+
fi
|
|
237
|
+
fi
|
|
238
|
+
|
|
239
|
+
# --- Step 9: Print summary ---
|
|
240
|
+
|
|
241
|
+
echo "" >&2
|
|
242
|
+
if [ "$DRY_RUN" -eq 1 ]; then
|
|
243
|
+
yellow "Dry run complete. $STEPS_OK/$STEPS_TOTAL steps would succeed."
|
|
244
|
+
else
|
|
245
|
+
green "Archive complete. $STEPS_OK/$STEPS_TOTAL steps succeeded."
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
if [ "$STEPS_OK" -lt "$STEPS_TOTAL" ]; then
|
|
249
|
+
exit 1
|
|
250
|
+
fi
|
|
251
|
+
|
|
252
|
+
exit 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Comet Phase Guard — validates exit conditions before phase transitions
|
|
3
|
-
# Usage: comet-guard.sh <change-name> <
|
|
3
|
+
# Usage: comet-guard.sh <change-name> <current-phase> [--apply]
|
|
4
4
|
# Phases: open, design, build, verify, archive
|
|
5
5
|
# Exit 0 = all checks pass, exit 1 = blocked (reasons printed to stderr)
|
|
6
6
|
|
|
@@ -35,6 +35,10 @@ validate_change_name "$1"
|
|
|
35
35
|
|
|
36
36
|
CHANGE="$1"
|
|
37
37
|
PHASE="$2"
|
|
38
|
+
APPLY=0
|
|
39
|
+
if [[ "${3:-}" == "--apply" ]]; then
|
|
40
|
+
APPLY=1
|
|
41
|
+
fi
|
|
38
42
|
CHANGE_DIR="openspec/changes/$CHANGE"
|
|
39
43
|
|
|
40
44
|
BLOCK=0
|
|
@@ -177,6 +181,33 @@ guard_archive() {
|
|
|
177
181
|
check "tasks.md all tasks checked" tasks_all_done
|
|
178
182
|
}
|
|
179
183
|
|
|
184
|
+
apply_state_update() {
|
|
185
|
+
local yaml="$CHANGE_DIR/.comet.yaml"
|
|
186
|
+
local p="$1"
|
|
187
|
+
|
|
188
|
+
case "$p" in
|
|
189
|
+
open)
|
|
190
|
+
sed -i 's/^phase:.*/phase: design/' "$yaml"
|
|
191
|
+
;;
|
|
192
|
+
design)
|
|
193
|
+
sed -i 's/^phase:.*/phase: build/' "$yaml"
|
|
194
|
+
;;
|
|
195
|
+
build)
|
|
196
|
+
sed -i 's/^phase:.*/phase: verify/' "$yaml"
|
|
197
|
+
sed -i 's/^verify_result:.*/verify_result: pending/' "$yaml"
|
|
198
|
+
;;
|
|
199
|
+
verify)
|
|
200
|
+
sed -i 's/^phase:.*/phase: archive/' "$yaml"
|
|
201
|
+
sed -i 's/^verify_result:.*/verify_result: pass/' "$yaml"
|
|
202
|
+
if ! grep -q '^verified_at:' "$yaml" 2>/dev/null; then
|
|
203
|
+
echo "verified_at: $(date +%Y-%m-%d)" >> "$yaml"
|
|
204
|
+
else
|
|
205
|
+
sed -i "s/^verified_at:.*/verified_at: $(date +%Y-%m-%d)/" "$yaml"
|
|
206
|
+
fi
|
|
207
|
+
;;
|
|
208
|
+
esac
|
|
209
|
+
}
|
|
210
|
+
|
|
180
211
|
# --- Main ---
|
|
181
212
|
|
|
182
213
|
case "$PHASE" in
|
|
@@ -199,5 +230,14 @@ if [ "$BLOCK" -eq 1 ]; then
|
|
|
199
230
|
else
|
|
200
231
|
echo "" >&2
|
|
201
232
|
green "ALL CHECKS PASSED — ready for next phase"
|
|
233
|
+
if [ "$APPLY" -eq 1 ]; then
|
|
234
|
+
apply_state_update "$PHASE"
|
|
235
|
+
case "$PHASE" in
|
|
236
|
+
open) green " [APPLY] .comet.yaml updated: phase=design" ;;
|
|
237
|
+
design) green " [APPLY] .comet.yaml updated: phase=build" ;;
|
|
238
|
+
build) green " [APPLY] .comet.yaml updated: phase=verify, verify_result=pending" ;;
|
|
239
|
+
verify) green " [APPLY] .comet.yaml updated: phase=archive, verify_result=pass" ;;
|
|
240
|
+
esac
|
|
241
|
+
fi
|
|
202
242
|
exit 0
|
|
203
243
|
fi
|
|
@@ -39,113 +39,38 @@ Proceed to Step 1 only after verification passes.
|
|
|
39
39
|
|
|
40
40
|
### 1. Execute Archive
|
|
41
41
|
|
|
42
|
-
|
|
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:
|
|
42
|
+
Run the archive script to automatically complete all steps:
|
|
54
43
|
|
|
55
44
|
```bash
|
|
56
|
-
|
|
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)
|
|
45
|
+
COMET_ARCHIVE=$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)
|
|
46
|
+
bash "$COMET_ARCHIVE" "<change-name>"
|
|
72
47
|
```
|
|
73
48
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
49
|
+
The script automatically executes:
|
|
50
|
+
1. Entry state validation (phase=archive, verify_result=pass, archived=false)
|
|
51
|
+
2. Delta spec sync to main spec (overwrite)
|
|
52
|
+
3. Design doc frontmatter annotation (archived-with, status)
|
|
53
|
+
4. Plan frontmatter annotation (archived-with)
|
|
54
|
+
5. Move change to archive directory
|
|
55
|
+
6. Update archived: true
|
|
79
56
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- If there are discrepancies (incremental spec modifications during implementation), set the following metadata in design doc's YAML frontmatter:
|
|
57
|
+
If script returns non-zero exit code, report error and stop.
|
|
58
|
+
If script returns zero exit code, archive is complete.
|
|
83
59
|
|
|
84
|
-
|
|
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
|
-
```
|
|
60
|
+
Use `--dry-run` flag to preview without executing.
|
|
92
61
|
|
|
93
|
-
|
|
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
|
|
62
|
+
### 2. Lifecycle Closed Loop
|
|
121
63
|
|
|
122
64
|
Spec lifecycle completes here:
|
|
123
65
|
```
|
|
124
|
-
brainstorming → delta spec → implementation
|
|
66
|
+
brainstorming → delta spec → implementation → verification → main spec overwrite → design doc annotation → archive
|
|
125
67
|
```
|
|
126
68
|
|
|
127
69
|
## Exit Conditions
|
|
128
70
|
|
|
129
|
-
-
|
|
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`
|
|
71
|
+
- Archive script executed successfully (exit code 0)
|
|
134
72
|
- **Phase guard**: Run `bash $COMET_GUARD <change-name> archive`, confirm archive complete after all PASS
|
|
135
73
|
|
|
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
74
|
## Complete
|
|
150
75
|
|
|
151
76
|
Comet workflow complete. To start new work, invoke `/comet` or `/comet-open`.
|
|
@@ -56,17 +56,13 @@ design-doc: docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md
|
|
|
56
56
|
|
|
57
57
|
### 2. Update Plan Status
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Record plan path:
|
|
60
60
|
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
61
|
+
```bash
|
|
62
|
+
sed -i 's|^plan:.*|plan: docs/superpowers/plans/YYYY-MM-DD-feature.md|' openspec/changes/<name>/.comet.yaml
|
|
64
63
|
```
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
68
|
-
Confirm plan line value is "docs/superpowers/plans/YYYY-MM-DD-feature.md"
|
|
69
|
-
If not matching, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
|
|
65
|
+
No manual phase update needed — guard auto-transitions when exit conditions are met.
|
|
70
66
|
|
|
71
67
|
### 3. Workspace Isolation
|
|
72
68
|
|
|
@@ -81,28 +77,11 @@ Plan has been written to the current branch. Before starting execution, choose w
|
|
|
81
77
|
- Change involves ≤ 3 files → Recommend A
|
|
82
78
|
- Need parallel development, current branch has uncommitted work → Recommend B
|
|
83
79
|
|
|
84
|
-
After user selection,
|
|
80
|
+
After user selection, update `isolation` in `openspec/changes/<name>/.comet.yaml`. `isolation` only allows one of the following values:
|
|
85
81
|
|
|
86
82
|
- `branch`
|
|
87
83
|
- `worktree`
|
|
88
84
|
|
|
89
|
-
Few-shot examples:
|
|
90
|
-
|
|
91
|
-
```yaml
|
|
92
|
-
# User selects create branch / A
|
|
93
|
-
isolation: branch
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
```yaml
|
|
97
|
-
# User selects create worktree / B
|
|
98
|
-
isolation: worktree
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
【Write verification】After update completion, must verify:
|
|
102
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
103
|
-
Confirm isolation line value is "<branch or worktree>"
|
|
104
|
-
If not matching, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
|
|
105
|
-
|
|
106
85
|
**Execute isolation**:
|
|
107
86
|
|
|
108
87
|
- **branch**: Run `git checkout -b <change-name>`, subsequent work on the new branch
|
|
@@ -124,29 +103,12 @@ Present plan summary to user (task count, involved modules), then ask for execut
|
|
|
124
103
|
- Task count ≤ 2 and no cross-module dependencies → Recommend B
|
|
125
104
|
- From hotfix path → Recommend B
|
|
126
105
|
|
|
127
|
-
After user selection,
|
|
106
|
+
After user selection, update `build_mode` in `openspec/changes/<name>/.comet.yaml`. `build_mode` only allows one of the following values:
|
|
128
107
|
|
|
129
108
|
- `subagent-driven-development`
|
|
130
109
|
- `executing-plans`
|
|
131
110
|
- `direct` (only for hotfix preset use)
|
|
132
111
|
|
|
133
|
-
Few-shot examples:
|
|
134
|
-
|
|
135
|
-
```yaml
|
|
136
|
-
# User selects robust mode / A
|
|
137
|
-
build_mode: subagent-driven-development
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
```yaml
|
|
141
|
-
# User selects fast mode / B
|
|
142
|
-
build_mode: executing-plans
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
【Write verification】After update completion, must verify:
|
|
146
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
147
|
-
Confirm build_mode line value is "<subagent-driven-development or executing-plans or direct>"
|
|
148
|
-
If not matching, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
|
|
149
|
-
|
|
150
112
|
Then, **immediately execute:** Use the Skill tool to load the corresponding skill. Skipping this step is prohibited.
|
|
151
113
|
|
|
152
114
|
If the selected Superpowers skill is unavailable, stop the process and prompt to install or enable the corresponding skill. Do not substitute this step with normal conversation.
|
|
@@ -183,18 +145,13 @@ When the initial spec is found incomplete during implementation, handle by scale
|
|
|
183
145
|
- `.comet.yaml` `phase` updated to `verify`
|
|
184
146
|
- **Phase guard**: Run `bash $COMET_GUARD <change-name> build`, allow transition only after all PASS
|
|
185
147
|
|
|
186
|
-
Before exit,
|
|
148
|
+
Before exit, run guard to auto-transition:
|
|
187
149
|
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
verify_result: pending
|
|
150
|
+
```bash
|
|
151
|
+
bash $COMET_GUARD <change-name> build --apply
|
|
191
152
|
```
|
|
192
153
|
|
|
193
|
-
|
|
194
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
195
|
-
Confirm phase line value is "verify"
|
|
196
|
-
Confirm verify_result line value is "pending"
|
|
197
|
-
If any field does not match, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
|
|
154
|
+
State file is automatically updated to `phase: verify`, `verify_result: pending`.
|
|
198
155
|
|
|
199
156
|
## Automatic Transition
|
|
200
157
|
|
|
@@ -66,18 +66,17 @@ After the skill loads, follow its guidance to produce:
|
|
|
66
66
|
|
|
67
67
|
### 2. Update Comet State
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
Record design_doc path, then run guard to auto-transition:
|
|
70
70
|
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
71
|
+
```bash
|
|
72
|
+
# Record design_doc path
|
|
73
|
+
sed -i 's|^design_doc:.*|design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md|' openspec/changes/<name>/.comet.yaml
|
|
74
|
+
|
|
75
|
+
# Auto-transition to next phase
|
|
76
|
+
bash $COMET_GUARD <change-name> design --apply
|
|
74
77
|
```
|
|
75
78
|
|
|
76
|
-
|
|
77
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
78
|
-
Confirm phase line value is "build"
|
|
79
|
-
Confirm design_doc line value is "docs/superpowers/specs/YYYY-MM-DD-topic-design.md"
|
|
80
|
-
If any field does not match, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
|
|
79
|
+
State file is updated automatically. No manual editing of other fields required.
|
|
81
80
|
|
|
82
81
|
### 3. Dual Spec Division of Labor
|
|
83
82
|
|
|
@@ -57,24 +57,6 @@ openspec/changes/<name>/
|
|
|
57
57
|
└── tasks.md # Task checklist (checkboxes)
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
### 2b. Incrementally Modify Existing Capability (Optional)
|
|
61
|
-
|
|
62
|
-
**Trigger condition:** proposal.md mentions modifying an existing capability, or user explicitly requests incremental modification.
|
|
63
|
-
|
|
64
|
-
**Applicable scenario:** Incremental modification to archived functionality (not a brand-new capability).
|
|
65
|
-
|
|
66
|
-
When proposal.md goals involve modifying an existing capability:
|
|
67
|
-
1. Check if `openspec/specs/<capability>/spec.md` main spec already exists
|
|
68
|
-
2. If it exists, copy the main spec as a delta spec baseline:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
mkdir -p openspec/changes/<name>/specs/<capability>/
|
|
72
|
-
cp openspec/specs/<capability>/spec.md openspec/changes/<name>/specs/<capability>/spec.md
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
3. In the copied delta spec, organize changes in delta format (`## ADDED`, `## MODIFIED`, `## REMOVED`)
|
|
76
|
-
4. Note in proposal.md: `based on existing capability: <capability-name>`
|
|
77
|
-
|
|
78
60
|
### 3. Initialize Comet State
|
|
79
61
|
|
|
80
62
|
Create an independent `.comet.yaml` file under `openspec/changes/<name>/`:
|
|
@@ -91,19 +73,6 @@ verified_at: null
|
|
|
91
73
|
archived: false
|
|
92
74
|
```
|
|
93
75
|
|
|
94
|
-
【Write verification】After creation, must verify:
|
|
95
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
96
|
-
Confirm workflow line value is "full"
|
|
97
|
-
Confirm phase line value is "design"
|
|
98
|
-
Confirm design_doc line value is "null"
|
|
99
|
-
Confirm plan line value is "null"
|
|
100
|
-
Confirm build_mode line value is "null"
|
|
101
|
-
Confirm verify_mode line value is "null"
|
|
102
|
-
Confirm verify_result line value is "pending"
|
|
103
|
-
Confirm verified_at line value is "null"
|
|
104
|
-
Confirm archived line value is "false"
|
|
105
|
-
If any field does not match, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
|
|
106
|
-
|
|
107
76
|
### 4. Content Completeness Check
|
|
108
77
|
|
|
109
78
|
Confirm the three documents have complete content:
|
|
@@ -53,27 +53,6 @@ After determination, record actual verification mode in `openspec/changes/<name>
|
|
|
53
53
|
- `light`
|
|
54
54
|
- `full`
|
|
55
55
|
|
|
56
|
-
Few-shot examples:
|
|
57
|
-
|
|
58
|
-
```yaml
|
|
59
|
-
# All metrics hit "small"
|
|
60
|
-
phase: verify
|
|
61
|
-
verify_mode: light
|
|
62
|
-
verify_result: pending
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
```yaml
|
|
66
|
-
# Any metric hits "large"
|
|
67
|
-
phase: verify
|
|
68
|
-
verify_mode: full
|
|
69
|
-
verify_result: pending
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
【Write verification】After update completion, must verify:
|
|
73
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
74
|
-
Confirm verify_mode line value is "<light or full>"
|
|
75
|
-
If not matching, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
|
|
76
|
-
|
|
77
56
|
### 2a. Lightweight Verification (Small Changes)
|
|
78
57
|
|
|
79
58
|
When scale assessment result is "small", skip `openspec-verify-change`, directly execute the following checks:
|
|
@@ -142,20 +121,13 @@ After the skill loads, follow its guidance to complete. Branch handling options:
|
|
|
142
121
|
- `.comet.yaml` `verify_result` recorded as `pass`
|
|
143
122
|
- **Phase guard**: Run `bash $COMET_GUARD <change-name> verify`, allow transition only after all PASS
|
|
144
123
|
|
|
145
|
-
Before exit,
|
|
124
|
+
Before exit, run guard to auto-transition:
|
|
146
125
|
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
verify_result: pass
|
|
150
|
-
verified_at: YYYY-MM-DD
|
|
126
|
+
```bash
|
|
127
|
+
bash $COMET_GUARD <change-name> verify --apply
|
|
151
128
|
```
|
|
152
129
|
|
|
153
|
-
|
|
154
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
155
|
-
Confirm phase line value is "archive"
|
|
156
|
-
Confirm verify_result line value is "pass"
|
|
157
|
-
Confirm verified_at line value is non-empty (format YYYY-MM-DD)
|
|
158
|
-
If any field does not match, retry write then verify again. Maximum 2 retries, report error and terminate if still fails.
|
|
130
|
+
State file is automatically updated to `phase: archive`, `verify_result: pass`, `verified_at: YYYY-MM-DD`.
|
|
159
131
|
|
|
160
132
|
## Automatic Transition
|
|
161
133
|
|
|
@@ -161,7 +161,7 @@ archived: false
|
|
|
161
161
|
|
|
162
162
|
### 脚本定位
|
|
163
163
|
|
|
164
|
-
Comet 阶段守卫脚本 `comet-guard.sh` 随 skill 包分发,位于 `comet/scripts/` 目录。
|
|
164
|
+
Comet 阶段守卫脚本 `comet-guard.sh` 和归档脚本 `comet-archive.sh` 随 skill 包分发,位于 `comet/scripts/` 目录。
|
|
165
165
|
**不硬编码平台路径**,运行时通过以下命令自定位:
|
|
166
166
|
|
|
167
167
|
```bash
|
|
@@ -169,6 +169,19 @@ COMET_GUARD=$(find . -path '*/comet/scripts/comet-guard.sh' -type f -print -quit
|
|
|
169
169
|
bash "$COMET_GUARD" <change-name> <phase>
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
+
**自动状态更新**:guard 支持 `--apply` 参数,验证通过后自动更新 `.comet.yaml` 状态字段:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
bash "$COMET_GUARD" <change-name> <phase> --apply
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**归档脚本**:一键完成归档全部步骤:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
COMET_ARCHIVE=$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)
|
|
182
|
+
bash "$COMET_ARCHIVE" <change-name>
|
|
183
|
+
```
|
|
184
|
+
|
|
172
185
|
后续文档中 `bash $COMET_GUARD <change> <phase>` 均指此命令。加载 comet 后,agent 应在 shell 环境中缓存 `COMET_GUARD` 路径,避免重复 `find`。
|
|
173
186
|
|
|
174
187
|
### 文件结构
|
|
@@ -185,7 +198,7 @@ openspec/ # OpenSpec — WHAT
|
|
|
185
198
|
│ │ ├── specs/<capability>/spec.md # Delta 能力规格
|
|
186
199
|
│ │ └── tasks.md # 任务清单
|
|
187
200
|
│ └── archive/YYYY-MM-DD-<name>/ # 已归档
|
|
188
|
-
└── specs/<capability>/spec.md # 主 specs(归档时从 delta
|
|
201
|
+
└── specs/<capability>/spec.md # 主 specs(归档时从 delta 覆盖)
|
|
189
202
|
|
|
190
203
|
docs/superpowers/ # Superpowers — HOW
|
|
191
204
|
├── specs/YYYY-MM-DD-<topic>-design.md # 设计文档(技术 RFC,归档时标注状态)
|
|
@@ -202,5 +215,5 @@ docs/superpowers/ # Superpowers — HOW
|
|
|
202
215
|
6. **增量更新分级** — 小编辑、中重 brainstorming、大新 change
|
|
203
216
|
7. **Plan 必须关联 change** — 文件头包含 `change:` 和 `design-doc:` 元数据
|
|
204
217
|
8. **归档闭环** — design doc 和 plan 必须标注 `archived-with` 状态
|
|
205
|
-
9. **增量修改已有功能** —
|
|
218
|
+
9. **增量修改已有功能** — 直接 open 新 change,brainstorming 会读取已有 main spec 作为上下文
|
|
206
219
|
10. **Preset 有上限** — hotfix/tweak 满足升级条件时及时切换到完整流程
|
|
@@ -39,113 +39,38 @@ description: "Comet 阶段 5:归档。用 /comet-archive 调用。同步 delta
|
|
|
39
39
|
|
|
40
40
|
### 1. 执行归档
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
**立即执行:** 使用 Skill 工具加载 `openspec-archive-change` 技能。禁止跳过此步骤。
|
|
45
|
-
|
|
46
|
-
技能加载后,按其指引归档。自动检查:
|
|
47
|
-
1. artifact 完成状态(proposal、design、specs、tasks)
|
|
48
|
-
2. 所有任务已标记 `[x]`
|
|
49
|
-
3. delta specs 同步状态
|
|
50
|
-
|
|
51
|
-
### 1b. 移动 Comet 状态文件
|
|
52
|
-
|
|
53
|
-
`openspec-archive-change` 不感知 `.comet.yaml`,因此 Comet 需要在 OpenSpec 归档完成后自行移动该文件:
|
|
42
|
+
运行归档脚本,自动完成以下全部步骤:
|
|
54
43
|
|
|
55
44
|
```bash
|
|
56
|
-
|
|
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(持久化)
|
|
45
|
+
COMET_ARCHIVE=$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)
|
|
46
|
+
bash "$COMET_ARCHIVE" "<change-name>"
|
|
72
47
|
```
|
|
73
48
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
49
|
+
脚本自动执行:
|
|
50
|
+
1. 入口状态验证(phase=archive, verify_result=pass, archived=false)
|
|
51
|
+
2. Delta spec 同步到主 spec
|
|
52
|
+
3. Design doc 前置元数据标注(archived-with, status)
|
|
53
|
+
4. Plan 前置元数据标注(archived-with)
|
|
54
|
+
5. 移动 change 到归档目录
|
|
55
|
+
6. 更新 archived: true
|
|
79
56
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- 如有偏差(实施过程中 spec 发生了增量修改),在 design doc 的 YAML frontmatter 中设置以下元数据:
|
|
57
|
+
如脚本返回非零退出码,报告错误并停止。
|
|
58
|
+
如脚本返回零退出码,归档完成。
|
|
83
59
|
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
archived-with: YYYY-MM-DD-<name>
|
|
87
|
-
status: superseded-by-main-spec
|
|
88
|
-
implementation-notes: |
|
|
89
|
-
<简述实施过程中偏离原设计的关键变化>
|
|
90
|
-
---
|
|
91
|
-
```
|
|
60
|
+
如需预览而不实际执行,使用 `--dry-run` 参数。
|
|
92
61
|
|
|
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. 生命周期闭环
|
|
62
|
+
### 2. 生命周期闭环
|
|
121
63
|
|
|
122
64
|
Spec 生命周期在此完成:
|
|
123
65
|
```
|
|
124
|
-
brainstorming → delta spec →
|
|
66
|
+
brainstorming → delta spec → 实施 → 验证 → 主 spec 覆盖 → design doc 标注 → 归档
|
|
125
67
|
```
|
|
126
68
|
|
|
127
69
|
## 退出条件
|
|
128
70
|
|
|
129
|
-
-
|
|
130
|
-
- 主 specs 已更新(delta → main 同步完成)
|
|
131
|
-
- 关联 design doc 已标注归档状态
|
|
132
|
-
- 关联 plan 已标注归档状态
|
|
133
|
-
- `.comet.yaml` 中 `archived` 已记录为 `true`
|
|
71
|
+
- 归档脚本执行成功(退出码 0)
|
|
134
72
|
- **阶段守卫**:运行 `bash $COMET_GUARD <change-name> archive`,全部 PASS 后确认归档完整
|
|
135
73
|
|
|
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
74
|
## 完成
|
|
150
75
|
|
|
151
76
|
Comet 流程全部完成。如需开始新工作,调用 `/comet` 或 `/comet-open`。
|
|
@@ -56,17 +56,13 @@ design-doc: docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md
|
|
|
56
56
|
|
|
57
57
|
### 2. 更新计划状态
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
先记录 plan 路径:
|
|
60
60
|
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
61
|
+
```bash
|
|
62
|
+
sed -i 's|^plan:.*|plan: docs/superpowers/plans/YYYY-MM-DD-feature.md|' openspec/changes/<name>/.comet.yaml
|
|
64
63
|
```
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
68
|
-
确认 plan 行的值为 "docs/superpowers/plans/YYYY-MM-DD-feature.md"
|
|
69
|
-
如不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
|
|
65
|
+
无需手动更新 phase,guard 会在退出条件满足后自动流转。
|
|
70
66
|
|
|
71
67
|
### 3. 工作区隔离
|
|
72
68
|
|
|
@@ -81,28 +77,11 @@ plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
|
81
77
|
- 变更涉及 ≤ 3 个文件 → 推荐 A
|
|
82
78
|
- 需要并行开发、当前分支有未提交工作 → 推荐 B
|
|
83
79
|
|
|
84
|
-
用户选择后,在 `openspec/changes/<name>/.comet.yaml`
|
|
80
|
+
用户选择后,在 `openspec/changes/<name>/.comet.yaml` 中更新 `isolation`。`isolation` 只允许以下值之一:
|
|
85
81
|
|
|
86
82
|
- `branch`
|
|
87
83
|
- `worktree`
|
|
88
84
|
|
|
89
|
-
Few-shot 示例:
|
|
90
|
-
|
|
91
|
-
```yaml
|
|
92
|
-
# 用户选择创建分支 / A
|
|
93
|
-
isolation: branch
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
```yaml
|
|
97
|
-
# 用户选择创建 worktree / B
|
|
98
|
-
isolation: worktree
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
【写入验证】更新完成后必须验证:
|
|
102
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
103
|
-
确认 isolation 行的值为 "<branch 或 worktree>"
|
|
104
|
-
如不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
|
|
105
|
-
|
|
106
85
|
**执行隔离**:
|
|
107
86
|
|
|
108
87
|
- **branch**:执行 `git checkout -b <change-name>`,后续工作在新分支上进行
|
|
@@ -124,29 +103,12 @@ isolation: worktree
|
|
|
124
103
|
- 任务数 ≤ 2 且无跨模块依赖 → 推荐 B
|
|
125
104
|
- 来自 hotfix 路径 → 推荐 B
|
|
126
105
|
|
|
127
|
-
用户选择后,在 `openspec/changes/<name>/.comet.yaml`
|
|
106
|
+
用户选择后,在 `openspec/changes/<name>/.comet.yaml` 中更新 `build_mode`。`build_mode` 只允许以下值之一:
|
|
128
107
|
|
|
129
108
|
- `subagent-driven-development`
|
|
130
109
|
- `executing-plans`
|
|
131
110
|
- `direct`(仅 hotfix preset 使用)
|
|
132
111
|
|
|
133
|
-
Few-shot 示例:
|
|
134
|
-
|
|
135
|
-
```yaml
|
|
136
|
-
# 用户选择稳健模式 / A
|
|
137
|
-
build_mode: subagent-driven-development
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
```yaml
|
|
141
|
-
# 用户选择快速模式 / B
|
|
142
|
-
build_mode: executing-plans
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
【写入验证】更新完成后必须验证:
|
|
146
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
147
|
-
确认 build_mode 行的值为 "<subagent-driven-development 或 executing-plans 或 direct>"
|
|
148
|
-
如不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
|
|
149
|
-
|
|
150
112
|
然后,**立即执行:** 使用 Skill 工具加载对应技能。禁止跳过此步骤。
|
|
151
113
|
|
|
152
114
|
如所选 Superpowers 技能不可用,停止流程并提示安装或启用对应技能,不要用普通对话替代该步骤。
|
|
@@ -183,18 +145,13 @@ build_mode: executing-plans
|
|
|
183
145
|
- `.comet.yaml` 中 `phase` 已更新为 `verify`
|
|
184
146
|
- **阶段守卫**:运行 `bash $COMET_GUARD <change-name> build`,全部 PASS 后才允许流转
|
|
185
147
|
|
|
186
|
-
|
|
148
|
+
退出前运行 guard 自动流转:
|
|
187
149
|
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
verify_result: pending
|
|
150
|
+
```bash
|
|
151
|
+
bash $COMET_GUARD <change-name> build --apply
|
|
191
152
|
```
|
|
192
153
|
|
|
193
|
-
|
|
194
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
195
|
-
确认 phase 行的值为 "verify"
|
|
196
|
-
确认 verify_result 行的值为 "pending"
|
|
197
|
-
如任一字段不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
|
|
154
|
+
状态文件自动更新为 `phase: verify`、`verify_result: pending`。
|
|
198
155
|
|
|
199
156
|
## 自动流转
|
|
200
157
|
|
|
@@ -66,18 +66,17 @@ Design 摘要: <design.md 架构决策>
|
|
|
66
66
|
|
|
67
67
|
### 2. 更新 Comet 状态
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
先记录 design_doc 路径,再运行 guard 自动流转:
|
|
70
70
|
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
71
|
+
```bash
|
|
72
|
+
# 记录 design_doc 路径
|
|
73
|
+
sed -i 's|^design_doc:.*|design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md|' openspec/changes/<name>/.comet.yaml
|
|
74
|
+
|
|
75
|
+
# 自动流转到下一阶段
|
|
76
|
+
bash $COMET_GUARD <change-name> design --apply
|
|
74
77
|
```
|
|
75
78
|
|
|
76
|
-
|
|
77
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
78
|
-
确认 phase 行的值为 "build"
|
|
79
|
-
确认 design_doc 行的值为 "docs/superpowers/specs/YYYY-MM-DD-topic-design.md"
|
|
80
|
-
如任一字段不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
|
|
79
|
+
状态文件自动更新,无需手动编辑其他字段。
|
|
81
80
|
|
|
82
81
|
### 3. 双 Spec 分工
|
|
83
82
|
|
|
@@ -57,24 +57,6 @@ openspec/changes/<name>/
|
|
|
57
57
|
└── tasks.md # 任务清单(勾选框)
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
### 2b. 增量修改已有 Capability(可选)
|
|
61
|
-
|
|
62
|
-
**触发条件**:proposal.md 中提到修改已有 capability,或用户明确要求增量修改。
|
|
63
|
-
|
|
64
|
-
**适用场景**:对已归档功能做增量修改(而非全新 capability)。
|
|
65
|
-
|
|
66
|
-
当 proposal.md 目标涉及修改已有 capability 时:
|
|
67
|
-
1. 查找 `openspec/specs/<capability>/spec.md` 是否已存在主 spec
|
|
68
|
-
2. 如已存在,将主 spec 复制为 delta spec 基线:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
mkdir -p openspec/changes/<name>/specs/<capability>/
|
|
72
|
-
cp openspec/specs/<capability>/spec.md openspec/changes/<name>/specs/<capability>/spec.md
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
3. 在复制的 delta spec 中,按 delta 格式组织变更(`## ADDED`、`## MODIFIED`、`## REMOVED`)
|
|
76
|
-
4. 在 proposal.md 中注明 `基于已有 capability: <capability-name>`
|
|
77
|
-
|
|
78
60
|
### 3. 初始化 Comet 状态
|
|
79
61
|
|
|
80
62
|
在 `openspec/changes/<name>/` 下创建独立的 `.comet.yaml` 文件:
|
|
@@ -91,19 +73,6 @@ verified_at: null
|
|
|
91
73
|
archived: false
|
|
92
74
|
```
|
|
93
75
|
|
|
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
|
-
|
|
107
76
|
### 4. 内容完整性检查
|
|
108
77
|
|
|
109
78
|
确认三个文档内容完整:
|
|
@@ -53,27 +53,6 @@ description: "Comet 阶段 4:验证与收尾。用 /comet-verify 调用。验
|
|
|
53
53
|
- `light`
|
|
54
54
|
- `full`
|
|
55
55
|
|
|
56
|
-
Few-shot 示例:
|
|
57
|
-
|
|
58
|
-
```yaml
|
|
59
|
-
# 全部指标命中“小”
|
|
60
|
-
phase: verify
|
|
61
|
-
verify_mode: light
|
|
62
|
-
verify_result: pending
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
```yaml
|
|
66
|
-
# 任一指标命中”大”
|
|
67
|
-
phase: verify
|
|
68
|
-
verify_mode: full
|
|
69
|
-
verify_result: pending
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
【写入验证】更新完成后必须验证:
|
|
73
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
74
|
-
确认 verify_mode 行的值为 “<light 或 full>”
|
|
75
|
-
如不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
|
|
76
|
-
|
|
77
56
|
### 2a. 轻量验证(小改动)
|
|
78
57
|
|
|
79
58
|
当规模评估结果为"小"时,跳过 `openspec-verify-change`,直接执行以下检查:
|
|
@@ -142,20 +121,13 @@ verify_result: pending
|
|
|
142
121
|
- `.comet.yaml` 中 `verify_result` 已记录为 `pass`
|
|
143
122
|
- **阶段守卫**:运行 `bash $COMET_GUARD <change-name> verify`,全部 PASS 后才允许流转
|
|
144
123
|
|
|
145
|
-
|
|
124
|
+
退出前运行 guard 自动流转:
|
|
146
125
|
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
verify_result: pass
|
|
150
|
-
verified_at: YYYY-MM-DD
|
|
126
|
+
```bash
|
|
127
|
+
bash $COMET_GUARD <change-name> verify --apply
|
|
151
128
|
```
|
|
152
129
|
|
|
153
|
-
|
|
154
|
-
cat openspec/changes/<name>/.comet.yaml
|
|
155
|
-
确认 phase 行的值为 "archive"
|
|
156
|
-
确认 verify_result 行的值为 "pass"
|
|
157
|
-
确认 verified_at 行的值非空(格式为 YYYY-MM-DD)
|
|
158
|
-
如任一字段不匹配,重试写入后再次验证。最多重试 2 次,仍失败则报告错误并终止。
|
|
130
|
+
状态文件自动更新为 `phase: archive`、`verify_result: pass`、`verified_at: YYYY-MM-DD`。
|
|
159
131
|
|
|
160
132
|
## 自动流转
|
|
161
133
|
|