@rpamis/comet 0.2.1 → 0.2.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/README.md +270 -270
- package/assets/manifest.json +21 -21
- package/assets/skills/comet/scripts/comet-archive.sh +258 -258
- package/assets/skills/comet/scripts/comet-guard.sh +255 -255
- package/assets/skills/comet/scripts/comet-state.sh +497 -497
- package/assets/skills/comet/scripts/comet-yaml-validate.sh +132 -132
- package/assets/skills/comet-archive/SKILL.md +63 -63
- package/assets/skills/comet-build/SKILL.md +153 -153
- package/assets/skills/comet-design/SKILL.md +91 -91
- package/assets/skills/comet-open/SKILL.md +70 -70
- package/assets/skills/comet-verify/SKILL.md +114 -114
- package/assets/skills-zh/comet-archive/SKILL.md +63 -63
- package/assets/skills-zh/comet-build/SKILL.md +153 -153
- package/assets/skills-zh/comet-design/SKILL.md +91 -91
- package/assets/skills-zh/comet-open/SKILL.md +70 -70
- package/assets/skills-zh/comet-verify/SKILL.md +114 -114
- package/bin/comet.js +3 -3
- package/dist/cli/index.js +10 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/core/detect.d.ts +6 -1
- package/dist/core/detect.d.ts.map +1 -1
- package/dist/core/detect.js +29 -1
- package/dist/core/detect.js.map +1 -1
- package/package.json +62 -62
- package/scripts/postinstall.js +44 -44
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Comet YAML Schema Validator — validates .comet.yaml structure
|
|
3
|
-
# Usage: comet-yaml-validate.sh <change-name>
|
|
4
|
-
# Exit 0 = valid, exit 1 = errors found (printed to stderr)
|
|
5
|
-
|
|
6
|
-
set -euo pipefail
|
|
7
|
-
|
|
8
|
-
red() { echo -e "\033[31m$1\033[0m" >&2; }
|
|
9
|
-
green() { echo -e "\033[32m$1\033[0m" >&2; }
|
|
10
|
-
warn() { echo -e "\033[33m$1\033[0m" >&2; }
|
|
11
|
-
|
|
12
|
-
# Input validation - prevent path traversal
|
|
13
|
-
validate_change_name() {
|
|
14
|
-
local name="$1"
|
|
15
|
-
# Reject empty names
|
|
16
|
-
if [ -z "$name" ]; then
|
|
17
|
-
red "ERROR: Change name cannot be empty" >&2
|
|
18
|
-
exit 1
|
|
19
|
-
fi
|
|
20
|
-
# Only allow alphanumeric, hyphens, and underscores
|
|
21
|
-
if [[ ! "$name" =~ ^[a-zA-Z0-9_-]+$ ]]; then
|
|
22
|
-
red "ERROR: Invalid change name: '$name'" >&2
|
|
23
|
-
red "Valid characters: a-z, A-Z, 0-9, -, _" >&2
|
|
24
|
-
exit 1
|
|
25
|
-
fi
|
|
26
|
-
# Reject path traversal attempts
|
|
27
|
-
if [[ "$name" =~ \.\. ]]; then
|
|
28
|
-
red "ERROR: Change name cannot contain '..' (path traversal not allowed)" >&2
|
|
29
|
-
exit 1
|
|
30
|
-
fi
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
validate_change_name "$1"
|
|
34
|
-
|
|
35
|
-
CHANGE="$1"
|
|
36
|
-
YAML="openspec/changes/$CHANGE/.comet.yaml"
|
|
37
|
-
|
|
38
|
-
ERRORS=0
|
|
39
|
-
WARNINGS=0
|
|
40
|
-
|
|
41
|
-
# Helper: get value of a top-level field (handles null, empty, quoted)
|
|
42
|
-
field_value() {
|
|
43
|
-
grep "^${1}:" "$YAML" 2>/dev/null | sed "s/^${1}: *//" | tr -d '"' | tr -d "'" || true
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
fail() { red " FAIL: $1"; ERRORS=$((ERRORS + 1)); }
|
|
47
|
-
warn_msg() { warn " WARN: $1"; WARNINGS=$((WARNINGS + 1)); }
|
|
48
|
-
|
|
49
|
-
echo "[VALIDATE] $YAML" >&2
|
|
50
|
-
|
|
51
|
-
# --- Required fields ---
|
|
52
|
-
REQUIRED_FIELDS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verified_at archived"
|
|
53
|
-
for field in $REQUIRED_FIELDS; do
|
|
54
|
-
if ! grep -q "^${field}:" "$YAML" 2>/dev/null; then
|
|
55
|
-
fail "missing required field '$field'"
|
|
56
|
-
fi
|
|
57
|
-
done
|
|
58
|
-
|
|
59
|
-
# --- Enum validation ---
|
|
60
|
-
validate_enum() {
|
|
61
|
-
local field="$1" value="$2"
|
|
62
|
-
shift 2
|
|
63
|
-
local valid_values="$*"
|
|
64
|
-
|
|
65
|
-
# null or empty is always acceptable
|
|
66
|
-
if [ -z "$value" ] || [ "$value" = "null" ]; then
|
|
67
|
-
return 0
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
for v in $valid_values; do
|
|
71
|
-
if [ "$value" = "$v" ]; then
|
|
72
|
-
return 0
|
|
73
|
-
fi
|
|
74
|
-
done
|
|
75
|
-
fail "$field='$value' is not valid. Expected: $valid_values"
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
workflow=$(field_value "workflow")
|
|
79
|
-
phase=$(field_value "phase")
|
|
80
|
-
build_mode=$(field_value "build_mode")
|
|
81
|
-
isolation=$(field_value "isolation")
|
|
82
|
-
verify_mode=$(field_value "verify_mode")
|
|
83
|
-
verify_result=$(field_value "verify_result")
|
|
84
|
-
archived=$(field_value "archived")
|
|
85
|
-
design_doc=$(field_value "design_doc")
|
|
86
|
-
plan=$(field_value "plan")
|
|
87
|
-
|
|
88
|
-
validate_enum "workflow" "$workflow" "full hotfix tweak"
|
|
89
|
-
validate_enum "phase" "$phase" "design build verify archive"
|
|
90
|
-
validate_enum "build_mode" "$build_mode" "subagent-driven-development executing-plans direct"
|
|
91
|
-
validate_enum "isolation" "$isolation" "branch worktree"
|
|
92
|
-
validate_enum "verify_mode" "$verify_mode" "light full"
|
|
93
|
-
validate_enum "verify_result" "$verify_result" "pending pass fail"
|
|
94
|
-
validate_enum "archived" "$archived" "true false"
|
|
95
|
-
|
|
96
|
-
# --- Path validation ---
|
|
97
|
-
|
|
98
|
-
if [ -n "$design_doc" ] && [ "$design_doc" != "null" ]; then
|
|
99
|
-
if [ ! -f "$design_doc" ]; then
|
|
100
|
-
fail "design_doc='$design_doc' does not exist on disk"
|
|
101
|
-
fi
|
|
102
|
-
fi
|
|
103
|
-
|
|
104
|
-
if [ -n "$plan" ] && [ "$plan" != "null" ]; then
|
|
105
|
-
if [ ! -f "$plan" ]; then
|
|
106
|
-
fail "plan='$plan' does not exist on disk"
|
|
107
|
-
fi
|
|
108
|
-
fi
|
|
109
|
-
|
|
110
|
-
# --- Unknown keys check ---
|
|
111
|
-
KNOWN_KEYS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verified_at archived"
|
|
112
|
-
while IFS=: read -r key _; do
|
|
113
|
-
key="${key// /}"
|
|
114
|
-
[ -z "$key" ] && continue
|
|
115
|
-
found=0
|
|
116
|
-
for known in $KNOWN_KEYS; do
|
|
117
|
-
[ "$key" = "$known" ] && found=1 && break
|
|
118
|
-
done
|
|
119
|
-
if [ "$found" -eq 0 ]; then
|
|
120
|
-
warn_msg "unknown field '$key' found"
|
|
121
|
-
fi
|
|
122
|
-
done < "$YAML"
|
|
123
|
-
|
|
124
|
-
# --- Summary ---
|
|
125
|
-
echo "" >&2
|
|
126
|
-
if [ "$ERRORS" -gt 0 ]; then
|
|
127
|
-
red "$ERRORS error(s), $WARNINGS warning(s) — validation FAILED"
|
|
128
|
-
exit 1
|
|
129
|
-
else
|
|
130
|
-
green "0 errors, $WARNINGS warning(s) — validation PASSED"
|
|
131
|
-
exit 0
|
|
132
|
-
fi
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Comet YAML Schema Validator — validates .comet.yaml structure
|
|
3
|
+
# Usage: comet-yaml-validate.sh <change-name>
|
|
4
|
+
# Exit 0 = valid, exit 1 = errors found (printed to stderr)
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
red() { echo -e "\033[31m$1\033[0m" >&2; }
|
|
9
|
+
green() { echo -e "\033[32m$1\033[0m" >&2; }
|
|
10
|
+
warn() { echo -e "\033[33m$1\033[0m" >&2; }
|
|
11
|
+
|
|
12
|
+
# Input validation - prevent path traversal
|
|
13
|
+
validate_change_name() {
|
|
14
|
+
local name="$1"
|
|
15
|
+
# Reject empty names
|
|
16
|
+
if [ -z "$name" ]; then
|
|
17
|
+
red "ERROR: Change name cannot be empty" >&2
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
# Only allow alphanumeric, hyphens, and underscores
|
|
21
|
+
if [[ ! "$name" =~ ^[a-zA-Z0-9_-]+$ ]]; then
|
|
22
|
+
red "ERROR: Invalid change name: '$name'" >&2
|
|
23
|
+
red "Valid characters: a-z, A-Z, 0-9, -, _" >&2
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
# Reject path traversal attempts
|
|
27
|
+
if [[ "$name" =~ \.\. ]]; then
|
|
28
|
+
red "ERROR: Change name cannot contain '..' (path traversal not allowed)" >&2
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
validate_change_name "$1"
|
|
34
|
+
|
|
35
|
+
CHANGE="$1"
|
|
36
|
+
YAML="openspec/changes/$CHANGE/.comet.yaml"
|
|
37
|
+
|
|
38
|
+
ERRORS=0
|
|
39
|
+
WARNINGS=0
|
|
40
|
+
|
|
41
|
+
# Helper: get value of a top-level field (handles null, empty, quoted)
|
|
42
|
+
field_value() {
|
|
43
|
+
grep "^${1}:" "$YAML" 2>/dev/null | sed "s/^${1}: *//" | tr -d '"' | tr -d "'" || true
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
fail() { red " FAIL: $1"; ERRORS=$((ERRORS + 1)); }
|
|
47
|
+
warn_msg() { warn " WARN: $1"; WARNINGS=$((WARNINGS + 1)); }
|
|
48
|
+
|
|
49
|
+
echo "[VALIDATE] $YAML" >&2
|
|
50
|
+
|
|
51
|
+
# --- Required fields ---
|
|
52
|
+
REQUIRED_FIELDS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verified_at archived"
|
|
53
|
+
for field in $REQUIRED_FIELDS; do
|
|
54
|
+
if ! grep -q "^${field}:" "$YAML" 2>/dev/null; then
|
|
55
|
+
fail "missing required field '$field'"
|
|
56
|
+
fi
|
|
57
|
+
done
|
|
58
|
+
|
|
59
|
+
# --- Enum validation ---
|
|
60
|
+
validate_enum() {
|
|
61
|
+
local field="$1" value="$2"
|
|
62
|
+
shift 2
|
|
63
|
+
local valid_values="$*"
|
|
64
|
+
|
|
65
|
+
# null or empty is always acceptable
|
|
66
|
+
if [ -z "$value" ] || [ "$value" = "null" ]; then
|
|
67
|
+
return 0
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
for v in $valid_values; do
|
|
71
|
+
if [ "$value" = "$v" ]; then
|
|
72
|
+
return 0
|
|
73
|
+
fi
|
|
74
|
+
done
|
|
75
|
+
fail "$field='$value' is not valid. Expected: $valid_values"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
workflow=$(field_value "workflow")
|
|
79
|
+
phase=$(field_value "phase")
|
|
80
|
+
build_mode=$(field_value "build_mode")
|
|
81
|
+
isolation=$(field_value "isolation")
|
|
82
|
+
verify_mode=$(field_value "verify_mode")
|
|
83
|
+
verify_result=$(field_value "verify_result")
|
|
84
|
+
archived=$(field_value "archived")
|
|
85
|
+
design_doc=$(field_value "design_doc")
|
|
86
|
+
plan=$(field_value "plan")
|
|
87
|
+
|
|
88
|
+
validate_enum "workflow" "$workflow" "full hotfix tweak"
|
|
89
|
+
validate_enum "phase" "$phase" "design build verify archive"
|
|
90
|
+
validate_enum "build_mode" "$build_mode" "subagent-driven-development executing-plans direct"
|
|
91
|
+
validate_enum "isolation" "$isolation" "branch worktree"
|
|
92
|
+
validate_enum "verify_mode" "$verify_mode" "light full"
|
|
93
|
+
validate_enum "verify_result" "$verify_result" "pending pass fail"
|
|
94
|
+
validate_enum "archived" "$archived" "true false"
|
|
95
|
+
|
|
96
|
+
# --- Path validation ---
|
|
97
|
+
|
|
98
|
+
if [ -n "$design_doc" ] && [ "$design_doc" != "null" ]; then
|
|
99
|
+
if [ ! -f "$design_doc" ]; then
|
|
100
|
+
fail "design_doc='$design_doc' does not exist on disk"
|
|
101
|
+
fi
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
if [ -n "$plan" ] && [ "$plan" != "null" ]; then
|
|
105
|
+
if [ ! -f "$plan" ]; then
|
|
106
|
+
fail "plan='$plan' does not exist on disk"
|
|
107
|
+
fi
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
# --- Unknown keys check ---
|
|
111
|
+
KNOWN_KEYS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verified_at archived"
|
|
112
|
+
while IFS=: read -r key _; do
|
|
113
|
+
key="${key// /}"
|
|
114
|
+
[ -z "$key" ] && continue
|
|
115
|
+
found=0
|
|
116
|
+
for known in $KNOWN_KEYS; do
|
|
117
|
+
[ "$key" = "$known" ] && found=1 && break
|
|
118
|
+
done
|
|
119
|
+
if [ "$found" -eq 0 ]; then
|
|
120
|
+
warn_msg "unknown field '$key' found"
|
|
121
|
+
fi
|
|
122
|
+
done < "$YAML"
|
|
123
|
+
|
|
124
|
+
# --- Summary ---
|
|
125
|
+
echo "" >&2
|
|
126
|
+
if [ "$ERRORS" -gt 0 ]; then
|
|
127
|
+
red "$ERRORS error(s), $WARNINGS warning(s) — validation FAILED"
|
|
128
|
+
exit 1
|
|
129
|
+
else
|
|
130
|
+
green "0 errors, $WARNINGS warning(s) — validation PASSED"
|
|
131
|
+
exit 0
|
|
132
|
+
fi
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: comet-archive
|
|
3
|
-
description: "Comet Phase 5: Archive. Invoke with /comet-archive. Sync delta spec to main spec, archive change."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Comet Phase 5: Archive (Archive)
|
|
7
|
-
|
|
8
|
-
## Prerequisites
|
|
9
|
-
|
|
10
|
-
- Verification passed (Phase 4 complete)
|
|
11
|
-
- Branch handled
|
|
12
|
-
- `verify_result: pass` in `openspec/changes/<name>/.comet.yaml`
|
|
13
|
-
|
|
14
|
-
## Steps
|
|
15
|
-
|
|
16
|
-
### 0. Entry State Verification (Entry Check)
|
|
17
|
-
|
|
18
|
-
Execute entry verification:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
COMET_STATE="${COMET_STATE:-$(find . -path '*/comet/scripts/comet-state.sh' -type f -print -quit)}"
|
|
22
|
-
bash "$COMET_STATE" check <name> archive
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
26
|
-
|
|
27
|
-
### 1. Execute Archive
|
|
28
|
-
|
|
29
|
-
Run the archive script to automatically complete all steps:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
COMET_ARCHIVE="${COMET_ARCHIVE:-$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)}"
|
|
33
|
-
bash "$COMET_ARCHIVE" "<change-name>"
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
The script automatically executes:
|
|
37
|
-
1. Entry state validation (phase=archive, verify_result=pass, archived=false)
|
|
38
|
-
2. Delta spec sync to main spec (overwrite)
|
|
39
|
-
3. Design doc frontmatter annotation (archived-with, status)
|
|
40
|
-
4. Plan frontmatter annotation (archived-with)
|
|
41
|
-
5. Move change to archive directory
|
|
42
|
-
6. Update archived: true
|
|
43
|
-
|
|
44
|
-
If script returns non-zero exit code, report error and stop.
|
|
45
|
-
If script returns zero exit code, archive is complete.
|
|
46
|
-
|
|
47
|
-
Use `--dry-run` flag to preview without executing.
|
|
48
|
-
|
|
49
|
-
### 2. Lifecycle Closed Loop
|
|
50
|
-
|
|
51
|
-
Spec lifecycle completes here:
|
|
52
|
-
```
|
|
53
|
-
brainstorming → delta spec → implementation → verification → main spec overwrite → design doc annotation → archive
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Exit Conditions
|
|
57
|
-
|
|
58
|
-
- Archive script executed successfully (exit code 0)
|
|
59
|
-
- **Phase guard**: Run `bash $COMET_GUARD <change-name> archive`, confirm archive complete after all PASS
|
|
60
|
-
|
|
61
|
-
## Complete
|
|
62
|
-
|
|
63
|
-
Comet workflow complete. To start new work, invoke `/comet` or `/comet-open`.
|
|
1
|
+
---
|
|
2
|
+
name: comet-archive
|
|
3
|
+
description: "Comet Phase 5: Archive. Invoke with /comet-archive. Sync delta spec to main spec, archive change."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Comet Phase 5: Archive (Archive)
|
|
7
|
+
|
|
8
|
+
## Prerequisites
|
|
9
|
+
|
|
10
|
+
- Verification passed (Phase 4 complete)
|
|
11
|
+
- Branch handled
|
|
12
|
+
- `verify_result: pass` in `openspec/changes/<name>/.comet.yaml`
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
### 0. Entry State Verification (Entry Check)
|
|
17
|
+
|
|
18
|
+
Execute entry verification:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
COMET_STATE="${COMET_STATE:-$(find . -path '*/comet/scripts/comet-state.sh' -type f -print -quit)}"
|
|
22
|
+
bash "$COMET_STATE" check <name> archive
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
26
|
+
|
|
27
|
+
### 1. Execute Archive
|
|
28
|
+
|
|
29
|
+
Run the archive script to automatically complete all steps:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
COMET_ARCHIVE="${COMET_ARCHIVE:-$(find . -path '*/comet/scripts/comet-archive.sh' -type f -print -quit)}"
|
|
33
|
+
bash "$COMET_ARCHIVE" "<change-name>"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The script automatically executes:
|
|
37
|
+
1. Entry state validation (phase=archive, verify_result=pass, archived=false)
|
|
38
|
+
2. Delta spec sync to main spec (overwrite)
|
|
39
|
+
3. Design doc frontmatter annotation (archived-with, status)
|
|
40
|
+
4. Plan frontmatter annotation (archived-with)
|
|
41
|
+
5. Move change to archive directory
|
|
42
|
+
6. Update archived: true
|
|
43
|
+
|
|
44
|
+
If script returns non-zero exit code, report error and stop.
|
|
45
|
+
If script returns zero exit code, archive is complete.
|
|
46
|
+
|
|
47
|
+
Use `--dry-run` flag to preview without executing.
|
|
48
|
+
|
|
49
|
+
### 2. Lifecycle Closed Loop
|
|
50
|
+
|
|
51
|
+
Spec lifecycle completes here:
|
|
52
|
+
```
|
|
53
|
+
brainstorming → delta spec → implementation → verification → main spec overwrite → design doc annotation → archive
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Exit Conditions
|
|
57
|
+
|
|
58
|
+
- Archive script executed successfully (exit code 0)
|
|
59
|
+
- **Phase guard**: Run `bash $COMET_GUARD <change-name> archive`, confirm archive complete after all PASS
|
|
60
|
+
|
|
61
|
+
## Complete
|
|
62
|
+
|
|
63
|
+
Comet workflow complete. To start new work, invoke `/comet` or `/comet-open`.
|