@rpamis/comet 0.2.9 → 0.3.1
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 +15 -1
- package/assets/manifest.json +2 -1
- package/assets/skills/comet/SKILL.md +47 -33
- package/assets/skills/comet/reference/dirty-worktree.md +58 -0
- package/assets/skills/comet/scripts/comet-state.sh +23 -7
- package/assets/skills/comet/scripts/comet-yaml-validate.sh +1 -1
- package/assets/skills/comet-archive/SKILL.md +2 -2
- package/assets/skills/comet-build/SKILL.md +31 -40
- package/assets/skills/comet-design/SKILL.md +88 -20
- package/assets/skills/comet-hotfix/SKILL.md +42 -21
- package/assets/skills/comet-open/SKILL.md +34 -30
- package/assets/skills/comet-tweak/SKILL.md +36 -17
- package/assets/skills/comet-verify/SKILL.md +88 -43
- package/assets/skills-zh/comet/SKILL.md +17 -9
- package/assets/skills-zh/comet/reference/dirty-worktree.md +58 -0
- package/assets/skills-zh/comet-build/SKILL.md +30 -39
- package/assets/skills-zh/comet-design/SKILL.md +23 -5
- package/assets/skills-zh/comet-hotfix/SKILL.md +32 -17
- package/assets/skills-zh/comet-open/SKILL.md +3 -1
- package/assets/skills-zh/comet-tweak/SKILL.md +17 -4
- package/assets/skills-zh/comet-verify/SKILL.md +48 -18
- package/dist/commands/update.js +1 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/core/superpowers.d.ts.map +1 -1
- package/dist/core/superpowers.js +17 -1
- package/dist/core/superpowers.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,11 @@
|
|
|
32
32
|
|
|
33
33
|
**OpenSpec + Superpowers dual-star development workflow** — one command from idea to archive.
|
|
34
34
|
|
|
35
|
-
OpenSpec handles **WHAT** (outlines, proposals, spec lifecycle, archiving).
|
|
35
|
+
OpenSpec handles **WHAT** (outlines, proposals, spec lifecycle, archiving).
|
|
36
|
+
|
|
37
|
+
Superpowers handles **HOW** (technical design, planning, execution, wrap-up).
|
|
38
|
+
|
|
39
|
+
Comet chains both into a five-phase automated pipeline.
|
|
36
40
|
|
|
37
41
|
## Why Comet
|
|
38
42
|
|
|
@@ -94,6 +98,12 @@ comet init
|
|
|
94
98
|
>
|
|
95
99
|
> `comet update` or `npm install -g @rpamis/comet@latest` to get the latest features and fixes.
|
|
96
100
|
|
|
101
|
+
## Support for OpenClaw and Hermes, and other AI platforms
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx skills add rpamis/comet
|
|
105
|
+
```
|
|
106
|
+
|
|
97
107
|
## Screenshots
|
|
98
108
|
|
|
99
109
|
<p align="center">
|
|
@@ -389,6 +399,10 @@ See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
|
|
|
389
399
|
|
|
390
400
|
Track our development progress and upcoming features on the [Comet Roadmap](https://github.com/orgs/rpamis/projects/1).
|
|
391
401
|
|
|
402
|
+
## Star History
|
|
403
|
+
|
|
404
|
+
[](https://star-history.com/#rpamis/comet&Date)
|
|
405
|
+
|
|
392
406
|
## License
|
|
393
407
|
|
|
394
408
|
[MIT](LICENSE.md)
|
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
|
|
@@ -22,13 +22,19 @@ Agents need only read this section for decision-making. Refer to the Reference A
|
|
|
22
22
|
|
|
23
23
|
### Automatic Phase Detection
|
|
24
24
|
|
|
25
|
-
**Step 0: Active Change Discovery**
|
|
25
|
+
**Step 0: Active Change Discovery and Intent Detection**
|
|
26
26
|
|
|
27
|
-
1.
|
|
27
|
+
1. Detect presets first; if hotfix/tweak matches, invoke the corresponding preset skill directly and do not enter the normal open branch
|
|
28
|
+
2. When no preset matches, run `openspec list --json` to get all active changes
|
|
29
|
+
|
|
30
|
+
**Preset detection has highest priority**:
|
|
31
|
+
- User explicitly describes a bug fix / hotfix + meets hotfix conditions → directly invoke `/comet-hotfix`
|
|
32
|
+
- User explicitly describes copy/config/docs/prompt small adjustment + meets tweak conditions → directly invoke `/comet-tweak`
|
|
33
|
+
- No preset match → follow the table below
|
|
28
34
|
|
|
29
35
|
| Active changes | User input | Behavior |
|
|
30
36
|
|----------------|------------|----------|
|
|
31
|
-
| None |
|
|
37
|
+
| None | non-preset input | → Invoke `/comet-open` |
|
|
32
38
|
| Exactly 1 | `/comet <description>` | → **Ask**: continue this change or create a new change |
|
|
33
39
|
| Multiple | `/comet <description>` | → **Ask**: continue existing or create new; if continuing, list changes for selection |
|
|
34
40
|
| Exactly 1 | `/comet` with no description | → Auto-select, enter Step 1 |
|
|
@@ -36,32 +42,29 @@ Agents need only read this section for decision-making. Refer to the Reference A
|
|
|
36
42
|
|
|
37
43
|
<IMPORTANT>
|
|
38
44
|
When the user chooses "create a new change", **must invoke `/comet-open`**. Do not call `/opsx:new` directly.
|
|
39
|
-
`/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.
|
|
40
46
|
Calling `/opsx:new` directly leaves `.comet.yaml` missing and breaks later phase detection.
|
|
41
47
|
</IMPORTANT>
|
|
42
48
|
|
|
43
|
-
**Preset detection**:
|
|
44
|
-
- User describes as bug fix / hotfix + meets hotfix conditions → directly invoke `/comet-hotfix`
|
|
45
|
-
- User describes as copy, config, docs, prompt or small non-bug adjustment + meets tweak conditions → directly invoke `/comet-tweak`
|
|
46
|
-
|
|
47
49
|
**Step 1: Read `.comet.yaml` state metadata**
|
|
48
50
|
|
|
49
51
|
Prefer reading `openspec/changes/<name>/.comet.yaml`. If not available, fall back to `openspec status --change "<name>" --json`, `tasks.md`, and `docs/superpowers/` file checks.
|
|
50
52
|
|
|
51
53
|
**Resume rules**:
|
|
52
54
|
- On every context resume, rerun Step 0 and Step 1; do not trust conversation history for phase detection
|
|
53
|
-
- If
|
|
54
|
-
- If `phase:
|
|
55
|
-
- If `phase:
|
|
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 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
|
|
56
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
|
|
57
60
|
|
|
58
61
|
**Step 2: Phase Determination** (check in order, first match wins)
|
|
59
62
|
|
|
60
63
|
1. `archived: true` or change moved to archive → Workflow complete
|
|
61
64
|
2. `verify_result: pass` and `archived` is not `true` → Invoke `/comet-archive`
|
|
62
|
-
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`)
|
|
63
66
|
4. `phase: verify` or tasks.md all checked → Invoke `/comet-verify`
|
|
64
|
-
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`
|
|
65
68
|
6. `phase: design` or has change but no Design Doc → Invoke `/comet-design`
|
|
66
69
|
7. `phase: open` or active change exists but `.comet.yaml` is missing → Invoke `/comet-open`
|
|
67
70
|
8. No active change → Invoke `/comet-open`
|
|
@@ -100,16 +103,19 @@ A single `/comet` invocation starts from the detected phase and advances to the
|
|
|
100
103
|
|
|
101
104
|
Flow chain: open → design → build → verify → archive
|
|
102
105
|
|
|
103
|
-
**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
|
+
|
|
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.
|
|
104
109
|
|
|
105
|
-
Nodes requiring user participation:
|
|
110
|
+
Nodes requiring user participation (pause only at these nodes):
|
|
106
111
|
1. Confirm design approach during brainstorming
|
|
107
|
-
2. Select
|
|
108
|
-
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)
|
|
109
114
|
4. Choose branch handling method for finishing-branch
|
|
110
115
|
5. Encounter upgrade conditions (hotfix/tweak → full workflow)
|
|
116
|
+
6. Build phase scope expansion requiring redesign or new change split
|
|
111
117
|
|
|
112
|
-
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.
|
|
113
119
|
</IMPORTANT>
|
|
114
120
|
|
|
115
121
|
---
|
|
@@ -134,11 +140,11 @@ Agents should not skip these decision points; other unambiguous phase transition
|
|
|
134
140
|
|
|
135
141
|
/comet-hotfix (preset, skip brainstorming)
|
|
136
142
|
open ──→ build ──→ verify ──→ archive
|
|
137
|
-
↑ If upgrade triggered → supplement Design Doc → return to full workflow
|
|
143
|
+
↑ If upgrade triggered → block for confirmation → supplement Design Doc → return to full workflow
|
|
138
144
|
|
|
139
145
|
/comet-tweak (preset, skip brainstorming and full plan)
|
|
140
146
|
open ──→ lightweight build ──→ light verify ──→ archive
|
|
141
|
-
↑ If upgrade triggered → supplement Design Doc → return to full workflow
|
|
147
|
+
↑ If upgrade triggered → block for confirmation → supplement Design Doc → return to full workflow
|
|
142
148
|
```
|
|
143
149
|
|
|
144
150
|
---
|
|
@@ -152,12 +158,14 @@ workflow: full
|
|
|
152
158
|
phase: build
|
|
153
159
|
design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
154
160
|
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
161
|
+
base_ref: a1b2c3d4e5f6...
|
|
155
162
|
build_mode: subagent-driven-development
|
|
156
163
|
isolation: branch
|
|
157
164
|
verify_mode: light
|
|
158
165
|
verify_result: pending
|
|
159
166
|
verification_report: null
|
|
160
167
|
branch_status: pending
|
|
168
|
+
created_at: 2026-05-26
|
|
161
169
|
verified_at: null
|
|
162
170
|
archived: false
|
|
163
171
|
```
|
|
@@ -165,15 +173,17 @@ archived: false
|
|
|
165
173
|
| Field | Meaning |
|
|
166
174
|
|-------|---------|
|
|
167
175
|
| `workflow` | `full`, `hotfix`, or `tweak` |
|
|
168
|
-
| `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) |
|
|
169
177
|
| `design_doc` | Associated Superpowers Design Doc path, can be empty |
|
|
170
178
|
| `plan` | Associated Superpowers Plan path, can be empty |
|
|
171
|
-
| `
|
|
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 |
|
|
172
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` |
|
|
173
182
|
| `verify_mode` | `light` or `full`, can be empty |
|
|
174
183
|
| `verify_result` | `pending`, `pass`, or `fail` |
|
|
175
184
|
| `verification_report` | Verification report file path; must point to an existing file before verify can pass |
|
|
176
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` |
|
|
177
187
|
| `verified_at` | Verification pass time, can be empty |
|
|
178
188
|
| `archived` | Whether change is archived |
|
|
179
189
|
|
|
@@ -199,9 +209,11 @@ Comet scripts are distributed in `comet/scripts/`. **Do not hardcode paths** —
|
|
|
199
209
|
COMET_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
|
|
200
210
|
COMET_GUARD="${COMET_GUARD:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-guard.sh' -type f -print -quit 2>/dev/null)}"
|
|
201
211
|
COMET_STATE="${COMET_STATE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-state.sh' -type f -print -quit 2>/dev/null)}"
|
|
212
|
+
COMET_HANDOFF="${COMET_HANDOFF:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-handoff.sh' -type f -print -quit 2>/dev/null)}"
|
|
202
213
|
COMET_ARCHIVE="${COMET_ARCHIVE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-archive.sh' -type f -print -quit 2>/dev/null)}"
|
|
203
214
|
|
|
204
|
-
|
|
215
|
+
# Stop workflow when script location fails
|
|
216
|
+
if [ -z "$COMET_GUARD" ] || [ -z "$COMET_STATE" ] || [ -z "$COMET_HANDOFF" ] || [ -z "$COMET_ARCHIVE" ]; then
|
|
205
217
|
echo "ERROR: Comet scripts not found. Ensure the comet skill is installed." >&2
|
|
206
218
|
echo "Expected path pattern: */comet/scripts/comet-*.sh under project or platform skill directories" >&2
|
|
207
219
|
return 1
|
|
@@ -231,7 +243,7 @@ bash "$COMET_STATE" transition <archive-name> archived
|
|
|
231
243
|
bash "$COMET_ARCHIVE" <change-name>
|
|
232
244
|
```
|
|
233
245
|
|
|
234
|
-
After loading comet, agents should run the
|
|
246
|
+
After loading comet, agents should run the variable assignments above once, then reuse `$COMET_GUARD`, `$COMET_STATE`, `$COMET_HANDOFF`, `$COMET_ARCHIVE` throughout the session.
|
|
235
247
|
|
|
236
248
|
### File Structure
|
|
237
249
|
|
|
@@ -245,6 +257,7 @@ openspec/ # OpenSpec — WHAT
|
|
|
245
257
|
│ │ ├── proposal.md # Why + What
|
|
246
258
|
│ │ ├── design.md # High-level architecture decisions
|
|
247
259
|
│ │ ├── specs/<capability>/spec.md # Delta capability spec
|
|
260
|
+
│ │ ├── .comet/handoff/ # Script-generated phase handoff packages
|
|
248
261
|
│ │ └── tasks.md # Task checklist
|
|
249
262
|
│ └── archive/YYYY-MM-DD-<name>/ # Archived
|
|
250
263
|
└── specs/<capability>/spec.md # Main specs (overwritten from delta at archive)
|
|
@@ -258,11 +271,12 @@ docs/superpowers/ # Superpowers — HOW
|
|
|
258
271
|
|
|
259
272
|
1. **brainstorming cannot be skipped** — Every change must undergo deep design (except hotfix and tweak)
|
|
260
273
|
2. **delta spec is a living document** — Freely modify during phase 3, sync at archive
|
|
261
|
-
3. **
|
|
262
|
-
4. **
|
|
263
|
-
5. **
|
|
264
|
-
6. **
|
|
265
|
-
7. **
|
|
266
|
-
8. **
|
|
267
|
-
9. **
|
|
268
|
-
10. **
|
|
274
|
+
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
|
|
275
|
+
4. **Keep tasks.md in sync** — Check off each completed task
|
|
276
|
+
5. **Commit frequently** — One commit per task, message reflects design intent
|
|
277
|
+
6. **Verify before archive** — Execute `/comet-archive` only after `/comet-verify` passes
|
|
278
|
+
7. **Classify incremental updates** — Small edits, medium brainstorming, large new changes
|
|
279
|
+
8. **Plan must associate with change** — File header contains `change:` and `design-doc:` metadata
|
|
280
|
+
9. **Archive closure** — design doc and plan must mark `archived-with` status
|
|
281
|
+
10. **Modifying existing features** — Just open a new change
|
|
282
|
+
11. **Preset has limits** — Switch to full workflow promptly when hotfix/tweak meet upgrade conditions
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Dirty Worktree Protocol
|
|
2
|
+
|
|
3
|
+
Canonical path: `comet/reference/dirty-worktree.md`
|
|
4
|
+
|
|
5
|
+
This protocol is shared by all Comet sub-skills that may modify code. When an agent resumes context or continues execution, it must handle uncommitted working tree changes through this protocol.
|
|
6
|
+
|
|
7
|
+
## 1. Checks
|
|
8
|
+
|
|
9
|
+
Before continuing or starting code changes, run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git status --short
|
|
13
|
+
git diff --stat
|
|
14
|
+
git diff --cached --stat
|
|
15
|
+
git ls-files --others --exclude-standard
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
When needed, inspect `git diff`, `git diff --cached`, and newly created file contents.
|
|
19
|
+
|
|
20
|
+
## 2. Core Rules
|
|
21
|
+
|
|
22
|
+
- The user may not say which files they changed. If the worktree is dirty, including new files shown as `??` in Git status, assume changes may come from the user or mixed sources.
|
|
23
|
+
- A dirty worktree is code evidence only. It does not automatically advance `.comet.yaml` `phase` or check off `tasks.md`; Comet state may advance only after attribution, verification, required document synchronization, and the relevant phase guard.
|
|
24
|
+
|
|
25
|
+
## 3. Attribution
|
|
26
|
+
|
|
27
|
+
Classify dirty diffs into three groups:
|
|
28
|
+
|
|
29
|
+
1. **Belongs to the current change**: Files and content match the current change goal, tasks.md, plan, or delta spec. Incorporate the diff into the current task and avoid redoing the same work.
|
|
30
|
+
2. **Does not belong to the current change**: Files or content are unrelated. Pause and ask whether to include it in the current change, split it into a new change, leave it alone, or discard it with explicit authorization.
|
|
31
|
+
3. **Unclear source**: The diff and documents are not enough to determine ownership. Pause, report the file list and reasoning, and do not advance the phase.
|
|
32
|
+
|
|
33
|
+
## 4. Common Patterns
|
|
34
|
+
|
|
35
|
+
### Implemented But tasks.md Is Not Checked
|
|
36
|
+
|
|
37
|
+
Verify the implementation with build and tests. If it passes, check off the task. Do not redo work just because the task is unchecked, and do not ignore code evidence because state files lag behind. If the current sub-skill defines a phase-specific rule, follow that sub-skill.
|
|
38
|
+
|
|
39
|
+
### Plan Or Scope Changed
|
|
40
|
+
|
|
41
|
+
Follow the current sub-skill's escalation, incremental-update, or rollback rules. This protocol does not repeat phase-specific details.
|
|
42
|
+
|
|
43
|
+
### Ambiguous Resume Intent
|
|
44
|
+
|
|
45
|
+
When the user says things like "continue", "keep going", "I changed a bit", "I wasn't happy with it", "redo it", "code changed", or "use what is there", follow this protocol. Do not require the user to remember exactly what they changed.
|
|
46
|
+
|
|
47
|
+
### Code Changes During open/design
|
|
48
|
+
|
|
49
|
+
If the current phase is still `open` or `design` but the dirty worktree already contains code changes, first attribute the changes through this protocol and do not advance the phase directly:
|
|
50
|
+
|
|
51
|
+
- If the changes belong to the current change, treat them as requirements or design input and record them in proposal/design/spec/design doc/tasks as appropriate. The current phase guard must still pass before entering build.
|
|
52
|
+
- If the changes do not belong to the current change or ownership is unclear, pause and ask whether to include them, split them into a new change, leave them alone, or discard them with explicit authorization.
|
|
53
|
+
- Do not treat code changes made during open/design as completed implementation ready for verify.
|
|
54
|
+
|
|
55
|
+
## 5. Prohibitions
|
|
56
|
+
|
|
57
|
+
- Do not overwrite, revert, reformat over, or ignore user changes before understanding the dirty diff source.
|
|
58
|
+
- Do not mark verification as passed while dirty diff remains unexplained.
|
|
@@ -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
|
*)
|
|
@@ -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
|
|
@@ -45,7 +45,7 @@ If script returns non-zero exit code, report error and stop.
|
|
|
45
45
|
If script returns zero exit code, archive is complete.
|
|
46
46
|
The summary `X/Y steps succeeded` counts real executed steps and does not double-count delta spec sync or document annotation.
|
|
47
47
|
|
|
48
|
-
When a delta spec differs from an existing main spec, the script prints a unified diff before overwrite
|
|
48
|
+
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
49
|
|
|
50
50
|
Use `--dry-run` flag to preview without executing.
|
|
51
51
|
|
|
@@ -62,7 +62,7 @@ brainstorming → delta spec → implementation → verification → main spec o
|
|
|
62
62
|
- Archive directory `openspec/changes/archive/YYYY-MM-DD-<change-name>/` exists
|
|
63
63
|
- Archived `.comet.yaml` contains `archived: true`
|
|
64
64
|
|
|
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
|
|
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 script exit code and archived directory state.
|
|
66
66
|
|
|
67
67
|
## Complete
|
|
68
68
|
|
|
@@ -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)
|
|
@@ -58,9 +58,11 @@ bash "$COMET_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
|
58
58
|
|
|
59
59
|
No manual phase update needed — guard auto-transitions when exit conditions are met.
|
|
60
60
|
|
|
61
|
-
### 3.
|
|
61
|
+
### 3. Select Workflow Configuration
|
|
62
62
|
|
|
63
|
-
Plan has been written to the current branch. Before starting execution, choose workspace isolation method
|
|
63
|
+
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**:
|
|
64
|
+
|
|
65
|
+
**Workspace Isolation**:
|
|
64
66
|
|
|
65
67
|
| Option | Method | Description |
|
|
66
68
|
|--------|--------|-------------|
|
|
@@ -71,52 +73,30 @@ Plan has been written to the current branch. Before starting execution, choose w
|
|
|
71
73
|
- Change involves ≤ 3 files → Recommend A
|
|
72
74
|
- Need parallel development, current branch has uncommitted work → Recommend B
|
|
73
75
|
|
|
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:
|
|
76
|
+
**Execution Method**:
|
|
98
77
|
|
|
99
78
|
| Option | Skill | Applicable Scenario |
|
|
100
79
|
|------|------|-------------------|
|
|
101
80
|
| A | `superpowers:subagent-driven-development` | Independent tasks, high complexity, requires two-phase review |
|
|
102
81
|
| B | `superpowers:executing-plans` | Simple tasks, no subagent environment, lightweight and fast |
|
|
103
82
|
|
|
104
|
-
**
|
|
83
|
+
**Execution method recommendation rules**:
|
|
105
84
|
- Task count ≥ 3 → Recommend A
|
|
106
85
|
- Task count ≤ 2 and no cross-module dependencies → Recommend B
|
|
107
86
|
- From hotfix path → Recommend B
|
|
108
87
|
|
|
109
|
-
|
|
88
|
+
This is a user decision point. Must pause and wait for the user to explicitly choose both isolation method and execution method. **Must not select based on recommendation rules**. Recommendation rules are for suggestion only, not a substitute for user confirmation.
|
|
89
|
+
|
|
90
|
+
After user selection, update `isolation` and `build_mode` fields:
|
|
110
91
|
|
|
111
92
|
```bash
|
|
112
|
-
bash "$COMET_STATE" set <name>
|
|
93
|
+
bash "$COMET_STATE" set <name> isolation <branch|worktree>
|
|
94
|
+
bash "$COMET_STATE" set <name> build_mode <subagent-driven-development|executing-plans|direct>
|
|
113
95
|
```
|
|
114
96
|
|
|
115
|
-
- `
|
|
116
|
-
- `executing-plans`
|
|
117
|
-
- `direct` (default only for hotfix/tweak preset use)
|
|
97
|
+
`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
98
|
|
|
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:
|
|
99
|
+
`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
100
|
|
|
121
101
|
```bash
|
|
122
102
|
bash "$COMET_STATE" set <name> direct_override true
|
|
@@ -125,7 +105,14 @@ bash "$COMET_STATE" set <name> build_mode direct
|
|
|
125
105
|
|
|
126
106
|
Without `direct_override: true`, `build_mode=direct` in full workflow is blocked by both guard and state transition.
|
|
127
107
|
|
|
128
|
-
|
|
108
|
+
**Execute isolation**:
|
|
109
|
+
|
|
110
|
+
- **branch**: Run `git checkout -b <change-name>`, subsequent work on the new branch
|
|
111
|
+
- **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.
|
|
112
|
+
|
|
113
|
+
After creating isolation, confirm plan file is accessible (naturally accessible with branch method; for worktree method, confirm plan has been committed).
|
|
114
|
+
|
|
115
|
+
**Load execution skill**: Use the Skill tool to load the corresponding skill. Skipping this step is prohibited.
|
|
129
116
|
|
|
130
117
|
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
118
|
|
|
@@ -134,17 +121,19 @@ After the skill loads, follow its guidance to execute:
|
|
|
134
121
|
- Complete tasks.md check (`- [ ]` → `- [x]`)
|
|
135
122
|
- Commit code after each task completion
|
|
136
123
|
|
|
137
|
-
###
|
|
124
|
+
### 4. Spec Incremental Updates
|
|
138
125
|
|
|
139
126
|
When the initial spec is found incomplete during implementation, handle by scale:
|
|
140
127
|
|
|
141
128
|
| Scale | Trigger Conditions | Approach |
|
|
142
129
|
|------|-------------------|----------|
|
|
143
130
|
| 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 |
|
|
131
|
+
| 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 |
|
|
132
|
+
| Large | Brand-new capability requirements | Must pause and wait for user confirmation to split; after user confirms, create independent change through `/comet-open` |
|
|
133
|
+
|
|
134
|
+
**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
135
|
|
|
147
|
-
|
|
136
|
+
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
137
|
|
|
149
138
|
**Principles**:
|
|
150
139
|
- Delta spec is a living document, can be modified at any time during this phase
|
|
@@ -152,12 +141,14 @@ When the initial spec is found incomplete during implementation, handle by scale
|
|
|
152
141
|
- Do not sync to main spec in advance, sync uniformly during archiving
|
|
153
142
|
- For small-scale incremental direct delta spec edits, note in commit message to facilitate design doc drift assessment during archiving
|
|
154
143
|
|
|
155
|
-
###
|
|
144
|
+
### 5. Context Management
|
|
156
145
|
|
|
157
146
|
Build is the longest phase and may span many tasks. To support resume after context compaction:
|
|
158
147
|
|
|
159
148
|
- **After each task**: immediately check off tasks.md and commit code so `.comet.yaml` and file state are durable
|
|
160
149
|
- **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
|
|
150
|
+
- **User manual-change resume**: handle uncommitted changes through `comet/reference/dirty-worktree.md`. That protocol defines checks, attribution, and prohibitions. Build-specific handling:
|
|
151
|
+
1. After attribution, if the diff implies plan or spec changes, handle it through Step 4 "Spec Incremental Updates"
|
|
161
152
|
- **Long task split**: if a single task exceeds 200 lines of code changes, consider splitting it into multiple subtasks and commits
|
|
162
153
|
|
|
163
154
|
## Exit Conditions
|