@rpamis/comet 0.3.0 → 0.3.2
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/assets/manifest.json +2 -1
- package/assets/skills/comet/SKILL.md +42 -30
- package/assets/skills/comet/scripts/comet-env.sh +55 -0
- package/assets/skills/comet/scripts/comet-state.sh +25 -9
- package/assets/skills/comet/scripts/comet-yaml-validate.sh +1 -1
- package/assets/skills/comet-archive/SKILL.md +8 -4
- package/assets/skills/comet-build/SKILL.md +36 -44
- package/assets/skills/comet-design/SKILL.md +93 -23
- package/assets/skills/comet-hotfix/SKILL.md +40 -25
- package/assets/skills/comet-open/SKILL.md +37 -30
- package/assets/skills/comet-tweak/SKILL.md +35 -22
- package/assets/skills/comet-verify/SKILL.md +70 -49
- package/assets/skills-zh/comet/SKILL.md +22 -14
- package/assets/skills-zh/comet-archive/SKILL.md +6 -2
- package/assets/skills-zh/comet-build/SKILL.md +35 -43
- package/assets/skills-zh/comet-design/SKILL.md +29 -9
- package/assets/skills-zh/comet-hotfix/SKILL.md +39 -24
- package/assets/skills-zh/comet-open/SKILL.md +9 -4
- package/assets/skills-zh/comet-tweak/SKILL.md +21 -8
- package/assets/skills-zh/comet-verify/SKILL.md +36 -15
- package/bin/comet.js +3 -3
- package/dist/commands/update.js +1 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/core/command-error.d.ts +4 -0
- package/dist/core/command-error.d.ts.map +1 -0
- package/dist/core/command-error.js +53 -0
- package/dist/core/command-error.js.map +1 -0
- package/dist/core/detect.d.ts.map +1 -1
- package/dist/core/detect.js +33 -4
- package/dist/core/detect.js.map +1 -1
- package/dist/core/openspec.d.ts.map +1 -1
- package/dist/core/openspec.js +52 -1
- package/dist/core/openspec.js.map +1 -1
- package/dist/core/platforms.d.ts.map +1 -1
- package/dist/core/platforms.js +14 -2
- package/dist/core/platforms.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +58 -0
- package/dist/core/skills.js.map +1 -1
- package/dist/core/superpowers.d.ts +3 -2
- package/dist/core/superpowers.d.ts.map +1 -1
- package/dist/core/superpowers.js +75 -9
- package/dist/core/superpowers.js.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +44 -44
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 rpamis
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 rpamis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/assets/manifest.json
CHANGED
|
@@ -5,7 +5,7 @@ description: "Comet — OpenSpec + Superpowers dual-star development workflow. S
|
|
|
5
5
|
|
|
6
6
|
# Comet — OpenSpec + Superpowers Dual-Star Development Workflow
|
|
7
7
|
|
|
8
|
-
OpenSpec and Superpowers orbit the same goal like a binary star system.
|
|
8
|
+
OpenSpec and Superpowers orbit the same goal like a binary star system.
|
|
9
9
|
|
|
10
10
|
```
|
|
11
11
|
OpenSpec handles WHAT — outline, proposal, spec lifecycle, archive
|
|
@@ -42,7 +42,7 @@ Agents need only read this section for decision-making. Refer to the Reference A
|
|
|
42
42
|
|
|
43
43
|
<IMPORTANT>
|
|
44
44
|
When the user chooses "create a new change", **must invoke `/comet-open`**. Do not call `/opsx:new` directly.
|
|
45
|
-
`/comet-open` performs dual initialization: OpenSpec artifacts plus `.comet.yaml` state.
|
|
45
|
+
`/comet-open` performs dual initialization: OpenSpec artifacts (created by internal `/opsx:new`) plus `.comet.yaml` state file.
|
|
46
46
|
Calling `/opsx:new` directly leaves `.comet.yaml` missing and breaks later phase detection.
|
|
47
47
|
</IMPORTANT>
|
|
48
48
|
|
|
@@ -53,18 +53,18 @@ 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`, read the next unchecked task from tasks.md and continue
|
|
57
|
-
- If `phase: verify` and `verify_result: fail`,
|
|
58
|
-
- If `phase: open` but proposal/design/tasks are complete, run `bash "$COMET_GUARD" <change-name> open --apply` to repair state, then continue detection
|
|
56
|
+
- If `phase: build`, first check whether `build_mode` and `isolation` are set; if any fields are unset, return to `/comet-build` corresponding step to supplement before executing; if both are set, read the next unchecked task from tasks.md and continue
|
|
57
|
+
- 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 `bash "$COMET_STATE" transition <name> verify-fail` and invoke `/comet-build`
|
|
58
|
+
- If `phase: open` but proposal/design/tasks are complete, first run `bash "$COMET_GUARD" <change-name> open --apply` to repair state, then continue detection
|
|
59
59
|
- 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
60
|
|
|
61
61
|
**Step 2: Phase Determination** (check in order, first match wins)
|
|
62
62
|
|
|
63
63
|
1. `archived: true` or change moved to archive → Workflow complete
|
|
64
64
|
2. `verify_result: pass` and `archived` is not `true` → Invoke `/comet-archive`
|
|
65
|
-
3. `verify_result: fail` →
|
|
65
|
+
3. `verify_result: fail` → Enter verification failure decision blocking point (pause and ask fix or accept deviation; only after user chooses fix, run `verify-fail` then `/comet-build`)
|
|
66
66
|
4. `phase: verify` or tasks.md all checked → Invoke `/comet-verify`
|
|
67
|
-
5. `phase: build` or has Design Doc but plan/execution incomplete →
|
|
67
|
+
5. `phase: build` or has Design Doc but plan/execution incomplete → Route by workflow: `hotfix` → `/comet-hotfix`, `tweak` → `/comet-tweak`, `full` → `/comet-build`
|
|
68
68
|
6. `phase: design` or has change but no Design Doc → Invoke `/comet-design`
|
|
69
69
|
7. `phase: open` or active change exists but `.comet.yaml` is missing → Invoke `/comet-open`
|
|
70
70
|
8. No active change → Invoke `/comet-open`
|
|
@@ -103,16 +103,19 @@ A single `/comet` invocation starts from the detected phase and advances to the
|
|
|
103
103
|
|
|
104
104
|
Flow chain: open → design → build → verify → archive
|
|
105
105
|
|
|
106
|
-
**Continuous execution requirement**: starting from the detected phase, the agent must automatically continue through all later phases without
|
|
106
|
+
**Continuous execution requirement**: starting from the detected phase, the agent must automatically continue through all later phases. Auto-advancing only applies at transition points without user decisions. When encountering user decision points, must pause and wait for the user's explicit response. Must not use recommendation rules, defaults, or historical preferences to substitute for user confirmation.
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
**Decision points are blocking points**: whenever reaching any of the following nodes, the current `/comet` invocation must stop. Only after the user explicitly chooses can the corresponding state fields be written and operations executed, then auto-advance resumes.
|
|
109
|
+
|
|
110
|
+
Nodes requiring user participation (pause only at these nodes):
|
|
109
111
|
1. Confirm design approach during brainstorming
|
|
110
|
-
2. Select
|
|
111
|
-
3. Decide to fix or accept deviation when verify fails
|
|
112
|
+
2. Select workflow configuration during build phase (isolation + execution method, single interaction)
|
|
113
|
+
3. Decide to fix or accept deviation when verify fails (including Spec drift handling)
|
|
112
114
|
4. Choose branch handling method for finishing-branch
|
|
113
115
|
5. Encounter upgrade conditions (hotfix/tweak → full workflow)
|
|
116
|
+
6. Build phase scope expansion requiring redesign or new change split
|
|
114
117
|
|
|
115
|
-
Agents should not skip these decision points; other unambiguous phase transitions
|
|
118
|
+
Agents should not skip these decision points; other unambiguous phase transitions must proceed automatically, must not exit midway.
|
|
116
119
|
</IMPORTANT>
|
|
117
120
|
|
|
118
121
|
---
|
|
@@ -137,11 +140,11 @@ Agents should not skip these decision points; other unambiguous phase transition
|
|
|
137
140
|
|
|
138
141
|
/comet-hotfix (preset, skip brainstorming)
|
|
139
142
|
open ──→ build ──→ verify ──→ archive
|
|
140
|
-
↑ If upgrade triggered → supplement Design Doc → return to full workflow
|
|
143
|
+
↑ If upgrade triggered → block for confirmation → supplement Design Doc → return to full workflow
|
|
141
144
|
|
|
142
145
|
/comet-tweak (preset, skip brainstorming and full plan)
|
|
143
146
|
open ──→ lightweight build ──→ light verify ──→ archive
|
|
144
|
-
↑ If upgrade triggered → supplement Design Doc → return to full workflow
|
|
147
|
+
↑ If upgrade triggered → block for confirmation → supplement Design Doc → return to full workflow
|
|
145
148
|
```
|
|
146
149
|
|
|
147
150
|
---
|
|
@@ -155,12 +158,14 @@ workflow: full
|
|
|
155
158
|
phase: build
|
|
156
159
|
design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
157
160
|
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
161
|
+
base_ref: a1b2c3d4e5f6...
|
|
158
162
|
build_mode: subagent-driven-development
|
|
159
163
|
isolation: branch
|
|
160
164
|
verify_mode: light
|
|
161
165
|
verify_result: pending
|
|
162
166
|
verification_report: null
|
|
163
167
|
branch_status: pending
|
|
168
|
+
created_at: 2026-05-26
|
|
164
169
|
verified_at: null
|
|
165
170
|
archived: false
|
|
166
171
|
```
|
|
@@ -168,15 +173,17 @@ archived: false
|
|
|
168
173
|
| Field | Meaning |
|
|
169
174
|
|-------|---------|
|
|
170
175
|
| `workflow` | `full`, `hotfix`, or `tweak` |
|
|
171
|
-
| `phase` | Current phase: `open`, `design`, `build`, `verify`, `archive` |
|
|
176
|
+
| `phase` | Current phase: `open`, `design`, `build`, `verify`, `archive` (init sets to `open` uniformly, guard handles transitions) |
|
|
172
177
|
| `design_doc` | Associated Superpowers Design Doc path, can be empty |
|
|
173
178
|
| `plan` | Associated Superpowers Plan path, can be empty |
|
|
174
|
-
| `
|
|
179
|
+
| `base_ref` | Git commit SHA recorded at init, used for scale assessment. Serves as fallback when no plan exists |
|
|
180
|
+
| `build_mode` | Selected execution method, can be empty |
|
|
175
181
|
| `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` |
|
|
176
182
|
| `verify_mode` | `light` or `full`, can be empty |
|
|
177
183
|
| `verify_result` | `pending`, `pass`, or `fail` |
|
|
178
184
|
| `verification_report` | Verification report file path; must point to an existing file before verify can pass |
|
|
179
185
|
| `branch_status` | `pending` or `handled`; set to `handled` after branch handling completes |
|
|
186
|
+
| `created_at` | Change creation date (auto-set at init), format `YYYY-MM-DD` |
|
|
180
187
|
| `verified_at` | Verification pass time, can be empty |
|
|
181
188
|
| `archived` | Whether change is archived |
|
|
182
189
|
|
|
@@ -199,12 +206,15 @@ State-machine hard constraints:
|
|
|
199
206
|
Comet scripts are distributed in `comet/scripts/`. **Do not hardcode paths** — locate once, cache in env vars:
|
|
200
207
|
|
|
201
208
|
```bash
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
209
|
+
COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
210
|
+
if [ -z "$COMET_ENV" ]; then
|
|
211
|
+
echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
|
|
212
|
+
return 1
|
|
213
|
+
fi
|
|
214
|
+
. "$COMET_ENV"
|
|
206
215
|
|
|
207
|
-
|
|
216
|
+
# Stop workflow when script location fails
|
|
217
|
+
if [ -z "$COMET_GUARD" ] || [ -z "$COMET_STATE" ] || [ -z "$COMET_HANDOFF" ] || [ -z "$COMET_ARCHIVE" ]; then
|
|
208
218
|
echo "ERROR: Comet scripts not found. Ensure the comet skill is installed." >&2
|
|
209
219
|
echo "Expected path pattern: */comet/scripts/comet-*.sh under project or platform skill directories" >&2
|
|
210
220
|
return 1
|
|
@@ -234,7 +244,7 @@ bash "$COMET_STATE" transition <archive-name> archived
|
|
|
234
244
|
bash "$COMET_ARCHIVE" <change-name>
|
|
235
245
|
```
|
|
236
246
|
|
|
237
|
-
After loading comet, agents should run the
|
|
247
|
+
After loading comet, agents should run the variable assignments above once, then reuse `$COMET_GUARD`, `$COMET_STATE`, `$COMET_HANDOFF`, `$COMET_ARCHIVE` throughout the session.
|
|
238
248
|
|
|
239
249
|
### File Structure
|
|
240
250
|
|
|
@@ -248,6 +258,7 @@ openspec/ # OpenSpec — WHAT
|
|
|
248
258
|
│ │ ├── proposal.md # Why + What
|
|
249
259
|
│ │ ├── design.md # High-level architecture decisions
|
|
250
260
|
│ │ ├── specs/<capability>/spec.md # Delta capability spec
|
|
261
|
+
│ │ ├── .comet/handoff/ # Script-generated phase handoff packages
|
|
251
262
|
│ │ └── tasks.md # Task checklist
|
|
252
263
|
│ └── archive/YYYY-MM-DD-<name>/ # Archived
|
|
253
264
|
└── specs/<capability>/spec.md # Main specs (overwritten from delta at archive)
|
|
@@ -261,11 +272,12 @@ docs/superpowers/ # Superpowers — HOW
|
|
|
261
272
|
|
|
262
273
|
1. **brainstorming cannot be skipped** — Every change must undergo deep design (except hotfix and tweak)
|
|
263
274
|
2. **delta spec is a living document** — Freely modify during phase 3, sync at archive
|
|
264
|
-
3. **
|
|
265
|
-
4. **
|
|
266
|
-
5. **
|
|
267
|
-
6. **
|
|
268
|
-
7. **
|
|
269
|
-
8. **
|
|
270
|
-
9. **
|
|
271
|
-
10. **
|
|
275
|
+
3. **Handoff packages are generated by scripts** — OpenSpec → Superpowers context must be generated through `comet-handoff.sh` as compact traceable excerpts (use `--full` when needed), and validated by guard for source/hash/mode
|
|
276
|
+
4. **Keep tasks.md in sync** — Check off each completed task
|
|
277
|
+
5. **Commit frequently** — One commit per task, message reflects design intent
|
|
278
|
+
6. **Verify before archive** — Execute `/comet-archive` only after `/comet-verify` passes
|
|
279
|
+
7. **Classify incremental updates** — Small edits, medium brainstorming, large new changes
|
|
280
|
+
8. **Plan must associate with change** — File header contains `change:` and `design-doc:` metadata
|
|
281
|
+
9. **Archive closure** — design doc and plan must mark `archived-with` status
|
|
282
|
+
10. **Modifying existing features** — Just open a new change
|
|
283
|
+
11. **Preset has limits** — Switch to full workflow promptly when hotfix/tweak meet upgrade conditions
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Comet script locator — source this file to export paths to bundled scripts.
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# . /path/to/comet/scripts/comet-env.sh
|
|
6
|
+
#
|
|
7
|
+
# This file is sourced by workflow snippets. Do not set global shell options here.
|
|
8
|
+
|
|
9
|
+
_comet_env_source="${BASH_SOURCE[0]:-$0}"
|
|
10
|
+
_comet_script_dir="$(cd "$(dirname "$_comet_env_source")" && pwd -P)"
|
|
11
|
+
_comet_env_sourced=0
|
|
12
|
+
(return 0 2>/dev/null) && _comet_env_sourced=1
|
|
13
|
+
|
|
14
|
+
export COMET_GUARD="${COMET_GUARD:-${_comet_script_dir}/comet-guard.sh}"
|
|
15
|
+
export COMET_STATE="${COMET_STATE:-${_comet_script_dir}/comet-state.sh}"
|
|
16
|
+
export COMET_HANDOFF="${COMET_HANDOFF:-${_comet_script_dir}/comet-handoff.sh}"
|
|
17
|
+
export COMET_ARCHIVE="${COMET_ARCHIVE:-${_comet_script_dir}/comet-archive.sh}"
|
|
18
|
+
export COMET_YAML_VALIDATE="${COMET_YAML_VALIDATE:-${_comet_script_dir}/comet-yaml-validate.sh}"
|
|
19
|
+
|
|
20
|
+
_comet_env_fail() {
|
|
21
|
+
echo "ERROR: Comet scripts not found. Ensure the comet skill is installed completely." >&2
|
|
22
|
+
echo "Expected path pattern: */comet/scripts/comet-*.sh under project or platform skill directories" >&2
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_comet_env_abort() {
|
|
26
|
+
local _comet_env_was_sourced="$_comet_env_sourced"
|
|
27
|
+
unset _comet_env_source _comet_script_dir _comet_script _comet_env_missing _comet_env_sourced
|
|
28
|
+
unset -f _comet_env_fail
|
|
29
|
+
if [ "$_comet_env_was_sourced" -eq 1 ]; then
|
|
30
|
+
unset -f _comet_env_abort
|
|
31
|
+
return 1
|
|
32
|
+
fi
|
|
33
|
+
exit 1
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_comet_env_missing=0
|
|
37
|
+
for _comet_script in \
|
|
38
|
+
"$COMET_GUARD" \
|
|
39
|
+
"$COMET_STATE" \
|
|
40
|
+
"$COMET_HANDOFF" \
|
|
41
|
+
"$COMET_ARCHIVE" \
|
|
42
|
+
"$COMET_YAML_VALIDATE"; do
|
|
43
|
+
if [ ! -f "$_comet_script" ]; then
|
|
44
|
+
_comet_env_fail
|
|
45
|
+
_comet_env_missing=1
|
|
46
|
+
break
|
|
47
|
+
fi
|
|
48
|
+
done
|
|
49
|
+
|
|
50
|
+
if [ "$_comet_env_missing" -ne 0 ]; then
|
|
51
|
+
_comet_env_abort
|
|
52
|
+
else
|
|
53
|
+
unset _comet_env_source _comet_script_dir _comet_script _comet_env_missing _comet_env_sourced
|
|
54
|
+
unset -f _comet_env_fail _comet_env_abort
|
|
55
|
+
fi
|
|
@@ -194,17 +194,25 @@ cmd_init() {
|
|
|
194
194
|
esac
|
|
195
195
|
|
|
196
196
|
# Write .comet.yaml
|
|
197
|
+
# Record current HEAD as base_ref for scale assessment fallback
|
|
198
|
+
local base_ref="null"
|
|
199
|
+
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
|
200
|
+
base_ref=$(git rev-parse HEAD 2>/dev/null || echo "null")
|
|
201
|
+
fi
|
|
202
|
+
|
|
197
203
|
cat > "$yaml_file" <<EOF
|
|
198
204
|
workflow: $workflow
|
|
199
205
|
phase: $phase
|
|
200
206
|
build_mode: $build_mode
|
|
201
207
|
isolation: $isolation
|
|
202
208
|
verify_mode: $verify_mode
|
|
209
|
+
base_ref: $base_ref
|
|
203
210
|
design_doc: null
|
|
204
211
|
plan: null
|
|
205
212
|
verify_result: pending
|
|
206
213
|
verification_report: null
|
|
207
214
|
branch_status: pending
|
|
215
|
+
created_at: $(date +%Y-%m-%d)
|
|
208
216
|
verified_at: null
|
|
209
217
|
archived: false
|
|
210
218
|
EOF
|
|
@@ -251,7 +259,11 @@ cmd_set() {
|
|
|
251
259
|
|
|
252
260
|
# Validate field name
|
|
253
261
|
case "$field" in
|
|
254
|
-
|
|
262
|
+
phase)
|
|
263
|
+
yellow "WARNING: Setting 'phase' directly bypasses state machine constraints." >&2
|
|
264
|
+
yellow " Consider using: comet-state.sh transition <change-name> <event>" >&2
|
|
265
|
+
;;
|
|
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)
|
|
255
267
|
# Valid field
|
|
256
268
|
;;
|
|
257
269
|
*)
|
|
@@ -259,8 +271,8 @@ cmd_set() {
|
|
|
259
271
|
red "Valid fields:" >&2
|
|
260
272
|
red " workflow, phase, design_doc, plan, build_mode, isolation," >&2
|
|
261
273
|
red " verify_mode, verify_result, verification_report, branch_status," >&2
|
|
262
|
-
red " verified_at, archived,
|
|
263
|
-
red " verify_command, handoff_context, handoff_hash" >&2
|
|
274
|
+
red " verified_at, created_at, archived, base_ref, direct_override," >&2
|
|
275
|
+
red " build_command, verify_command, handoff_context, handoff_hash" >&2
|
|
264
276
|
exit 1
|
|
265
277
|
;;
|
|
266
278
|
esac
|
|
@@ -294,7 +306,7 @@ cmd_set() {
|
|
|
294
306
|
direct_override)
|
|
295
307
|
validate_enum "$value" "true" "false"
|
|
296
308
|
;;
|
|
297
|
-
design_doc|plan|verification_report|verified_at|build_command|verify_command|handoff_context|handoff_hash)
|
|
309
|
+
design_doc|plan|verification_report|verified_at|created_at|build_command|verify_command|handoff_context|handoff_hash)
|
|
298
310
|
# No validation for path fields, date fields, or project command strings
|
|
299
311
|
;;
|
|
300
312
|
esac
|
|
@@ -605,16 +617,20 @@ cmd_scale() {
|
|
|
605
617
|
delta_spec_count=$(find "$change_dir/specs" -name "spec.md" -type f 2>/dev/null | wc -l | tr -d ' ')
|
|
606
618
|
fi
|
|
607
619
|
|
|
608
|
-
# 3. Changed files: prefer plan base-ref, fall back to worktree diff
|
|
620
|
+
# 3. Changed files: prefer plan base-ref, then .comet.yaml base_ref, fall back to worktree diff
|
|
609
621
|
local changed_files=0
|
|
610
622
|
if git rev-parse --git-dir > /dev/null 2>&1; then
|
|
611
|
-
local plan_file base_ref
|
|
623
|
+
local plan_file base_ref=""
|
|
612
624
|
plan_file=$(cmd_get "$change_name" "plan" 2>/dev/null || true)
|
|
613
625
|
if [ -n "$plan_file" ] && [ "$plan_file" != "null" ] && [ -f "$plan_file" ]; then
|
|
614
626
|
base_ref=$(grep '^base-ref:' "$plan_file" 2>/dev/null | head -1 | sed 's/^base-ref: *//')
|
|
615
627
|
fi
|
|
628
|
+
# Fallback to base_ref stored in .comet.yaml (set during init)
|
|
629
|
+
if [ -z "$base_ref" ] || [ "$base_ref" = "null" ]; then
|
|
630
|
+
base_ref=$(cmd_get "$change_name" "base_ref" 2>/dev/null || true)
|
|
631
|
+
fi
|
|
616
632
|
|
|
617
|
-
if [ -n "${base_ref:-}" ] && git rev-parse --verify "$base_ref" >/dev/null 2>&1; then
|
|
633
|
+
if [ -n "${base_ref:-}" ] && [ "$base_ref" != "null" ] && git rev-parse --verify "$base_ref" >/dev/null 2>&1; then
|
|
618
634
|
changed_files=$(git diff --name-only "$base_ref"...HEAD 2>/dev/null | wc -l | tr -d ' ')
|
|
619
635
|
else
|
|
620
636
|
changed_files=$(git diff --name-only HEAD 2>/dev/null | wc -l | tr -d ' ')
|
|
@@ -623,7 +639,7 @@ cmd_scale() {
|
|
|
623
639
|
|
|
624
640
|
# Decision rules
|
|
625
641
|
local result="light"
|
|
626
|
-
if [ "$task_count" -gt 3 ] || [ "$delta_spec_count" -gt 1 ] || [ "$changed_files" -gt
|
|
642
|
+
if [ "$task_count" -gt 3 ] || [ "$delta_spec_count" -gt 1 ] || [ "$changed_files" -gt 4 ]; then
|
|
627
643
|
result="full"
|
|
628
644
|
fi
|
|
629
645
|
|
|
@@ -631,7 +647,7 @@ cmd_scale() {
|
|
|
631
647
|
echo "=== Scale Assessment: $change_name ===" >&2
|
|
632
648
|
echo " Tasks: $task_count (threshold: 3)" >&2
|
|
633
649
|
echo " Delta specs: $delta_spec_count capabilities (threshold: 1)" >&2
|
|
634
|
-
echo " Changed files: $changed_files (threshold:
|
|
650
|
+
echo " Changed files: $changed_files (threshold: 4)" >&2
|
|
635
651
|
echo " → Result: $result" >&2
|
|
636
652
|
|
|
637
653
|
# Update verify_mode in .comet.yaml
|
|
@@ -174,7 +174,7 @@ if [ -n "$handoff_hash" ] && [ "$handoff_hash" != "null" ]; then
|
|
|
174
174
|
fi
|
|
175
175
|
|
|
176
176
|
# --- Unknown keys check ---
|
|
177
|
-
KNOWN_KEYS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verification_report branch_status verified_at archived direct_override build_command verify_command handoff_context handoff_hash"
|
|
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"
|
|
178
178
|
while IFS=: read -r key _; do
|
|
179
179
|
key="${key// /}"
|
|
180
180
|
[ -z "$key" ] && continue
|
|
@@ -18,8 +18,12 @@ description: "Comet Phase 5: Archive. Invoke with /comet-archive. Sync delta spe
|
|
|
18
18
|
Execute entry verification:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
22
|
+
if [ -z "$COMET_ENV" ]; then
|
|
23
|
+
echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
|
|
24
|
+
return 1
|
|
25
|
+
fi
|
|
26
|
+
. "$COMET_ENV"
|
|
23
27
|
bash "$COMET_STATE" check <name> archive
|
|
24
28
|
```
|
|
25
29
|
|
|
@@ -45,7 +49,7 @@ If script returns non-zero exit code, report error and stop.
|
|
|
45
49
|
If script returns zero exit code, archive is complete.
|
|
46
50
|
The summary `X/Y steps succeeded` counts real executed steps and does not double-count delta spec sync or document annotation.
|
|
47
51
|
|
|
48
|
-
When a delta spec differs from an existing main spec, the script prints a unified diff before overwrite
|
|
52
|
+
When a delta spec differs from an existing main spec, the script prints a unified diff preview before overwrite to help confirm archive sync content.
|
|
49
53
|
|
|
50
54
|
Use `--dry-run` flag to preview without executing.
|
|
51
55
|
|
|
@@ -62,7 +66,7 @@ brainstorming → delta spec → implementation → verification → main spec o
|
|
|
62
66
|
- Archive directory `openspec/changes/archive/YYYY-MM-DD-<change-name>/` exists
|
|
63
67
|
- Archived `.comet.yaml` contains `archived: true`
|
|
64
68
|
|
|
65
|
-
The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`. After successful archive, do not run `bash "$COMET_GUARD" <change-name> archive` against the old active change name; the active directory no longer exists. Archive completeness is determined by
|
|
69
|
+
The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`. After successful archive, **do not run** `bash "$COMET_GUARD" <change-name> archive` against the old active change name; the active directory no longer exists. Archive completeness is determined by script exit code and archived directory state.
|
|
66
70
|
|
|
67
71
|
## Complete
|
|
68
72
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: comet-build
|
|
3
|
-
description: "Comet Phase 3: Plan and Build. Invoke with /comet-build. Create plans and
|
|
3
|
+
description: "Comet Phase 3: Plan and Build. Invoke with /comet-build. Create plans and select execution method (subagent or direct) for implementation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Comet Phase 3: Plan and Build (Build)
|
|
@@ -17,9 +17,12 @@ description: "Comet Phase 3: Plan and Build. Invoke with /comet-build. Create pl
|
|
|
17
17
|
Execute entry verification:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
COMET_ENV="${COMET_ENV:-$(find . "$HOME"/.*/skills "$HOME/.config" "$HOME/.gemini" -path '*/comet/scripts/comet-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
21
|
+
if [ -z "$COMET_ENV" ]; then
|
|
22
|
+
echo "ERROR: comet-env.sh not found. Ensure the comet skill is installed." >&2
|
|
23
|
+
return 1
|
|
24
|
+
fi
|
|
25
|
+
. "$COMET_ENV"
|
|
23
26
|
bash "$COMET_STATE" check <name> build
|
|
24
27
|
```
|
|
25
28
|
|
|
@@ -58,9 +61,11 @@ bash "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
|
58
61
|
|
|
59
62
|
No manual phase update needed — guard auto-transitions when exit conditions are met.
|
|
60
63
|
|
|
61
|
-
### 3.
|
|
64
|
+
### 3. Select Workflow Configuration
|
|
62
65
|
|
|
63
|
-
Plan has been written to the current branch. Before starting execution, choose workspace isolation method
|
|
66
|
+
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
|
+
|
|
68
|
+
**Workspace Isolation**:
|
|
64
69
|
|
|
65
70
|
| Option | Method | Description |
|
|
66
71
|
|--------|--------|-------------|
|
|
@@ -71,52 +76,30 @@ Plan has been written to the current branch. Before starting execution, choose w
|
|
|
71
76
|
- Change involves ≤ 3 files → Recommend A
|
|
72
77
|
- Need parallel development, current branch has uncommitted work → Recommend B
|
|
73
78
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
bash "$COMET_STATE" set <name> isolation <value>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
- `branch`
|
|
81
|
-
- `worktree`
|
|
82
|
-
|
|
83
|
-
<IMPORTANT>
|
|
84
|
-
This is a script-enforced hard constraint, not a suggestion. Full workflow init may temporarily leave `isolation` as `null`, but only before this step.
|
|
85
|
-
Before implementation starts, stop and ask the user, then write either `branch` or `worktree`. If it remains `null`, both the `build → verify` guard and `comet-state transition build-complete` will fail.
|
|
86
|
-
</IMPORTANT>
|
|
87
|
-
|
|
88
|
-
**Execute isolation**:
|
|
89
|
-
|
|
90
|
-
- **branch**: Run `git checkout -b <change-name>`, subsequent work on the new branch
|
|
91
|
-
- **worktree**: Invoke `superpowers:using-git-worktrees` skill or use native `EnterWorktree` tool to create isolated workspace
|
|
92
|
-
|
|
93
|
-
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed).
|
|
94
|
-
|
|
95
|
-
### 4. Select Execution Method
|
|
96
|
-
|
|
97
|
-
Present plan summary to user (task count, involved modules), then ask for execution method:
|
|
79
|
+
**Execution Method**:
|
|
98
80
|
|
|
99
81
|
| Option | Skill | Applicable Scenario |
|
|
100
82
|
|------|------|-------------------|
|
|
101
83
|
| A | `superpowers:subagent-driven-development` | Independent tasks, high complexity, requires two-phase review |
|
|
102
84
|
| B | `superpowers:executing-plans` | Simple tasks, no subagent environment, lightweight and fast |
|
|
103
85
|
|
|
104
|
-
**
|
|
86
|
+
**Execution method recommendation rules**:
|
|
105
87
|
- Task count ≥ 3 → Recommend A
|
|
106
88
|
- Task count ≤ 2 and no cross-module dependencies → Recommend B
|
|
107
89
|
- From hotfix path → Recommend B
|
|
108
90
|
|
|
109
|
-
|
|
91
|
+
This is a user decision point. Must pause and wait for the user to explicitly choose both isolation method and execution method. You **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.
|
|
92
|
+
|
|
93
|
+
After user selection, update `isolation` and `build_mode` fields:
|
|
110
94
|
|
|
111
95
|
```bash
|
|
112
|
-
bash "$COMET_STATE" set <name>
|
|
96
|
+
bash "$COMET_STATE" set <name> isolation <branch|worktree>
|
|
97
|
+
bash "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
|
|
113
98
|
```
|
|
114
99
|
|
|
115
|
-
- `
|
|
116
|
-
- `executing-plans`
|
|
117
|
-
- `direct` (default only for hotfix/tweak preset use)
|
|
100
|
+
`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.
|
|
118
101
|
|
|
119
|
-
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:
|
|
102
|
+
`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:
|
|
120
103
|
|
|
121
104
|
```bash
|
|
122
105
|
bash "$COMET_STATE" set <name> direct_override true
|
|
@@ -125,7 +108,14 @@ bash "$COMET_STATE" set <name> build_mode direct
|
|
|
125
108
|
|
|
126
109
|
Without `direct_override: true`, `build_mode=direct` in full workflow is blocked by both guard and state transition.
|
|
127
110
|
|
|
128
|
-
|
|
111
|
+
**Execute isolation**:
|
|
112
|
+
|
|
113
|
+
- **branch**: Run `git checkout -b <change-name>`, subsequent work on the new branch
|
|
114
|
+
- **worktree**: Must use the Skill tool to load `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
|
+
|
|
116
|
+
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed).
|
|
117
|
+
|
|
118
|
+
**Load execution skill**: Use the Skill tool to load the corresponding skill. Skipping this step is prohibited.
|
|
129
119
|
|
|
130
120
|
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.
|
|
131
121
|
|
|
@@ -134,17 +124,19 @@ After the skill loads, follow its guidance to execute:
|
|
|
134
124
|
- Complete tasks.md check (`- [ ]` → `- [x]`)
|
|
135
125
|
- Commit code after each task completion
|
|
136
126
|
|
|
137
|
-
###
|
|
127
|
+
### 4. Spec Incremental Updates
|
|
138
128
|
|
|
139
129
|
When the initial spec is found incomplete during implementation, handle by scale:
|
|
140
130
|
|
|
141
131
|
| Scale | Trigger Conditions | Approach |
|
|
142
132
|
|------|-------------------|----------|
|
|
143
133
|
| Small | Missing acceptance scenarios, edge cases | Directly edit delta spec + design.md, append tasks.md tasks |
|
|
144
|
-
| Medium | Interface changes, new components, data flow changes |
|
|
145
|
-
| Large | Brand-new capability requirements |
|
|
134
|
+
| Medium | Interface changes, new components, data flow changes | Pause and wait for user confirmation, then must use Skill tool to load `superpowers:brainstorming` to update Design Doc + delta spec |
|
|
135
|
+
| Large | Brand-new capability requirements | Must pause and wait for user confirmation to split; after user confirms, create independent change through `/comet-open` |
|
|
136
|
+
|
|
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.
|
|
146
138
|
|
|
147
|
-
|
|
139
|
+
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.
|
|
148
140
|
|
|
149
141
|
**Principles**:
|
|
150
142
|
- Delta spec is a living document, can be modified at any time during this phase
|
|
@@ -152,14 +144,14 @@ When the initial spec is found incomplete during implementation, handle by scale
|
|
|
152
144
|
- Do not sync to main spec in advance, sync uniformly during archiving
|
|
153
145
|
- For small-scale incremental direct delta spec edits, note in commit message to facilitate design doc drift assessment during archiving
|
|
154
146
|
|
|
155
|
-
###
|
|
147
|
+
### 5. Context Management
|
|
156
148
|
|
|
157
149
|
Build is the longest phase and may span many tasks. To support resume after context compaction:
|
|
158
150
|
|
|
159
151
|
- **After each task**: immediately check off tasks.md and commit code so `.comet.yaml` and file state are durable
|
|
160
152
|
- **After context compaction**: read `.comet.yaml` to confirm the phase is still build, read the plan header `base-ref`, then read tasks.md to find the next unchecked task
|
|
161
153
|
- **User manual-change resume**: handle uncommitted changes through `comet/reference/dirty-worktree.md`. That protocol defines checks, attribution, and prohibitions. Build-specific handling:
|
|
162
|
-
1. After attribution, if the diff implies plan or spec changes, handle it through Step
|
|
154
|
+
1. After attribution, if the diff implies plan or spec changes, handle it through Step 4 "Spec Incremental Updates"
|
|
163
155
|
- **Long task split**: if a single task exceeds 200 lines of code changes, consider splitting it into multiple subtasks and commits
|
|
164
156
|
|
|
165
157
|
## Exit Conditions
|