@rpamis/comet 0.3.5 → 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/README.md +14 -2
- package/assets/skills/comet/SKILL.md +20 -13
- 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 +16 -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 +46 -15
- package/assets/skills/comet-design/SKILL.md +11 -11
- package/assets/skills/comet-hotfix/SKILL.md +7 -7
- package/assets/skills/comet-open/SKILL.md +4 -4
- package/assets/skills/comet-tweak/SKILL.md +7 -7
- package/assets/skills/comet-verify/SKILL.md +17 -17
- package/assets/skills-zh/comet/SKILL.md +20 -13
- package/assets/skills-zh/comet-archive/SKILL.md +3 -3
- package/assets/skills-zh/comet-build/SKILL.md +46 -15
- package/assets/skills-zh/comet-design/SKILL.md +11 -11
- package/assets/skills-zh/comet-hotfix/SKILL.md +7 -7
- package/assets/skills-zh/comet-open/SKILL.md +4 -4
- package/assets/skills-zh/comet-tweak/SKILL.md +7 -7
- package/assets/skills-zh/comet-verify/SKILL.md +17 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -309,6 +309,7 @@ All states and execution phases are updated via scripts, and each phase verifies
|
|
|
309
309
|
workflow: full
|
|
310
310
|
phase: build
|
|
311
311
|
build_mode: subagent-driven-development
|
|
312
|
+
build_pause: null
|
|
312
313
|
isolation: branch
|
|
313
314
|
verify_mode: null
|
|
314
315
|
design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
@@ -325,7 +326,7 @@ handoff_context: openspec/changes/<name>/.comet/handoff/design-context.json
|
|
|
325
326
|
handoff_hash: <sha256>
|
|
326
327
|
```
|
|
327
328
|
|
|
328
|
-
In full workflow, `build_mode`, `isolation`, and `verify_mode` may temporarily be `null`; `build_mode` and `isolation` must be resolved before `build → verify`. `verification_report` stays `null` until verification writes a report, and `verify-pass` requires that report to exist plus `branch_status: handled`. Fields after `archived` in the example are optional or script-derived: `direct_override` is only needed for full-workflow direct builds, project commands may be absent unless configured, and `handoff_context` / `handoff_hash` are recorded by `comet-handoff.sh` before leaving design. Projects can configure `build_command` / `verify_command` in the change or repo root, and guard will run those commands first and print failure output.
|
|
329
|
+
In full workflow, `build_mode`, `build_pause`, `isolation`, and `verify_mode` may temporarily be `null`; `build_mode` and `isolation` must be resolved before `build → verify`. `build_pause` records an internal build-phase pause point: `null` means no pause, while `plan-ready` means the plan has been generated and the user paused before choosing isolation and execution mode. It is not an execution mode and must not be written into `build_mode`. `verification_report` stays `null` until verification writes a report, and `verify-pass` requires that report to exist plus `branch_status: handled`. Fields after `archived` in the example are optional or script-derived: `direct_override` is only needed for full-workflow direct builds, project commands may be absent unless configured, and `handoff_context` / `handoff_hash` are recorded by `comet-handoff.sh` before leaving design. Projects can configure `build_command` / `verify_command` in the change or repo root, and guard will run those commands first and print failure output.
|
|
329
330
|
|
|
330
331
|
</details>
|
|
331
332
|
|
|
@@ -355,6 +356,7 @@ Comet ensures agent execution reliability through automated state transitions:
|
|
|
355
356
|
4. **Build Decision Enforcement** — Guard and state transitions both block skipped build choices
|
|
356
357
|
- `isolation` must be `branch` or `worktree`
|
|
357
358
|
- `build_mode` must be selected before leaving build
|
|
359
|
+
- `build_pause: plan-ready` is a recoverable pause after plan generation, not a `build_mode`
|
|
358
360
|
- Full workflow `build_mode: direct` requires `direct_override: true`
|
|
359
361
|
|
|
360
362
|
5. **Verification Evidence** — Guard enforces proof before phase advance
|
|
@@ -419,13 +421,23 @@ Track our development progress and upcoming features on the [Comet Roadmap](http
|
|
|
419
421
|
## Contributors
|
|
420
422
|
|
|
421
423
|
<a href="https://github.com/rpamis/comet/graphs/contributors">
|
|
422
|
-
<img src="https://contrib.rocks/image?repo=rpamis/comet&
|
|
424
|
+
<img src="https://contrib.rocks/image?repo=rpamis/comet&columns=12&anon=1" />
|
|
423
425
|
</a>
|
|
424
426
|
|
|
425
427
|
## License
|
|
426
428
|
|
|
427
429
|
[MIT](LICENSE)
|
|
428
430
|
|
|
431
|
+
## Community
|
|
432
|
+
|
|
433
|
+
<p align="center">
|
|
434
|
+
<img src="https://github.com/rpamis/comet/blob/master/img/wechat.jpg" alt="WeChat Group" width="200" />
|
|
435
|
+
|
|
436
|
+
<img src="https://github.com/rpamis/comet/blob/master/img/qq.jpg" alt="QQ Group" width="200" />
|
|
437
|
+
</p>
|
|
438
|
+
|
|
439
|
+
<p align="center">WeChat Group | QQ Group</p>
|
|
440
|
+
|
|
429
441
|
## Reference
|
|
430
442
|
|
|
431
443
|
[LINUX DO - 新的理想型社区](https://linux.do/)
|
|
@@ -53,9 +53,13 @@ Prefer reading `openspec/changes/<name>/.comet.yaml`. If not available, fall bac
|
|
|
53
53
|
**Resume rules**:
|
|
54
54
|
- On every context resume, rerun Step 0 and Step 1; do not trust conversation history for phase detection
|
|
55
55
|
- If there is an active change and the worktree has uncommitted changes, handle them through `comet/reference/dirty-worktree.md`. That protocol defines checks, attribution, and prohibitions; this file does not repeat them
|
|
56
|
-
- If `phase: build`, first check
|
|
57
|
-
- If `
|
|
58
|
-
- If `
|
|
56
|
+
- If `phase: build`, first check `build_pause`, `plan`, `build_mode`, and `isolation`:
|
|
57
|
+
- If `build_pause: plan-ready` and the plan file exists, return to the `/comet-build` plan-ready resume point, prompt the user to continue choosing isolation and execution method, and do not regenerate the plan
|
|
58
|
+
- If `build_pause: plan-ready` but the plan file is missing, return to `/comet-build` to handle corrupted state or regenerate the plan
|
|
59
|
+
- If `build_mode` or `isolation` is unset, return to the corresponding `/comet-build` step to supplement before executing
|
|
60
|
+
- If both are set, read the next unchecked task from tasks.md and continue
|
|
61
|
+
- If `phase: verify` and `verify_result: fail`, enter the verification failure decision blocking point: pause and ask the user to fix or accept deviation; only after the user chooses fix, run `"$COMET_BASH" "$COMET_STATE" transition <name> verify-fail` and invoke `/comet-build`
|
|
62
|
+
- If `phase: open` but proposal/design/tasks are complete, first run `"$COMET_BASH" "$COMET_GUARD" <change-name> open --apply` to repair state, then continue detection
|
|
59
63
|
- If `phase: archive`, only invoke `/comet-archive`; after archive succeeds, the change moves to the archive directory, so do not run guard against the old active directory
|
|
60
64
|
|
|
61
65
|
**Step 2: Phase Determination** (check in order, first match wins)
|
|
@@ -92,7 +96,7 @@ If metadata conflicts with file state, use verifiable file state as source of tr
|
|
|
92
96
|
|----------|----------|
|
|
93
97
|
| `openspec list --json` fails | Check if openspec is installed, prompt user to run `openspec init` |
|
|
94
98
|
| Sub-skill unavailable | Stop workflow, prompt to install or enable the corresponding skill |
|
|
95
|
-
| `.comet.yaml` malformed or missing | Use file state as source of truth, correct with `
|
|
99
|
+
| `.comet.yaml` malformed or missing | Use file state as source of truth, correct with `"$COMET_BASH" "$COMET_STATE" set` then continue |
|
|
96
100
|
| Build/test fails | Return to build phase for fixes, do not enter verify |
|
|
97
101
|
| Incomplete change directory structure | Fill missing files according to `comet-open` artifact requirements |
|
|
98
102
|
|
|
@@ -110,7 +114,7 @@ Flow chain: open → design → build → verify → archive
|
|
|
110
114
|
Nodes requiring user participation (pause only at these nodes):
|
|
111
115
|
1. Open phase proposal/design/tasks review and confirmation
|
|
112
116
|
2. Confirm design approach during brainstorming
|
|
113
|
-
3.
|
|
117
|
+
3. Plan-ready pause choice during build phase, followed by workflow configuration selection (isolation + execution method)
|
|
114
118
|
4. Decide to fix or accept deviation when verify fails (including Spec drift handling)
|
|
115
119
|
5. Choose branch handling method for finishing-branch
|
|
116
120
|
6. Encounter upgrade conditions (hotfix/tweak → full workflow)
|
|
@@ -171,6 +175,7 @@ design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
|
171
175
|
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
172
176
|
base_ref: a1b2c3d4e5f6...
|
|
173
177
|
build_mode: subagent-driven-development
|
|
178
|
+
build_pause: null
|
|
174
179
|
isolation: branch
|
|
175
180
|
verify_mode: light
|
|
176
181
|
verify_result: pending
|
|
@@ -189,6 +194,7 @@ archived: false
|
|
|
189
194
|
| `plan` | Associated Superpowers Plan path, can be empty |
|
|
190
195
|
| `base_ref` | Git commit SHA recorded at init, used for scale assessment. Serves as fallback when no plan exists |
|
|
191
196
|
| `build_mode` | Selected execution method, can be empty |
|
|
197
|
+
| `build_pause` | Internal build-phase pause point. `null` means no pause; `plan-ready` means the plan has been generated and the user chose to pause for switching models |
|
|
192
198
|
| `isolation` | `branch` or `worktree`, workspace isolation method. Full workflow init may leave this as `null`, but only until `/comet-build` Step 3; hotfix/tweak default to `branch` |
|
|
193
199
|
| `verify_mode` | `light` or `full`, can be empty |
|
|
194
200
|
| `verify_result` | `pending`, `pass`, or `fail` |
|
|
@@ -210,6 +216,7 @@ State-machine hard constraints:
|
|
|
210
216
|
- Before `build → verify`, `isolation` must be `branch` or `worktree`
|
|
211
217
|
- Before `build → verify`, `build_mode` must be selected
|
|
212
218
|
- `build_mode: direct` is allowed by default only for `hotfix` / `tweak`; full workflow requires `direct_override: true`
|
|
219
|
+
- `build_pause` is not an execution method and must not be written to `build_mode`
|
|
213
220
|
- These constraints are enforced by both `comet-guard.sh build --apply` and `comet-state.sh transition <name> build-complete`
|
|
214
221
|
|
|
215
222
|
### Script Location
|
|
@@ -235,24 +242,24 @@ fi
|
|
|
235
242
|
**Auto state update**: Guard supports `--apply` flag, automatically updating `.comet.yaml` state fields after checks pass:
|
|
236
243
|
|
|
237
244
|
```bash
|
|
238
|
-
|
|
245
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> <phase> --apply
|
|
239
246
|
```
|
|
240
247
|
|
|
241
248
|
`--apply` delegates to `comet-state transition`. Use these semantic events when state changes need to be expressed directly:
|
|
242
249
|
|
|
243
250
|
```bash
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> open-complete
|
|
252
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> design-complete
|
|
253
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> build-complete
|
|
254
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-pass
|
|
255
|
+
"$COMET_BASH" "$COMET_STATE" transition <change-name> verify-fail
|
|
256
|
+
"$COMET_BASH" "$COMET_STATE" transition <archive-name> archived
|
|
250
257
|
```
|
|
251
258
|
|
|
252
259
|
**Archive script**: Complete all archive steps in one command:
|
|
253
260
|
|
|
254
261
|
```bash
|
|
255
|
-
|
|
262
|
+
"$COMET_BASH" "$COMET_ARCHIVE" <change-name>
|
|
256
263
|
```
|
|
257
264
|
|
|
258
265
|
After loading comet, agents should run the variable assignments above once, then reuse `$COMET_GUARD`, `$COMET_STATE`, `$COMET_HANDOFF`, `$COMET_ARCHIVE` throughout the session.
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
set -euo pipefail
|
|
7
7
|
|
|
8
|
+
COMET_BASH="${COMET_BASH:-${BASH:-bash}}"
|
|
9
|
+
|
|
8
10
|
red() { echo -e "\033[31m$1\033[0m" >&2; }
|
|
9
11
|
green() { echo -e "\033[32m$1\033[0m" >&2; }
|
|
10
12
|
yellow() { echo -e "\033[33m$1\033[0m" >&2; }
|
|
@@ -70,7 +72,7 @@ echo "=== Comet Archive: $CHANGE ===" >&2
|
|
|
70
72
|
yaml_field() {
|
|
71
73
|
local field="$1"
|
|
72
74
|
if [ -f "$STATE_SH" ]; then
|
|
73
|
-
|
|
75
|
+
"$COMET_BASH" "$STATE_SH" get "$CHANGE" "$field" 2>/dev/null
|
|
74
76
|
else
|
|
75
77
|
if [ -f "$YAML" ]; then
|
|
76
78
|
local value
|
|
@@ -270,7 +272,7 @@ if [ "$DRY_RUN" -eq 1 ]; then
|
|
|
270
272
|
step_dry_run "Would set archived: true in $ARCHIVE_YAML"
|
|
271
273
|
else
|
|
272
274
|
if [ -f "$ARCHIVE_YAML" ]; then
|
|
273
|
-
|
|
275
|
+
"$COMET_BASH" "$STATE_SH" transition "$ARCHIVE_NAME" archived >/dev/null
|
|
274
276
|
step_ok "archived: true"
|
|
275
277
|
else
|
|
276
278
|
step_fail "archived: true (.comet.yaml not found after move)"
|
|
@@ -17,15 +17,65 @@ export COMET_HANDOFF="${COMET_HANDOFF:-${_comet_script_dir}/comet-handoff.sh}"
|
|
|
17
17
|
export COMET_ARCHIVE="${COMET_ARCHIVE:-${_comet_script_dir}/comet-archive.sh}"
|
|
18
18
|
export COMET_YAML_VALIDATE="${COMET_YAML_VALIDATE:-${_comet_script_dir}/comet-yaml-validate.sh}"
|
|
19
19
|
|
|
20
|
+
_comet_bash_is_usable() {
|
|
21
|
+
local _comet_bash_candidate="$1"
|
|
22
|
+
if [ -z "$_comet_bash_candidate" ]; then
|
|
23
|
+
return 1
|
|
24
|
+
fi
|
|
25
|
+
case "$_comet_bash_candidate" in
|
|
26
|
+
*/Windows/System32/bash.exe|*/windows/system32/bash.exe|*\\Windows\\System32\\bash.exe|*\\windows\\system32\\bash.exe)
|
|
27
|
+
return 1
|
|
28
|
+
;;
|
|
29
|
+
esac
|
|
30
|
+
"$_comet_bash_candidate" -lc 'printf comet-bash-ok' >/dev/null 2>&1
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_comet_resolve_bash() {
|
|
34
|
+
local _comet_bash_candidate
|
|
35
|
+
|
|
36
|
+
if _comet_bash_is_usable "${COMET_BASH:-}"; then
|
|
37
|
+
printf '%s\n' "$COMET_BASH"
|
|
38
|
+
return 0
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
if _comet_bash_is_usable "${BASH:-}"; then
|
|
42
|
+
printf '%s\n' "$BASH"
|
|
43
|
+
return 0
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
_comet_bash_candidate="$(command -v sh 2>/dev/null | awk '{ sub(/\/sh(\.exe)?$/, "/bash.exe"); print }')"
|
|
47
|
+
if _comet_bash_is_usable "$_comet_bash_candidate"; then
|
|
48
|
+
printf '%s\n' "$_comet_bash_candidate"
|
|
49
|
+
return 0
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
_comet_bash_candidate="$(command -v bash 2>/dev/null || true)"
|
|
53
|
+
if _comet_bash_is_usable "$_comet_bash_candidate"; then
|
|
54
|
+
printf '%s\n' "$_comet_bash_candidate"
|
|
55
|
+
return 0
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
return 1
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
COMET_BASH="$(_comet_resolve_bash || true)"
|
|
62
|
+
export COMET_BASH
|
|
63
|
+
|
|
20
64
|
_comet_env_fail() {
|
|
21
65
|
echo "ERROR: Comet scripts not found. Ensure the comet skill is installed completely." >&2
|
|
22
66
|
echo "Expected path pattern: */comet/scripts/comet-*.sh under project or platform skill directories" >&2
|
|
23
67
|
}
|
|
24
68
|
|
|
69
|
+
_comet_bash_fail() {
|
|
70
|
+
echo "ERROR: usable bash not found. Install Git Bash or set COMET_BASH to a working bash executable." >&2
|
|
71
|
+
echo "Windows WSL launcher bash.exe is not supported for Comet scripts." >&2
|
|
72
|
+
}
|
|
73
|
+
|
|
25
74
|
_comet_env_abort() {
|
|
26
75
|
local _comet_env_was_sourced="$_comet_env_sourced"
|
|
27
76
|
unset _comet_env_source _comet_script_dir _comet_script _comet_env_missing _comet_env_sourced
|
|
28
|
-
unset
|
|
77
|
+
unset _comet_bash_candidate
|
|
78
|
+
unset -f _comet_env_fail _comet_bash_fail _comet_bash_is_usable _comet_resolve_bash
|
|
29
79
|
if [ "$_comet_env_was_sourced" -eq 1 ]; then
|
|
30
80
|
unset -f _comet_env_abort
|
|
31
81
|
return 1
|
|
@@ -34,6 +84,10 @@ _comet_env_abort() {
|
|
|
34
84
|
}
|
|
35
85
|
|
|
36
86
|
_comet_env_missing=0
|
|
87
|
+
if [ -z "$COMET_BASH" ]; then
|
|
88
|
+
_comet_bash_fail
|
|
89
|
+
_comet_env_missing=1
|
|
90
|
+
fi
|
|
37
91
|
for _comet_script in \
|
|
38
92
|
"$COMET_GUARD" \
|
|
39
93
|
"$COMET_STATE" \
|
|
@@ -51,5 +105,6 @@ if [ "$_comet_env_missing" -ne 0 ]; then
|
|
|
51
105
|
_comet_env_abort
|
|
52
106
|
else
|
|
53
107
|
unset _comet_env_source _comet_script_dir _comet_script _comet_env_missing _comet_env_sourced
|
|
54
|
-
unset
|
|
108
|
+
unset _comet_bash_candidate
|
|
109
|
+
unset -f _comet_env_fail _comet_bash_fail _comet_bash_is_usable _comet_resolve_bash _comet_env_abort
|
|
55
110
|
fi
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
set -euo pipefail
|
|
9
9
|
|
|
10
|
+
COMET_BASH="${COMET_BASH:-${BASH:-bash}}"
|
|
11
|
+
|
|
10
12
|
red() { echo -e "\033[31m$1\033[0m" >&2; }
|
|
11
13
|
green() { echo -e "\033[32m$1\033[0m" >&2; }
|
|
12
14
|
warn() { echo -e "\033[33m$1\033[0m" >&2; }
|
|
@@ -181,7 +183,7 @@ is_windows_bash() {
|
|
|
181
183
|
run_command_string() {
|
|
182
184
|
local command="$1"
|
|
183
185
|
echo "+ $command" >&2
|
|
184
|
-
|
|
186
|
+
"$COMET_BASH" -lc "$command"
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
hash_stream() {
|
|
@@ -240,8 +242,8 @@ preflight() {
|
|
|
240
242
|
local validate_script
|
|
241
243
|
validate_script="$SCRIPT_DIR/comet-yaml-validate.sh"
|
|
242
244
|
if [ -f "$validate_script" ]; then
|
|
243
|
-
if !
|
|
244
|
-
|
|
245
|
+
if ! "$COMET_BASH" "$validate_script" "$CHANGE" 2>/dev/null; then
|
|
246
|
+
"$COMET_BASH" "$validate_script" "$CHANGE" || true
|
|
245
247
|
red "FATAL: .comet.yaml schema validation failed"
|
|
246
248
|
exit 1
|
|
247
249
|
fi
|
|
@@ -300,7 +302,7 @@ isolation_selected() {
|
|
|
300
302
|
*)
|
|
301
303
|
echo "isolation must be branch or worktree, got '${isolation:-null}'" >&2
|
|
302
304
|
echo "Next: ask the user to choose branch or worktree, create the chosen isolation, then run:" >&2
|
|
303
|
-
echo "
|
|
305
|
+
echo " \"\$COMET_BASH\" \"\$COMET_STATE\" set $CHANGE isolation <branch|worktree>" >&2
|
|
304
306
|
return 1
|
|
305
307
|
;;
|
|
306
308
|
esac
|
|
@@ -313,8 +315,8 @@ build_mode_selected() {
|
|
|
313
315
|
subagent-driven-development|executing-plans|direct) return 0 ;;
|
|
314
316
|
*)
|
|
315
317
|
echo "build_mode must be selected before leaving build, got '${build_mode:-null}'" >&2
|
|
316
|
-
echo "Next: ask the user to choose an
|
|
317
|
-
echo "
|
|
318
|
+
echo "Next: ask the user to choose an execution mode, then run:" >&2
|
|
319
|
+
echo " \"\$COMET_BASH\" \"\$COMET_STATE\" set $CHANGE build_mode <subagent-driven-development|executing-plans>" >&2
|
|
318
320
|
return 1
|
|
319
321
|
;;
|
|
320
322
|
esac
|
|
@@ -336,7 +338,7 @@ build_mode_allowed_for_workflow() {
|
|
|
336
338
|
return 0
|
|
337
339
|
fi
|
|
338
340
|
echo "build_mode=direct is only allowed for hotfix/tweak unless direct_override: true is recorded" >&2
|
|
339
|
-
echo "Next:
|
|
341
|
+
echo "Next: choose executing-plans or subagent-driven-development, or stop and ask the user for an explicit direct override." >&2
|
|
340
342
|
return 1
|
|
341
343
|
;;
|
|
342
344
|
esac
|
|
@@ -367,7 +369,7 @@ design_handoff_context_valid() {
|
|
|
367
369
|
|
|
368
370
|
if [ -z "$context" ] || [ "$context" = "null" ]; then
|
|
369
371
|
echo "handoff_context is missing from .comet.yaml" >&2
|
|
370
|
-
echo "Next: run
|
|
372
|
+
echo "Next: run \"\$COMET_BASH\" \"\$COMET_HANDOFF\" $CHANGE design --write before invoking Superpowers." >&2
|
|
371
373
|
return 1
|
|
372
374
|
fi
|
|
373
375
|
if [ ! -s "$context" ]; then
|
|
@@ -545,10 +547,10 @@ apply_state_update() {
|
|
|
545
547
|
|
|
546
548
|
if [ -f "$state_sh" ]; then
|
|
547
549
|
case "$p" in
|
|
548
|
-
open)
|
|
549
|
-
design)
|
|
550
|
-
build)
|
|
551
|
-
verify)
|
|
550
|
+
open) "$COMET_BASH" "$state_sh" transition "$CHANGE" open-complete ;;
|
|
551
|
+
design) "$COMET_BASH" "$state_sh" transition "$CHANGE" design-complete ;;
|
|
552
|
+
build) "$COMET_BASH" "$state_sh" transition "$CHANGE" build-complete ;;
|
|
553
|
+
verify) "$COMET_BASH" "$state_sh" transition "$CHANGE" verify-pass ;;
|
|
552
554
|
esac
|
|
553
555
|
else
|
|
554
556
|
red "FATAL: comet-state.sh not found; cannot apply state transition"
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
set -euo pipefail
|
|
6
6
|
|
|
7
|
+
COMET_BASH="${COMET_BASH:-${BASH:-bash}}"
|
|
8
|
+
|
|
7
9
|
red() { echo -e "\033[31m$1\033[0m" >&2; }
|
|
8
10
|
green() { echo -e "\033[32m$1\033[0m" >&2; }
|
|
9
11
|
|
|
@@ -249,8 +251,8 @@ write_markdown_context "$CONTEXT_MD"
|
|
|
249
251
|
write_json_context "$CONTEXT_JSON"
|
|
250
252
|
|
|
251
253
|
if [ -x "$STATE_SH" ] || [ -f "$STATE_SH" ]; then
|
|
252
|
-
|
|
253
|
-
|
|
254
|
+
"$COMET_BASH" "$STATE_SH" set "$CHANGE" handoff_context "$CONTEXT_JSON" >/dev/null
|
|
255
|
+
"$COMET_BASH" "$STATE_SH" set "$CHANGE" handoff_hash "$CONTEXT_HASH" >/dev/null
|
|
254
256
|
else
|
|
255
257
|
red "ERROR: comet-state.sh not found; cannot record handoff fields"
|
|
256
258
|
exit 1
|
|
@@ -205,6 +205,7 @@ cmd_init() {
|
|
|
205
205
|
workflow: $workflow
|
|
206
206
|
phase: $phase
|
|
207
207
|
build_mode: $build_mode
|
|
208
|
+
build_pause: null
|
|
208
209
|
isolation: $isolation
|
|
209
210
|
verify_mode: $verify_mode
|
|
210
211
|
base_ref: $base_ref
|
|
@@ -264,13 +265,13 @@ cmd_set() {
|
|
|
264
265
|
yellow "WARNING: Setting 'phase' directly bypasses state machine constraints." >&2
|
|
265
266
|
yellow " Consider using: comet-state.sh transition <change-name> <event>" >&2
|
|
266
267
|
;;
|
|
267
|
-
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)
|
|
268
269
|
# Valid field
|
|
269
270
|
;;
|
|
270
271
|
*)
|
|
271
272
|
red "ERROR: Unknown field: '$field'" >&2
|
|
272
273
|
red "Valid fields:" >&2
|
|
273
|
-
red " workflow, phase, design_doc, plan, build_mode, isolation," >&2
|
|
274
|
+
red " workflow, phase, design_doc, plan, build_mode, build_pause, isolation," >&2
|
|
274
275
|
red " verify_mode, verify_result, verification_report, branch_status," >&2
|
|
275
276
|
red " verified_at, created_at, archived, base_ref, direct_override," >&2
|
|
276
277
|
red " build_command, verify_command, handoff_context, handoff_hash" >&2
|
|
@@ -289,6 +290,9 @@ cmd_set() {
|
|
|
289
290
|
build_mode)
|
|
290
291
|
validate_enum "$value" "subagent-driven-development" "executing-plans" "direct"
|
|
291
292
|
;;
|
|
293
|
+
build_pause)
|
|
294
|
+
validate_enum "$value" "null" "plan-ready"
|
|
295
|
+
;;
|
|
292
296
|
isolation)
|
|
293
297
|
validate_enum "$value" "branch" "worktree"
|
|
294
298
|
;;
|
|
@@ -632,7 +636,7 @@ cmd_recover() {
|
|
|
632
636
|
|
|
633
637
|
# Read all relevant fields
|
|
634
638
|
local design_doc plan verify_result verify_mode verification_report
|
|
635
|
-
local branch_status handoff_context handoff_hash isolation build_mode direct_override
|
|
639
|
+
local branch_status handoff_context handoff_hash isolation build_mode build_pause direct_override
|
|
636
640
|
design_doc=$(cmd_get "$change_name" "design_doc")
|
|
637
641
|
plan=$(cmd_get "$change_name" "plan")
|
|
638
642
|
verify_result=$(cmd_get "$change_name" "verify_result")
|
|
@@ -643,6 +647,7 @@ cmd_recover() {
|
|
|
643
647
|
handoff_hash=$(cmd_get "$change_name" "handoff_hash")
|
|
644
648
|
isolation=$(cmd_get "$change_name" "isolation")
|
|
645
649
|
build_mode=$(cmd_get "$change_name" "build_mode")
|
|
650
|
+
build_pause=$(cmd_get "$change_name" "build_pause" 2>/dev/null || true)
|
|
646
651
|
direct_override=$(cmd_get "$change_name" "direct_override" 2>/dev/null || true)
|
|
647
652
|
|
|
648
653
|
echo "State fields:"
|
|
@@ -688,6 +693,7 @@ cmd_recover() {
|
|
|
688
693
|
echo " Build decisions:"
|
|
689
694
|
field_status "isolation" "$isolation"
|
|
690
695
|
field_status "build_mode" "$build_mode"
|
|
696
|
+
field_status "build_pause" "$build_pause"
|
|
691
697
|
if [ "$build_mode" = "direct" ] && [ "$workflow" != "hotfix" ] && [ "$workflow" != "tweak" ]; then
|
|
692
698
|
field_status "direct_override" "$direct_override"
|
|
693
699
|
fi
|
|
@@ -707,7 +713,13 @@ cmd_recover() {
|
|
|
707
713
|
echo " Tasks: tasks.md MISSING"
|
|
708
714
|
fi
|
|
709
715
|
echo ""
|
|
710
|
-
if [ "$isolation" = "null" ] || [ -z "$isolation" ]; then
|
|
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
|
|
711
723
|
echo "Recovery action: Isolation not selected. Use AskUserQuestion to ask user for branch/worktree choice."
|
|
712
724
|
elif [ "$build_mode" = "null" ] || [ -z "$build_mode" ]; then
|
|
713
725
|
echo "Recovery action: Build mode not selected. Use AskUserQuestion to ask user for execution method."
|
|
@@ -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,7 +23,7 @@ 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.
|
|
@@ -32,7 +32,7 @@ Proceed to Step 1 after verification passes. The script outputs specific failure
|
|
|
32
32
|
|
|
33
33
|
### 1. Create Plan
|
|
34
34
|
|
|
35
|
-
**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.
|
|
36
36
|
|
|
37
37
|
After the skill loads, follow its guidance to create a plan. Plan requirements:
|
|
38
38
|
- Save to `docs/superpowers/plans/YYYY-MM-DD-<feature>.md`
|
|
@@ -53,18 +53,49 @@ base-ref: <git rev-parse HEAD before implementation>
|
|
|
53
53
|
git rev-parse HEAD
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
### 2. Update Plan Status
|
|
56
|
+
### 2. Update Plan Status and Provide Plan-Ready Pause Point
|
|
57
57
|
|
|
58
58
|
Record plan path:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
|
|
61
|
+
"$COMET_BASH" "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
No manual phase update needed — guard auto-transitions when exit conditions are met.
|
|
65
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
|
+
|
|
66
89
|
### 3. Select Workflow Configuration
|
|
67
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
|
+
|
|
68
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**:
|
|
69
100
|
|
|
70
101
|
**Workspace Isolation**:
|
|
@@ -82,8 +113,8 @@ Plan has been written to the current branch. Before starting execution, **ask th
|
|
|
82
113
|
|
|
83
114
|
| Option | Skill | Applicable Scenario |
|
|
84
115
|
|------|------|-------------------|
|
|
85
|
-
| A | `
|
|
86
|
-
| 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 |
|
|
87
118
|
|
|
88
119
|
**Execution method recommendation rules**:
|
|
89
120
|
- Task count ≥ 3 → Recommend A
|
|
@@ -95,8 +126,8 @@ This is a user decision point. **Must use the AskUserQuestion tool to pause and
|
|
|
95
126
|
After user selection, update `isolation` and `build_mode` fields:
|
|
96
127
|
|
|
97
128
|
```bash
|
|
98
|
-
|
|
99
|
-
|
|
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>
|
|
100
131
|
```
|
|
101
132
|
|
|
102
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.
|
|
@@ -104,8 +135,8 @@ bash "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing
|
|
|
104
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:
|
|
105
136
|
|
|
106
137
|
```bash
|
|
107
|
-
|
|
108
|
-
|
|
138
|
+
"$COMET_BASH" "$COMET_STATE" set <name> direct_override true
|
|
139
|
+
"$COMET_BASH" "$COMET_STATE" set <name> build_mode direct
|
|
109
140
|
```
|
|
110
141
|
|
|
111
142
|
Without `direct_override: true`, `build_mode=direct` in full workflow is blocked by both guard and state transition.
|
|
@@ -113,7 +144,7 @@ Without `direct_override: true`, `build_mode=direct` in full workflow is blocked
|
|
|
113
144
|
**Execute isolation**:
|
|
114
145
|
|
|
115
146
|
- **branch**: Run `git checkout -b <change-name>`, subsequent work on the new branch
|
|
116
|
-
- **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.
|
|
117
148
|
|
|
118
149
|
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed).
|
|
119
150
|
|
|
@@ -133,7 +164,7 @@ When the initial spec is found incomplete during implementation, handle by scale
|
|
|
133
164
|
| Scale | Trigger Conditions | Approach |
|
|
134
165
|
|------|-------------------|----------|
|
|
135
166
|
| Small | Missing acceptance scenarios, edge cases | Directly edit delta spec + design.md, append tasks.md tasks |
|
|
136
|
-
| 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 `
|
|
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 |
|
|
137
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` |
|
|
138
169
|
|
|
139
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.
|
|
@@ -151,7 +182,7 @@ When creating an independent change, must invoke `/comet-open`, not `/opsx:new`
|
|
|
151
182
|
Build is the longest phase and may span many tasks. To support resume after context compaction:
|
|
152
183
|
|
|
153
184
|
- **After each task**: immediately check off tasks.md and commit code so `.comet.yaml` and file state are durable
|
|
154
|
-
- **After context compaction**: first run `
|
|
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.
|
|
155
186
|
- **User manual-change resume**: handle uncommitted changes through `comet/reference/dirty-worktree.md`. That protocol defines checks, attribution, and prohibitions. Build-specific handling:
|
|
156
187
|
1. After attribution, if the diff implies plan or spec changes, handle it through Step 4 "Spec Incremental Updates"
|
|
157
188
|
- **Long task split**: if a single task exceeds 200 lines of code changes, consider splitting it into multiple subtasks and commits
|
|
@@ -163,7 +194,7 @@ Build is the longest phase and may span many tasks. To support resume after cont
|
|
|
163
194
|
- Project-specific build/tests explicitly run and pass; do not rely only on guard auto-detection
|
|
164
195
|
- `isolation` has been written as `branch` or `worktree`
|
|
165
196
|
- `build_mode` has been written as `subagent-driven-development`, `executing-plans`, or `direct` with explicit override
|
|
166
|
-
- **Phase guard**: Run `
|
|
197
|
+
- **Phase guard**: Run `"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply`; after all PASS, state advances to `phase: verify`
|
|
167
198
|
|
|
168
199
|
Guard reads project command configuration first:
|
|
169
200
|
|
|
@@ -178,7 +209,7 @@ Only when no command is configured does guard fall back to `npm run build`, Mave
|
|
|
178
209
|
Before exit, run guard to auto-transition:
|
|
179
210
|
|
|
180
211
|
```bash
|
|
181
|
-
|
|
212
|
+
"$COMET_BASH" "$COMET_GUARD" <change-name> build --apply
|
|
182
213
|
```
|
|
183
214
|
|
|
184
215
|
State file is automatically updated to `phase: verify`, `verify_result: pending`.
|