@rpamis/comet 0.2.3 → 0.2.5
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 +60 -22
- package/assets/manifest.json +1 -1
- package/assets/skills/comet/SKILL.md +50 -14
- package/assets/skills/comet/scripts/comet-archive.sh +2 -2
- package/assets/skills/comet/scripts/comet-guard.sh +50 -48
- package/assets/skills/comet/scripts/comet-state.sh +158 -39
- package/assets/skills/comet/scripts/comet-yaml-validate.sh +9 -3
- package/assets/skills/comet-archive/SKILL.md +7 -4
- package/assets/skills/comet-build/SKILL.md +21 -6
- package/assets/skills/comet-design/SKILL.md +12 -19
- package/assets/skills/comet-hotfix/SKILL.md +36 -26
- package/assets/skills/comet-open/SKILL.md +19 -7
- package/assets/skills/comet-tweak/SKILL.md +23 -12
- package/assets/skills/comet-verify/SKILL.md +32 -7
- package/assets/skills-zh/comet/SKILL.md +64 -21
- package/assets/skills-zh/comet-archive/SKILL.md +7 -4
- package/assets/skills-zh/comet-build/SKILL.md +21 -6
- package/assets/skills-zh/comet-design/SKILL.md +12 -19
- package/assets/skills-zh/comet-hotfix/SKILL.md +42 -26
- package/assets/skills-zh/comet-open/SKILL.md +30 -16
- package/assets/skills-zh/comet-tweak/SKILL.md +29 -12
- package/assets/skills-zh/comet-verify/SKILL.md +46 -6
- package/dist/cli/index.js +9 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +52 -29
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +9 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +72 -13
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +19 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/update.d.ts +22 -2
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +175 -29
- package/dist/commands/update.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/rpamis/comet/blob/master/img/title-log.png">
|
|
3
|
+
<picture>
|
|
4
|
+
<source srcset="https://github.com/rpamis/comet/blob/master/img/title-log.png">
|
|
5
|
+
<img src="https://github.com/rpamis/comet/blob/master/img/title-log.png" alt="Comet logo">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://github.com/rpamis/comet/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/rpamis/comet/actions/workflows/ci.yml/badge.svg" /></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@rpamis/comet"><img alt="npm version" src="https://img.shields.io/npm/v/@rpamis/comet?style=flat-square" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@rpamis/comet"><img alt="npm download count" src="https://img.shields.io/npm/dm/@rpamis/comet?style=flat-square&label=Downloads/mo" /></a>
|
|
14
|
+
<a href="./LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
1
17
|
# @rpamis/comet
|
|
2
18
|
|
|
3
19
|
```
|
|
@@ -48,21 +64,18 @@ comet init
|
|
|
48
64
|
6. Deploy Comet skills (in your chosen language) to selected platforms
|
|
49
65
|
7. Create `docs/superpowers/specs/` and `docs/superpowers/plans/` working directories
|
|
50
66
|
|
|
67
|
+
> [!TIP]
|
|
68
|
+
> update version
|
|
69
|
+
>
|
|
70
|
+
> comet update or `npm install -g @rpamis/comet@latest` to get the latest features and fixes.
|
|
71
|
+
|
|
51
72
|
## Screenshots
|
|
52
73
|
|
|
53
74
|
<p align="center">
|
|
54
|
-
<img src="img/
|
|
75
|
+
<img src="https://github.com/rpamis/comet/blob/master/img/runner.png" alt="runner">
|
|
55
76
|
</p>
|
|
56
|
-
<p align="center">Supports Chinese & English Skill distribution, 28 AI Coding platforms</p>
|
|
57
77
|
|
|
58
|
-
<p align="center">
|
|
59
|
-
<img src="img/init.png" alt="Initialization" width="600">
|
|
60
|
-
</p>
|
|
61
78
|
<p align="center">Auto-install OpenSpec & Superpowers, one-click dev environment setup</p>
|
|
62
|
-
|
|
63
|
-
<p align="center">
|
|
64
|
-
<img src="img/skill-comet.png" alt="Skill Execution" width="600">
|
|
65
|
-
</p>
|
|
66
79
|
<p align="center">Multi-phase Skill entry, auto-detects current Spec stage, auto-triggers core flow, manual review at key nodes</p>
|
|
67
80
|
|
|
68
81
|
## Commands
|
|
@@ -70,9 +83,9 @@ comet init
|
|
|
70
83
|
| Command | Description |
|
|
71
84
|
|---------|-------------|
|
|
72
85
|
| `comet init [path]` | Initialize Comet workflow |
|
|
73
|
-
| `comet status [path]` | Show active changes and workflow
|
|
74
|
-
| `comet doctor [path]` | Diagnose Comet installation health |
|
|
75
|
-
| `comet update [path]` | Update
|
|
86
|
+
| `comet status [path]` | Show active changes, task progress, and next workflow command |
|
|
87
|
+
| `comet doctor [path]` | Diagnose project/global Comet installation health |
|
|
88
|
+
| `comet update [path]` | Update the npm package and installed Comet skills |
|
|
76
89
|
| `comet --help` | Show help |
|
|
77
90
|
| `comet --version` | Show version |
|
|
78
91
|
|
|
@@ -85,13 +98,28 @@ comet init
|
|
|
85
98
|
| `--overwrite` | Overwrite already installed components |
|
|
86
99
|
| `--json` | Output structured JSON |
|
|
87
100
|
|
|
88
|
-
|
|
101
|
+
When multiple existing components are found on the same platform, interactive init offers one bulk choice: overwrite all, skip all, or choose per component.
|
|
89
102
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
|
93
|
-
|
|
94
|
-
| `--
|
|
103
|
+
### status Options
|
|
104
|
+
|
|
105
|
+
| Option | Description |
|
|
106
|
+
|--------|-------------|
|
|
107
|
+
| `--json` | Output active changes with `nextCommand` |
|
|
108
|
+
|
|
109
|
+
### doctor Options
|
|
110
|
+
|
|
111
|
+
| Option | Description |
|
|
112
|
+
|--------|-------------|
|
|
113
|
+
| `--json` | Output structured diagnostic results |
|
|
114
|
+
| `--scope <scope>` | Diagnose `auto`, `project`, or `global` scope (default: `auto`) |
|
|
115
|
+
|
|
116
|
+
### update Options
|
|
117
|
+
|
|
118
|
+
| Option | Description |
|
|
119
|
+
|--------|-------------|
|
|
120
|
+
| `--json` | Output npm and skill update results as JSON |
|
|
121
|
+
| `--language <lang>` | Override detected skill language (`en`, `zh`) |
|
|
122
|
+
| `--scope <scope>` | Update only `global` or `project` scope |
|
|
95
123
|
|
|
96
124
|
## Supported Platforms
|
|
97
125
|
|
|
@@ -201,6 +229,8 @@ build_mode: subagent-driven-development
|
|
|
201
229
|
isolation: branch
|
|
202
230
|
verify_mode: light
|
|
203
231
|
verify_result: pending
|
|
232
|
+
verification_report: docs/superpowers/reports/YYYY-MM-DD-change-verify.md
|
|
233
|
+
branch_status: pending
|
|
204
234
|
verified_at: null
|
|
205
235
|
archived: false
|
|
206
236
|
```
|
|
@@ -222,12 +252,18 @@ Comet ensures agent execution reliability through automated state transitions:
|
|
|
222
252
|
- Guard and archive scripts use `comet-state.sh` internally for state management
|
|
223
253
|
|
|
224
254
|
3. **Schema Validation** — `comet-yaml-validate.sh` ensures data integrity
|
|
225
|
-
- Validates required fields (
|
|
226
|
-
- Validates enum values (
|
|
255
|
+
- Validates required fields (12 fields)
|
|
256
|
+
- Validates enum values (8 enum types)
|
|
227
257
|
- Validates referenced file paths exist
|
|
228
258
|
- Detects unknown/typos fields
|
|
229
259
|
|
|
230
|
-
4. **
|
|
260
|
+
4. **Verification Evidence** — Guard enforces proof before phase advance
|
|
261
|
+
- `verify-pass` transition requires `verification_report` pointing to an existing report file
|
|
262
|
+
- `branch_status` must be `handled` before verify can pass
|
|
263
|
+
- Guard checks `verification_report exists` and `branch_status=handled` as hard prerequisites
|
|
264
|
+
- Prevents false phase advances when verification or branch handling was skipped
|
|
265
|
+
|
|
266
|
+
5. **Archive Automation** — `comet-archive.sh` handles the full archive flow in one command
|
|
231
267
|
- Validates entry state, syncs delta specs to main specs
|
|
232
268
|
- Annotates design doc and plan frontmatter
|
|
233
269
|
- Moves change to archive directory and updates `archived: true`
|
|
@@ -276,6 +312,8 @@ Long-term Skill users know these capabilities can be freely combined, but exactl
|
|
|
276
312
|
|
|
277
313
|
## Development
|
|
278
314
|
|
|
315
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, commit conventions, PR process, and guidance for adding platforms or skills.
|
|
316
|
+
|
|
279
317
|
```bash
|
|
280
318
|
# Clone
|
|
281
319
|
git clone https://github.com/rpamis/comet
|
|
@@ -310,4 +348,4 @@ See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
|
|
|
310
348
|
|
|
311
349
|
## License
|
|
312
350
|
|
|
313
|
-
MIT
|
|
351
|
+
[MIT](LICENSE.md)
|
package/assets/manifest.json
CHANGED
|
@@ -25,13 +25,20 @@ Agents need only read this section for decision-making. Refer to the Reference A
|
|
|
25
25
|
**Step 0: Active Change Discovery**
|
|
26
26
|
|
|
27
27
|
1. Run `openspec list --json` to get all active changes
|
|
28
|
-
2. For each change, check `docs/superpowers/specs/` and `docs/superpowers/plans/` for associated files to determine phase and progress
|
|
29
28
|
|
|
30
|
-
|
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
| Exactly 1
|
|
34
|
-
| Multiple
|
|
29
|
+
| Active changes | User input | Behavior |
|
|
30
|
+
|----------------|------------|----------|
|
|
31
|
+
| None | any | → Invoke `/comet-open` |
|
|
32
|
+
| Exactly 1 | `/comet <description>` | → **Ask**: continue this change or create a new change |
|
|
33
|
+
| Multiple | `/comet <description>` | → **Ask**: continue existing or create new; if continuing, list changes for selection |
|
|
34
|
+
| Exactly 1 | `/comet` with no description | → Auto-select, enter Step 1 |
|
|
35
|
+
| Multiple | `/comet` with no description | → List changes for user selection |
|
|
36
|
+
|
|
37
|
+
<IMPORTANT>
|
|
38
|
+
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.
|
|
40
|
+
Calling `/opsx:new` directly leaves `.comet.yaml` missing and breaks later phase detection.
|
|
41
|
+
</IMPORTANT>
|
|
35
42
|
|
|
36
43
|
**Preset detection**:
|
|
37
44
|
- User describes as bug fix / hotfix + meets hotfix conditions → directly invoke `/comet-hotfix`
|
|
@@ -41,14 +48,23 @@ Agents need only read this section for decision-making. Refer to the Reference A
|
|
|
41
48
|
|
|
42
49
|
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.
|
|
43
50
|
|
|
51
|
+
**Resume rules**:
|
|
52
|
+
- On every context resume, rerun Step 0 and Step 1; do not trust conversation history for phase detection
|
|
53
|
+
- If `phase: build`, read the next unchecked task from tasks.md and continue
|
|
54
|
+
- If `phase: verify` and `verify_result: fail`, first run `bash "$COMET_STATE" transition <name> verify-fail`, then invoke `/comet-build`
|
|
55
|
+
- 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: 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
|
+
|
|
44
58
|
**Step 2: Phase Determination** (check in order, first match wins)
|
|
45
59
|
|
|
46
60
|
1. `archived: true` or change moved to archive → Workflow complete
|
|
47
61
|
2. `verify_result: pass` and `archived` is not `true` → Invoke `/comet-archive`
|
|
48
|
-
3. `
|
|
49
|
-
4. `phase:
|
|
50
|
-
5. `phase:
|
|
51
|
-
6.
|
|
62
|
+
3. `verify_result: fail` → run `bash "$COMET_STATE" transition <name> verify-fail`, then invoke `/comet-build`
|
|
63
|
+
4. `phase: verify` or tasks.md all checked → Invoke `/comet-verify`
|
|
64
|
+
5. `phase: build` or has Design Doc but plan/execution incomplete → Invoke `/comet-build`
|
|
65
|
+
6. `phase: design` or has change but no Design Doc → Invoke `/comet-design`
|
|
66
|
+
7. `phase: open` or active change exists but `.comet.yaml` is missing → Invoke `/comet-open`
|
|
67
|
+
8. No active change → Invoke `/comet-open`
|
|
52
68
|
|
|
53
69
|
If metadata conflicts with file state, use verifiable file state as source of truth and correct `.comet.yaml` before continuing.
|
|
54
70
|
|
|
@@ -74,7 +90,7 @@ If metadata conflicts with file state, use verifiable file state as source of tr
|
|
|
74
90
|
| `openspec list --json` fails | Check if openspec is installed, prompt user to run `openspec init` |
|
|
75
91
|
| Sub-skill unavailable | Stop workflow, prompt to install or enable the corresponding skill |
|
|
76
92
|
| `.comet.yaml` malformed or missing | Use file state as source of truth, correct with `bash $COMET_STATE set` then continue |
|
|
77
|
-
|
|
|
93
|
+
| Build/test fails | Return to build phase for fixes, do not enter verify |
|
|
78
94
|
| Incomplete change directory structure | Fill missing files according to `comet-open` artifact requirements |
|
|
79
95
|
|
|
80
96
|
### Phase Transitions
|
|
@@ -84,6 +100,8 @@ A single `/comet` invocation starts from the detected phase and advances to the
|
|
|
84
100
|
|
|
85
101
|
Flow chain: open → design → build → verify → archive
|
|
86
102
|
|
|
103
|
+
**Continuous execution requirement**: starting from the detected phase, the agent must automatically continue through all later phases without waiting for another user command, except at explicit decision points. After a phase completes, immediately enter the next phase.
|
|
104
|
+
|
|
87
105
|
Nodes requiring user participation:
|
|
88
106
|
1. Confirm design approach during brainstorming
|
|
89
107
|
2. Select execution mode during build phase
|
|
@@ -160,9 +178,16 @@ archived: false
|
|
|
160
178
|
Comet scripts are distributed in `comet/scripts/`. **Do not hardcode paths** — locate once, cache in env vars:
|
|
161
179
|
|
|
162
180
|
```bash
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
181
|
+
COMET_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
|
|
182
|
+
COMET_GUARD="${COMET_GUARD:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-guard.sh' -type f -print -quit 2>/dev/null)}"
|
|
183
|
+
COMET_STATE="${COMET_STATE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-state.sh' -type f -print -quit 2>/dev/null)}"
|
|
184
|
+
COMET_ARCHIVE="${COMET_ARCHIVE:-$(find "${COMET_SEARCH_ROOTS[@]}" -path '*/comet/scripts/comet-archive.sh' -type f -print -quit 2>/dev/null)}"
|
|
185
|
+
|
|
186
|
+
if [ -z "$COMET_GUARD" ] || [ -z "$COMET_STATE" ] || [ -z "$COMET_ARCHIVE" ]; then
|
|
187
|
+
echo "ERROR: Comet scripts not found. Ensure the comet skill is installed." >&2
|
|
188
|
+
echo "Expected path pattern: */comet/scripts/comet-*.sh under project or platform skill directories" >&2
|
|
189
|
+
return 1
|
|
190
|
+
fi
|
|
166
191
|
```
|
|
167
192
|
|
|
168
193
|
**Auto state update**: Guard supports `--apply` flag, automatically updating `.comet.yaml` state fields after checks pass:
|
|
@@ -171,6 +196,17 @@ COMET_ARCHIVE="${COMET_ARCHIVE:-$(find . -path '*/comet/scripts/comet-archive.sh
|
|
|
171
196
|
bash "$COMET_GUARD" <change-name> <phase> --apply
|
|
172
197
|
```
|
|
173
198
|
|
|
199
|
+
`--apply` delegates to `comet-state transition`. Use these semantic events when state changes need to be expressed directly:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
bash "$COMET_STATE" transition <change-name> open-complete
|
|
203
|
+
bash "$COMET_STATE" transition <change-name> design-complete
|
|
204
|
+
bash "$COMET_STATE" transition <change-name> build-complete
|
|
205
|
+
bash "$COMET_STATE" transition <change-name> verify-pass
|
|
206
|
+
bash "$COMET_STATE" transition <change-name> verify-fail
|
|
207
|
+
bash "$COMET_STATE" transition <archive-name> archived
|
|
208
|
+
```
|
|
209
|
+
|
|
174
210
|
**Archive script**: Complete all archive steps in one command:
|
|
175
211
|
|
|
176
212
|
```bash
|
|
@@ -224,7 +224,7 @@ else
|
|
|
224
224
|
step_ok "Moved to: $ARCHIVE_DIR"
|
|
225
225
|
fi
|
|
226
226
|
|
|
227
|
-
# --- Step 8:
|
|
227
|
+
# --- Step 8: Mark archived via comet-state transition ---
|
|
228
228
|
|
|
229
229
|
STEPS_TOTAL=$((STEPS_TOTAL + 1))
|
|
230
230
|
|
|
@@ -235,7 +235,7 @@ if [ "$DRY_RUN" -eq 1 ]; then
|
|
|
235
235
|
STEPS_OK=$((STEPS_OK + 1))
|
|
236
236
|
else
|
|
237
237
|
if [ -f "$ARCHIVE_YAML" ]; then
|
|
238
|
-
|
|
238
|
+
bash "$STATE_SH" transition "$ARCHIVE_NAME" archived >/dev/null
|
|
239
239
|
step_ok "archived: true"
|
|
240
240
|
else
|
|
241
241
|
step_fail "archived: true (.comet.yaml not found after move)"
|
|
@@ -37,10 +37,14 @@ validate_change_name "$1"
|
|
|
37
37
|
CHANGE="$1"
|
|
38
38
|
PHASE="$2"
|
|
39
39
|
APPLY=0
|
|
40
|
+
SCRIPT_DIR="$(dirname "$(readlink -f "$0" 2>/dev/null || echo "$0")" 2>/dev/null || dirname "$0")"
|
|
40
41
|
if [[ "${3:-}" == "--apply" ]]; then
|
|
41
42
|
APPLY=1
|
|
42
43
|
fi
|
|
43
44
|
CHANGE_DIR="openspec/changes/$CHANGE"
|
|
45
|
+
if [ "$PHASE" = "archive" ] && [ ! -d "$CHANGE_DIR" ] && [ -d "openspec/changes/archive/$CHANGE" ]; then
|
|
46
|
+
CHANGE_DIR="openspec/changes/archive/$CHANGE"
|
|
47
|
+
fi
|
|
44
48
|
|
|
45
49
|
BLOCK=0
|
|
46
50
|
check() {
|
|
@@ -81,7 +85,6 @@ file_nonempty() {
|
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
preflight() {
|
|
84
|
-
local expected_phase="$1"
|
|
85
88
|
|
|
86
89
|
if [ ! -d "$CHANGE_DIR" ]; then
|
|
87
90
|
red "FATAL: change directory not found: $CHANGE_DIR"
|
|
@@ -92,17 +95,9 @@ preflight() {
|
|
|
92
95
|
exit 1
|
|
93
96
|
fi
|
|
94
97
|
|
|
95
|
-
local actual_phase
|
|
96
|
-
actual_phase=$(yaml_field_value "phase" 2>/dev/null || true)
|
|
97
|
-
if [ "$actual_phase" != "$expected_phase" ]; then
|
|
98
|
-
red "FATAL: .comet.yaml phase is '$actual_phase', expected '$expected_phase'"
|
|
99
|
-
exit 1
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
98
|
# Schema validation
|
|
103
|
-
local
|
|
104
|
-
|
|
105
|
-
validate_script="$script_dir/comet-yaml-validate.sh"
|
|
99
|
+
local validate_script
|
|
100
|
+
validate_script="$SCRIPT_DIR/comet-yaml-validate.sh"
|
|
106
101
|
if [ -f "$validate_script" ]; then
|
|
107
102
|
if ! bash "$validate_script" "$CHANGE" 2>/dev/null; then
|
|
108
103
|
bash "$validate_script" "$CHANGE"
|
|
@@ -116,8 +111,19 @@ build_passes() {
|
|
|
116
111
|
if [ "${COMET_SKIP_BUILD:-0}" = "1" ]; then
|
|
117
112
|
return 0
|
|
118
113
|
fi
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
if [ -f "package.json" ] && grep -q '"build"' "package.json"; then
|
|
115
|
+
npm run build >/dev/null
|
|
116
|
+
return $?
|
|
117
|
+
fi
|
|
118
|
+
if [ -f "pom.xml" ]; then
|
|
119
|
+
mvn compile -q >/dev/null
|
|
120
|
+
return $?
|
|
121
|
+
fi
|
|
122
|
+
if [ -f "Cargo.toml" ]; then
|
|
123
|
+
cargo build >/dev/null
|
|
124
|
+
return $?
|
|
125
|
+
fi
|
|
126
|
+
return 1
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
verify_result_is_pass() {
|
|
@@ -126,6 +132,18 @@ verify_result_is_pass() {
|
|
|
126
132
|
[ "$result" = "pass" ]
|
|
127
133
|
}
|
|
128
134
|
|
|
135
|
+
verification_report_exists() {
|
|
136
|
+
local report
|
|
137
|
+
report=$(yaml_field_value "verification_report" 2>/dev/null || true)
|
|
138
|
+
[ -n "$report" ] && [ "$report" != "null" ] && [ -f "$report" ]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
branch_status_handled() {
|
|
142
|
+
local status
|
|
143
|
+
status=$(yaml_field_value "branch_status" 2>/dev/null || true)
|
|
144
|
+
[ "$status" = "handled" ]
|
|
145
|
+
}
|
|
146
|
+
|
|
129
147
|
archived_is_true() {
|
|
130
148
|
local val
|
|
131
149
|
val=$(yaml_field_value "archived" 2>/dev/null || true)
|
|
@@ -135,7 +153,7 @@ archived_is_true() {
|
|
|
135
153
|
# --- Phase-specific checks ---
|
|
136
154
|
|
|
137
155
|
guard_open() {
|
|
138
|
-
echo "=== Guard: open →
|
|
156
|
+
echo "=== Guard: open → next ===" >&2
|
|
139
157
|
|
|
140
158
|
check "proposal.md exists and non-empty" file_nonempty "$CHANGE_DIR/proposal.md"
|
|
141
159
|
check "design.md exists and non-empty" file_nonempty "$CHANGE_DIR/design.md"
|
|
@@ -170,9 +188,10 @@ guard_build() {
|
|
|
170
188
|
guard_verify() {
|
|
171
189
|
echo "=== Guard: verify → archive ===" >&2
|
|
172
190
|
|
|
173
|
-
check "verify_result is pass" verify_result_is_pass
|
|
174
191
|
check "tasks.md all tasks checked" tasks_all_done
|
|
175
192
|
check "Build passes" build_passes
|
|
193
|
+
check "verification_report exists" verification_report_exists
|
|
194
|
+
check "branch_status=handled" branch_status_handled
|
|
176
195
|
}
|
|
177
196
|
|
|
178
197
|
guard_archive() {
|
|
@@ -184,50 +203,30 @@ guard_archive() {
|
|
|
184
203
|
}
|
|
185
204
|
|
|
186
205
|
apply_state_update() {
|
|
187
|
-
local state_sh="$
|
|
206
|
+
local state_sh="$SCRIPT_DIR/comet-state.sh"
|
|
188
207
|
local p="$1"
|
|
189
208
|
|
|
190
209
|
if [ -f "$state_sh" ]; then
|
|
191
210
|
case "$p" in
|
|
192
|
-
open) bash "$state_sh"
|
|
193
|
-
design) bash "$state_sh"
|
|
194
|
-
build)
|
|
195
|
-
|
|
196
|
-
bash "$state_sh" set "$CHANGE" verify_result pending
|
|
197
|
-
;;
|
|
198
|
-
verify)
|
|
199
|
-
bash "$state_sh" set "$CHANGE" phase archive
|
|
200
|
-
bash "$state_sh" set "$CHANGE" verify_result pass
|
|
201
|
-
bash "$state_sh" set "$CHANGE" verified_at "$(date +%Y-%m-%d)"
|
|
202
|
-
;;
|
|
211
|
+
open) bash "$state_sh" transition "$CHANGE" open-complete ;;
|
|
212
|
+
design) bash "$state_sh" transition "$CHANGE" design-complete ;;
|
|
213
|
+
build) bash "$state_sh" transition "$CHANGE" build-complete ;;
|
|
214
|
+
verify) bash "$state_sh" transition "$CHANGE" verify-pass ;;
|
|
203
215
|
esac
|
|
204
216
|
else
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
open) sed -i 's/^phase:.*/phase: design/' "$yaml" ;;
|
|
208
|
-
design) sed -i 's/^phase:.*/phase: build/' "$yaml" ;;
|
|
209
|
-
build) sed -i 's/^phase:.*/phase: verify/' "$yaml"; sed -i 's/^verify_result:.*/verify_result: pending/' "$yaml" ;;
|
|
210
|
-
verify)
|
|
211
|
-
sed -i 's/^phase:.*/phase: archive/' "$yaml"
|
|
212
|
-
sed -i 's/^verify_result:.*/verify_result: pass/' "$yaml"
|
|
213
|
-
if ! grep -q '^verified_at:' "$yaml" 2>/dev/null; then
|
|
214
|
-
echo "verified_at: $(date +%Y-%m-%d)" >> "$yaml"
|
|
215
|
-
else
|
|
216
|
-
sed -i "s/^verified_at:.*/verified_at: $(date +%Y-%m-%d)/" "$yaml"
|
|
217
|
-
fi
|
|
218
|
-
;;
|
|
219
|
-
esac
|
|
217
|
+
red "FATAL: comet-state.sh not found; cannot apply state transition"
|
|
218
|
+
exit 1
|
|
220
219
|
fi
|
|
221
220
|
}
|
|
222
221
|
|
|
223
222
|
# --- Main ---
|
|
224
223
|
|
|
225
224
|
case "$PHASE" in
|
|
226
|
-
open) preflight
|
|
227
|
-
design) preflight
|
|
228
|
-
build) preflight
|
|
229
|
-
verify) preflight
|
|
230
|
-
archive) preflight
|
|
225
|
+
open) preflight ; guard_open ;;
|
|
226
|
+
design) preflight ; guard_design ;;
|
|
227
|
+
build) preflight ; guard_build ;;
|
|
228
|
+
verify) preflight ; guard_verify ;;
|
|
229
|
+
archive) preflight ; guard_archive ;;
|
|
231
230
|
*)
|
|
232
231
|
red "Unknown phase: $PHASE"
|
|
233
232
|
echo "Valid phases: open, design, build, verify, archive" >&2
|
|
@@ -245,7 +244,10 @@ else
|
|
|
245
244
|
if [ "$APPLY" -eq 1 ]; then
|
|
246
245
|
apply_state_update "$PHASE"
|
|
247
246
|
case "$PHASE" in
|
|
248
|
-
open)
|
|
247
|
+
open)
|
|
248
|
+
new_phase=$(grep "^phase:" "$CHANGE_DIR/.comet.yaml" | sed 's/^phase: *//' | tr -d '"' | tr -d "'")
|
|
249
|
+
green " [APPLY] .comet.yaml updated: phase=$new_phase"
|
|
250
|
+
;;
|
|
249
251
|
design) green " [APPLY] .comet.yaml updated: phase=build" ;;
|
|
250
252
|
build) green " [APPLY] .comet.yaml updated: phase=verify, verify_result=pending" ;;
|
|
251
253
|
verify) green " [APPLY] .comet.yaml updated: phase=archive, verify_result=pass" ;;
|