@pzy560117/opensuper 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +362 -0
  3. package/assets/manifest.json +21 -0
  4. package/assets/skills/opensuper/SKILL.md +268 -0
  5. package/assets/skills/opensuper/scripts/opensuper-archive.sh +255 -0
  6. package/assets/skills/opensuper/scripts/opensuper-guard.sh +407 -0
  7. package/assets/skills/opensuper/scripts/opensuper-state.sh +680 -0
  8. package/assets/skills/opensuper/scripts/opensuper-yaml-validate.sh +157 -0
  9. package/assets/skills/opensuper-archive/SKILL.md +69 -0
  10. package/assets/skills/opensuper-build/SKILL.md +194 -0
  11. package/assets/skills/opensuper-design/SKILL.md +84 -0
  12. package/assets/skills/opensuper-hotfix/SKILL.md +146 -0
  13. package/assets/skills/opensuper-open/SKILL.md +82 -0
  14. package/assets/skills/opensuper-tweak/SKILL.md +133 -0
  15. package/assets/skills/opensuper-verify/SKILL.md +139 -0
  16. package/assets/skills-zh/opensuper/SKILL.md +271 -0
  17. package/assets/skills-zh/opensuper-archive/SKILL.md +69 -0
  18. package/assets/skills-zh/opensuper-build/SKILL.md +194 -0
  19. package/assets/skills-zh/opensuper-design/SKILL.md +84 -0
  20. package/assets/skills-zh/opensuper-hotfix/SKILL.md +152 -0
  21. package/assets/skills-zh/opensuper-open/SKILL.md +84 -0
  22. package/assets/skills-zh/opensuper-tweak/SKILL.md +139 -0
  23. package/assets/skills-zh/opensuper-verify/SKILL.md +154 -0
  24. package/bin/opensuper.js +3 -0
  25. package/dist/cli/index.d.ts +2 -0
  26. package/dist/cli/index.d.ts.map +1 -0
  27. package/dist/cli/index.js +63 -0
  28. package/dist/cli/index.js.map +1 -0
  29. package/dist/commands/doctor.d.ts +9 -0
  30. package/dist/commands/doctor.d.ts.map +1 -0
  31. package/dist/commands/doctor.js +191 -0
  32. package/dist/commands/doctor.js.map +1 -0
  33. package/dist/commands/init.d.ts +17 -0
  34. package/dist/commands/init.d.ts.map +1 -0
  35. package/dist/commands/init.js +242 -0
  36. package/dist/commands/init.js.map +1 -0
  37. package/dist/commands/status.d.ts +6 -0
  38. package/dist/commands/status.d.ts.map +1 -0
  39. package/dist/commands/status.js +108 -0
  40. package/dist/commands/status.js.map +1 -0
  41. package/dist/commands/update.d.ts +28 -0
  42. package/dist/commands/update.d.ts.map +1 -0
  43. package/dist/commands/update.js +193 -0
  44. package/dist/commands/update.js.map +1 -0
  45. package/dist/core/detect.d.ts +13 -0
  46. package/dist/core/detect.d.ts.map +1 -0
  47. package/dist/core/detect.js +101 -0
  48. package/dist/core/detect.js.map +1 -0
  49. package/dist/core/openspec.d.ts +5 -0
  50. package/dist/core/openspec.d.ts.map +1 -0
  51. package/dist/core/openspec.js +58 -0
  52. package/dist/core/openspec.js.map +1 -0
  53. package/dist/core/platforms.d.ts +15 -0
  54. package/dist/core/platforms.d.ts.map +1 -0
  55. package/dist/core/platforms.js +48 -0
  56. package/dist/core/platforms.js.map +1 -0
  57. package/dist/core/skills.d.ts +22 -0
  58. package/dist/core/skills.d.ts.map +1 -0
  59. package/dist/core/skills.js +59 -0
  60. package/dist/core/skills.js.map +1 -0
  61. package/dist/core/superpowers.d.ts +5 -0
  62. package/dist/core/superpowers.d.ts.map +1 -0
  63. package/dist/core/superpowers.js +60 -0
  64. package/dist/core/superpowers.js.map +1 -0
  65. package/dist/core/types.d.ts +2 -0
  66. package/dist/core/types.d.ts.map +1 -0
  67. package/dist/core/types.js +2 -0
  68. package/dist/core/types.js.map +1 -0
  69. package/dist/utils/file-system.d.ts +25 -0
  70. package/dist/utils/file-system.d.ts.map +1 -0
  71. package/dist/utils/file-system.js +53 -0
  72. package/dist/utils/file-system.js.map +1 -0
  73. package/package.json +60 -0
  74. package/scripts/postinstall.js +44 -0
@@ -0,0 +1,157 @@
1
+ #!/bin/bash
2
+ # OpenSuper YAML Schema Validator — validates .opensuper.yaml structure
3
+ # Usage: opensuper-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
+ CHANGE_DIR="openspec/changes/$CHANGE"
37
+ if [ ! -d "$CHANGE_DIR" ] && [ -d "openspec/changes/archive/$CHANGE" ]; then
38
+ CHANGE_DIR="openspec/changes/archive/$CHANGE"
39
+ fi
40
+ YAML="$CHANGE_DIR/.opensuper.yaml"
41
+
42
+ ERRORS=0
43
+ WARNINGS=0
44
+
45
+ # Helper: get value of a top-level field (handles null, empty, quoted)
46
+ field_value() {
47
+ local value
48
+ value=$(grep "^${1}:" "$YAML" 2>/dev/null | sed "s/^${1}: *//" || true)
49
+ strip_wrapping_quotes "$value"
50
+ }
51
+
52
+ strip_wrapping_quotes() {
53
+ local value="$1"
54
+ case "$value" in
55
+ \"*\")
56
+ printf '%s\n' "${value:1:${#value}-2}"
57
+ ;;
58
+ \'*\')
59
+ printf '%s\n' "${value:1:${#value}-2}"
60
+ ;;
61
+ *)
62
+ printf '%s\n' "$value"
63
+ ;;
64
+ esac
65
+ }
66
+
67
+ fail() { red " FAIL: $1"; ERRORS=$((ERRORS + 1)); }
68
+ warn_msg() { warn " WARN: $1"; WARNINGS=$((WARNINGS + 1)); }
69
+
70
+ echo "[VALIDATE] $YAML" >&2
71
+
72
+ # --- Required fields ---
73
+ REQUIRED_FIELDS="workflow phase design_doc plan build_mode isolation verify_mode verify_result verified_at archived"
74
+ for field in $REQUIRED_FIELDS; do
75
+ if ! grep -q "^${field}:" "$YAML" 2>/dev/null; then
76
+ fail "missing required field '$field'"
77
+ fi
78
+ done
79
+
80
+ # --- Enum validation ---
81
+ validate_enum() {
82
+ local field="$1" value="$2"
83
+ shift 2
84
+ local valid_values="$*"
85
+
86
+ # null or empty is always acceptable
87
+ if [ -z "$value" ] || [ "$value" = "null" ]; then
88
+ return 0
89
+ fi
90
+
91
+ for v in $valid_values; do
92
+ if [ "$value" = "$v" ]; then
93
+ return 0
94
+ fi
95
+ done
96
+ fail "$field='$value' is not valid. Expected: $valid_values"
97
+ }
98
+
99
+ workflow=$(field_value "workflow")
100
+ phase=$(field_value "phase")
101
+ build_mode=$(field_value "build_mode")
102
+ isolation=$(field_value "isolation")
103
+ verify_mode=$(field_value "verify_mode")
104
+ verify_result=$(field_value "verify_result")
105
+ branch_status=$(field_value "branch_status")
106
+ archived=$(field_value "archived")
107
+ direct_override=$(field_value "direct_override")
108
+ design_doc=$(field_value "design_doc")
109
+ plan=$(field_value "plan")
110
+
111
+ validate_enum "workflow" "$workflow" "full hotfix tweak"
112
+ validate_enum "phase" "$phase" "open design build verify archive"
113
+ validate_enum "build_mode" "$build_mode" "subagent-driven-development executing-plans direct"
114
+ validate_enum "isolation" "$isolation" "branch worktree"
115
+ validate_enum "verify_mode" "$verify_mode" "light full"
116
+ validate_enum "verify_result" "$verify_result" "pending pass fail"
117
+ validate_enum "branch_status" "$branch_status" "pending handled"
118
+ validate_enum "archived" "$archived" "true false"
119
+ validate_enum "direct_override" "$direct_override" "true false"
120
+
121
+ # --- Path validation ---
122
+
123
+ if [ -n "$design_doc" ] && [ "$design_doc" != "null" ]; then
124
+ if [ ! -f "$design_doc" ]; then
125
+ fail "design_doc='$design_doc' does not exist on disk"
126
+ fi
127
+ fi
128
+
129
+ if [ -n "$plan" ] && [ "$plan" != "null" ]; then
130
+ if [ ! -f "$plan" ]; then
131
+ fail "plan='$plan' does not exist on disk"
132
+ fi
133
+ fi
134
+
135
+ # --- Unknown keys check ---
136
+ 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"
137
+ while IFS=: read -r key _; do
138
+ key="${key// /}"
139
+ [ -z "$key" ] && continue
140
+ found=0
141
+ for known in $KNOWN_KEYS; do
142
+ [ "$key" = "$known" ] && found=1 && break
143
+ done
144
+ if [ "$found" -eq 0 ]; then
145
+ warn_msg "unknown field '$key' found"
146
+ fi
147
+ done < "$YAML"
148
+
149
+ # --- Summary ---
150
+ echo "" >&2
151
+ if [ "$ERRORS" -gt 0 ]; then
152
+ red "$ERRORS error(s), $WARNINGS warning(s) — validation FAILED"
153
+ exit 1
154
+ else
155
+ green "0 errors, $WARNINGS warning(s) — validation PASSED"
156
+ exit 0
157
+ fi
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: opensuper-archive
3
+ description: "OpenSuper Phase 5: Archive. Invoke with /opensuper-archive. Sync delta spec to main spec, archive change."
4
+ ---
5
+
6
+ # OpenSuper 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>/.opensuper.yaml`
13
+
14
+ ## Steps
15
+
16
+ ### 0. Entry State Verification (Entry Check)
17
+
18
+ Execute entry verification:
19
+
20
+ ```bash
21
+ OPENSUPER_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
22
+ OPENSUPER_STATE="${OPENSUPER_STATE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-state.sh' -type f -print -quit 2>/dev/null)}"
23
+ bash "$OPENSUPER_STATE" check <name> archive
24
+ ```
25
+
26
+ Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
27
+
28
+ ### 1. Execute Archive
29
+
30
+ Run the archive script to automatically complete all steps:
31
+
32
+ ```bash
33
+ bash "$OPENSUPER_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` through `opensuper-state transition <archive-name> archived`
43
+
44
+ If script returns non-zero exit code, report error and stop.
45
+ If script returns zero exit code, archive is complete.
46
+ The summary `X/Y steps succeeded` counts real executed steps and does not double-count delta spec sync or document annotation.
47
+
48
+ When a delta spec differs from an existing main spec, the script prints a unified diff before overwrite so the archive sync content is visible.
49
+
50
+ Use `--dry-run` flag to preview without executing.
51
+
52
+ ### 2. Lifecycle Closed Loop
53
+
54
+ Spec lifecycle completes here:
55
+ ```
56
+ brainstorming → delta spec → implementation → verification → main spec overwrite → design doc annotation → archive
57
+ ```
58
+
59
+ ## Exit Conditions
60
+
61
+ - Archive script executed successfully (exit code 0)
62
+ - Archive directory `openspec/changes/archive/YYYY-MM-DD-<change-name>/` exists
63
+ - Archived `.opensuper.yaml` contains `archived: true`
64
+
65
+ The archive script moves `openspec/changes/<name>/` to `openspec/changes/archive/YYYY-MM-DD-<name>/`. After successful archive, do not run `bash "$OPENSUPER_GUARD" <change-name> archive` against the old active change name; the active directory no longer exists. Archive completeness is determined by the script exit code and archived directory state.
66
+
67
+ ## Complete
68
+
69
+ OpenSuper workflow complete. To start new work, invoke `/opensuper` or `/opensuper-open`.
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: opensuper-build
3
+ description: "OpenSuper Phase 3: Plan and Build. Invoke with /opensuper-build. Create plans and choose execution method (subagent or direct) for implementation."
4
+ ---
5
+
6
+ # OpenSuper Phase 3: Plan and Build (Build)
7
+
8
+ ## Prerequisites
9
+
10
+ - Design Doc has been created (Phase 2 complete)
11
+ - Active change exists
12
+
13
+ ## Steps
14
+
15
+ ### 0. Entry State Verification (Entry Check)
16
+
17
+ Execute entry verification:
18
+
19
+ ```bash
20
+ OPENSUPER_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
21
+ OPENSUPER_STATE="${OPENSUPER_STATE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-state.sh' -type f -print -quit 2>/dev/null)}"
22
+ OPENSUPER_GUARD="${OPENSUPER_GUARD:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-guard.sh' -type f -print -quit 2>/dev/null)}"
23
+ bash "$OPENSUPER_STATE" check <name> build
24
+ ```
25
+
26
+ Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
27
+
28
+ ### 1. Create Plan
29
+
30
+ **Immediately execute:** Use the Skill tool to load the `superpowers:writing-plans` skill. Skipping this step is prohibited.
31
+
32
+ After the skill loads, follow its guidance to create a plan. Plan requirements:
33
+ - Save to `docs/superpowers/plans/YYYY-MM-DD-<feature>.md`
34
+ - Reference design document, break down into executable tasks
35
+ - **Plan file header must contain associated metadata**:
36
+
37
+ ```yaml
38
+ ---
39
+ change: <openspec-change-name>
40
+ design-doc: docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md
41
+ base-ref: <git rev-parse HEAD before implementation>
42
+ ---
43
+ ```
44
+
45
+ `base-ref` is used during verification to measure committed changes across the full implementation range. Record the current commit when creating the plan:
46
+
47
+ ```bash
48
+ git rev-parse HEAD
49
+ ```
50
+
51
+ ### 2. Update Plan Status
52
+
53
+ Record plan path:
54
+
55
+ ```bash
56
+ bash "$OPENSUPER_STATE" set <name> plan docs/superpowers/plans/YYYY-MM-DD-feature.md
57
+ ```
58
+
59
+ No manual phase update needed — guard auto-transitions when exit conditions are met.
60
+
61
+ ### 3. Workspace Isolation
62
+
63
+ Plan has been written to the current branch. Before starting execution, choose workspace isolation method:
64
+
65
+ | Option | Method | Description |
66
+ |--------|--------|-------------|
67
+ | A | Create branch | Create a new branch in the current repo, simple and fast |
68
+ | B | Create Worktree | Isolated workspace, fully independent, suitable for parallel development |
69
+
70
+ **Recommendation rules**:
71
+ - Change involves ≤ 3 files → Recommend A
72
+ - Need parallel development, current branch has uncommitted work → Recommend B
73
+
74
+ After user selection, update `isolation` field. `isolation` only allows one of the following values:
75
+
76
+ ```bash
77
+ bash "$OPENSUPER_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 `opensuper-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:
98
+
99
+ | Option | Skill | Applicable Scenario |
100
+ |------|------|-------------------|
101
+ | A | `superpowers:subagent-driven-development` | Independent tasks, high complexity, requires two-phase review |
102
+ | B | `superpowers:executing-plans` | Simple tasks, no subagent environment, lightweight and fast |
103
+
104
+ **Recommendation rules**:
105
+ - Task count ≥ 3 → Recommend A
106
+ - Task count ≤ 2 and no cross-module dependencies → Recommend B
107
+ - From hotfix path → Recommend B
108
+
109
+ After user selection, update `build_mode` field. `build_mode` only allows one of the following values:
110
+
111
+ ```bash
112
+ bash "$OPENSUPER_STATE" set <name> build_mode <value>
113
+ ```
114
+
115
+ - `subagent-driven-development`
116
+ - `executing-plans`
117
+ - `direct` (default only for hotfix/tweak preset use)
118
+
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:
120
+
121
+ ```bash
122
+ bash "$OPENSUPER_STATE" set <name> direct_override true
123
+ bash "$OPENSUPER_STATE" set <name> build_mode direct
124
+ ```
125
+
126
+ Without `direct_override: true`, `build_mode=direct` in full workflow is blocked by both guard and state transition.
127
+
128
+ Then, **immediately execute:** Use the Skill tool to load the corresponding skill. Skipping this step is prohibited.
129
+
130
+ 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
+
132
+ After the skill loads, follow its guidance to execute:
133
+ - Execute tasks according to plan
134
+ - Complete tasks.md check (`- [ ]` → `- [x]`)
135
+ - Commit code after each task completion
136
+
137
+ ### 5. Spec Incremental Updates
138
+
139
+ When the initial spec is found incomplete during implementation, handle by scale:
140
+
141
+ | Scale | Trigger Conditions | Approach |
142
+ |------|-------------------|----------|
143
+ | 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 | Re-run `superpowers:brainstorming` to update Design Doc + delta spec |
145
+ | Large | Brand-new capability requirements | `/opsx:new` to create independent change |
146
+
147
+ **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, should consider splitting into new change.
148
+
149
+ **Principles**:
150
+ - Delta spec is a living document, can be modified at any time during this phase
151
+ - Each update should be committed with commit message explaining the change reason
152
+ - Do not sync to main spec in advance, sync uniformly during archiving
153
+ - For small-scale incremental direct delta spec edits, note in commit message to facilitate design doc drift assessment during archiving
154
+
155
+ ### 6. Context Management
156
+
157
+ Build is the longest phase and may span many tasks. To support resume after context compaction:
158
+
159
+ - **After each task**: immediately check off tasks.md and commit code so `.opensuper.yaml` and file state are durable
160
+ - **After context compaction**: read `.opensuper.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
+ - **Long task split**: if a single task exceeds 200 lines of code changes, consider splitting it into multiple subtasks and commits
162
+
163
+ ## Exit Conditions
164
+
165
+ - All tasks.md checked
166
+ - Code committed
167
+ - Project-specific build/tests explicitly run and pass; do not rely only on guard auto-detection
168
+ - `isolation` has been written as `branch` or `worktree`
169
+ - `build_mode` has been written as `subagent-driven-development`, `executing-plans`, or `direct` with explicit override
170
+ - **Phase guard**: Run `bash "$OPENSUPER_GUARD" <change-name> build --apply`; after all PASS, state advances to `phase: verify`
171
+
172
+ Guard reads project command configuration first:
173
+
174
+ ```yaml
175
+ build_command: <build command>
176
+ verify_command: <verify command>
177
+ ```
178
+
179
+ Configuration can live in the change `.opensuper.yaml`, or in repo-root `.opensuper.yaml` / `opensuper.yaml` / `.opensuper.yml` / `opensuper.yml`.
180
+ Only when no command is configured does guard fall back to `npm run build`, Maven, or Cargo auto-detection. When a command fails, guard prints the command output as evidence for debugging.
181
+
182
+ Before exit, run guard to auto-transition:
183
+
184
+ ```bash
185
+ bash "$OPENSUPER_GUARD" <change-name> build --apply
186
+ ```
187
+
188
+ State file is automatically updated to `phase: verify`, `verify_result: pending`.
189
+
190
+ ## Automatic Transition
191
+
192
+ After exit conditions are met, **proceed immediately to the next phase without waiting for user input**:
193
+
194
+ > **REQUIRED NEXT SKILL:** Invoke `opensuper-verify` skill to enter the verification and completion phase.
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: opensuper-design
3
+ description: "OpenSuper Phase 2: Deep Design. Invoke with /opensuper-design. Produce Design Doc and delta spec through brainstorming."
4
+ ---
5
+
6
+ # OpenSuper Phase 2: Deep Design (Design)
7
+
8
+ ## Prerequisites
9
+
10
+ - Active change exists (proposal.md, design.md, tasks.md)
11
+ - No Design Doc (no corresponding file under `docs/superpowers/specs/`)
12
+
13
+ ## Steps
14
+
15
+ ### 0. Entry State Verification (Entry Check)
16
+
17
+ Execute entry verification:
18
+
19
+ ```bash
20
+ OPENSUPER_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
21
+ OPENSUPER_STATE="${OPENSUPER_STATE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-state.sh' -type f -print -quit 2>/dev/null)}"
22
+ OPENSUPER_GUARD="${OPENSUPER_GUARD:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-guard.sh' -type f -print -quit 2>/dev/null)}"
23
+ bash "$OPENSUPER_STATE" check <name> design
24
+ ```
25
+
26
+ Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
27
+
28
+ ### 1a. Read Existing Context
29
+
30
+ Read `proposal.md` and `design.md` under the active change, organize core content into summaries:
31
+ - **Proposal summary**: goals, motivation, scope
32
+ - **Design summary**: architectural decisions, high-level design
33
+
34
+ ### 1b. Execute Brainstorming (With Context)
35
+
36
+ **Immediately execute:** Use the Skill tool to load the `superpowers:brainstorming` skill, ARGUMENTS contains:
37
+
38
+ ```
39
+ Change: <change-name>
40
+ Proposal summary: <proposal core content>
41
+ Design summary: <design.md architectural decisions>
42
+ Skip context exploration, proceed directly to design questioning.
43
+ ```
44
+
45
+ Skipping this step is prohibited, and continuing without loading this skill is prohibited.
46
+
47
+ If `superpowers:brainstorming` is unavailable, stop the process and prompt to install or enable Superpowers skills. Do not substitute this step with normal conversation.
48
+
49
+ After the skill loads, follow its guidance to produce:
50
+ - `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` — design document (technical RFC)
51
+ - `openspec/changes/<name>/specs/<capability>/spec.md` — capability specification (delta)
52
+
53
+ ### 2. Update OpenSuper State
54
+
55
+ Record design_doc path, then run guard to auto-transition:
56
+
57
+ ```bash
58
+ # Record design_doc path
59
+ bash "$OPENSUPER_STATE" set <name> design_doc docs/superpowers/specs/YYYY-MM-DD-topic-design.md
60
+
61
+ # Auto-transition to next phase
62
+ bash "$OPENSUPER_GUARD" <change-name> design --apply
63
+ ```
64
+
65
+ State file is updated automatically. No manual editing of other fields required.
66
+
67
+ ## Exit Conditions
68
+
69
+ - Design Doc has been created and saved
70
+ - Delta spec has been created if there are new capabilities
71
+ - `design_doc` written to `.opensuper.yaml`
72
+ - **Phase guard**: Run `bash "$OPENSUPER_GUARD" <change-name> design --apply`; after all PASS, state advances to `phase: build`
73
+
74
+ You must use `--apply` before exiting:
75
+
76
+ ```bash
77
+ bash "$OPENSUPER_GUARD" <change-name> design --apply
78
+ ```
79
+
80
+ ## Automatic Transition
81
+
82
+ After exit conditions are met, **proceed immediately to the next phase without waiting for user input**:
83
+
84
+ > **REQUIRED NEXT SKILL:** Invoke `opensuper-build` skill to enter the planning and build phase.
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: opensuper-hotfix
3
+ description: "OpenSuper preset path: Bug fix / hotfix. Skip brainstorming, directly open → build → verify → archive. Applicable for behavior fixes, scenarios not involving new capability design."
4
+ ---
5
+
6
+ # OpenSuper Preset Path: Hotfix
7
+
8
+ Quick bug fix workflow: open → build → verify → archive. Skip brainstorming and full plan, applicable for behavior fixes not involving new capability design.
9
+
10
+ **Applicable conditions** (all must be met):
11
+ 1. Fix bugs in existing functionality, no new capability
12
+ 2. No interface changes or architecture adjustments
13
+ 3. Change scope is predictable (usually ≤ 2 files)
14
+
15
+ **Not applicable**: If fix process discovers need for architecture adjustments, should upgrade to full `/opensuper` workflow.
16
+
17
+ ---
18
+
19
+ ## Process (preset workflow, 4 phases)
20
+
21
+ Execution chain: open → build → verify → archive. Hotfix provides default decisions for each phase: streamlined open, direct build, scale-based verification, archive after verification passes.
22
+
23
+ Locate OpenSuper scripts before starting:
24
+
25
+ ```bash
26
+ OPENSUPER_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
27
+ OPENSUPER_STATE="${OPENSUPER_STATE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-state.sh' -type f -print -quit 2>/dev/null)}"
28
+ OPENSUPER_GUARD="${OPENSUPER_GUARD:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-guard.sh' -type f -print -quit 2>/dev/null)}"
29
+ OPENSUPER_ARCHIVE="${OPENSUPER_ARCHIVE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-archive.sh' -type f -print -quit 2>/dev/null)}"
30
+ ```
31
+
32
+ ### 1. Quick Open (preset open)
33
+
34
+ Reuse OpenSuper open capability to create change, but use hotfix defaults: do not execute `openspec-explore` long exploration, directly enter streamlined change creation.
35
+
36
+ **Immediately execute:** Use the Skill tool to load the `openspec-new-change` skill. Skipping this step is prohibited.
37
+
38
+ After the skill loads, follow its guidance to create streamlined artifacts:
39
+ - `proposal.md` — problem description + root cause analysis + fix goal (no solution comparison needed)
40
+ - `design.md` — fix solution (one is enough, no multi-solution comparison needed)
41
+ - `tasks.md` — fix task list
42
+ - **No delta spec needed** (unless fix changes existing spec acceptance scenarios)
43
+
44
+ Initialize OpenSuper state file:
45
+
46
+ ```bash
47
+ bash "$OPENSUPER_STATE" init <name> hotfix
48
+ ```
49
+
50
+ Run phase guard to transition open → build:
51
+
52
+ ```bash
53
+ bash "$OPENSUPER_GUARD" <change-name> open --apply
54
+ ```
55
+
56
+ ### 2. Direct Build (preset build)
57
+
58
+ Use hotfix defaults: `build_mode: direct`. Skip `superpowers:brainstorming` and `superpowers:writing-plans` (unless tasks > 3; if exceeds 3 tasks, transfer to `/opensuper-build`'s plan and execution method selection).
59
+
60
+ **Immediately execute:** Execute tasks one by one according to tasks.md:
61
+
62
+ 1. Read `openspec/changes/<name>/tasks.md`, get incomplete task list
63
+ 2. For each incomplete task:
64
+ - Modify code according to task description
65
+ - Run project formatter (e.g., `mvn spotless:apply`, `npm run format`)
66
+ - Run related tests to confirm pass
67
+ - Check corresponding `- [ ]` to `- [x]` in tasks.md
68
+ - Commit code, commit message format: `fix: <brief fix description>`
69
+ 3. After all tasks complete, explicitly run relevant project tests and build commands
70
+ 4. Run phase guard to transition build → verify:
71
+
72
+ ```bash
73
+ bash "$OPENSUPER_GUARD" <change-name> build --apply
74
+ ```
75
+
76
+ State automatically updates to `phase: verify`, `verify_result: pending`, then enter verification.
77
+
78
+ **If fix affects existing spec acceptance scenarios**:
79
+ - Create delta spec in `openspec/changes/<name>/specs/<capability>/spec.md`
80
+ - Only include `## MODIFIED Requirements` section
81
+
82
+ ### 3a. Hotfix-Exclusive Check: Root Cause Elimination
83
+
84
+ **Execute before loading opensuper-verify**, ensuring the fix actually eliminates the root cause:
85
+
86
+ 1. Read bug description and root cause in proposal.md
87
+ 2. Search and verify problem code no longer exists
88
+ 3. If root cause not eliminated, return to Step 2 to continue fix
89
+
90
+ **Upgrade conditions**:
91
+ - Root cause check reveals deep architecture issues → Stop hotfix, upgrade to `/opensuper`
92
+ - Fix requires additional interface changes → Stop hotfix, upgrade to `/opensuper`
93
+
94
+ ### 3b. Verification (preset verify)
95
+
96
+ After root cause elimination check passes, reuse `/opensuper-verify`, with opensuper-verify's scale assessment deciding lightweight or full verification.
97
+
98
+ **Immediately execute:** Use the Skill tool to load the `opensuper-verify` skill. Skipping this step is prohibited.
99
+
100
+ Small-scale hotfixes without delta spec usually meet lightweight verification conditions (≤ 3 tasks, ≤ 2 files), opensuper-verify's scale assessment will select lightweight verification path (5 quick checks). If hotfix created delta spec, enter full verification path according to opensuper-verify's scale assessment rules.
101
+
102
+ After verification passes, record `.opensuper.yaml` `verify_result` as `pass` according to `/opensuper-verify` rules, must not skip this status before archiving.
103
+
104
+ ### 4. Archive (preset archive)
105
+
106
+ Reuse `/opensuper-archive`. Must satisfy `verify_result: pass` in `.opensuper.yaml` before archiving.
107
+
108
+ **Immediately execute:** Use the Skill tool to load the `opensuper-archive` skill to archive. Skipping this step is prohibited.
109
+ If there is delta spec, sync to main spec according to opensuper-archive rules, and handle associated Design Doc and Plan archiving annotations.
110
+
111
+ ---
112
+
113
+ ## Continuous Execution Mode
114
+
115
+ <IMPORTANT>
116
+ Hotfix workflow is **one-time continuous execution**. After invoking `/opensuper-hotfix`, agent must automatically complete all 4 phases, without pausing to wait for user input mid-way (unless encountering upgrade conditions requiring user confirmation).
117
+
118
+ Execution order: quick open → direct build → verification → archive → complete
119
+
120
+ After each phase completes, immediately enter next phase, no need for user input again. Within each phase, must still call corresponding OpenSuper/OpenSpec/Superpowers skill according to above requirements.
121
+ </IMPORTANT>
122
+
123
+ ---
124
+
125
+ ## Upgrade Conditions
126
+
127
+ Upgrade to full `/opensuper` when **any** of the following conditions are met:
128
+
129
+ | Condition | Explanation |
130
+ |-----------|-------------|
131
+ | Change involves **3+ files** | Exceeds single-point fix scope |
132
+ | Architecture changes | New modules, new interfaces, new dependencies |
133
+ | Database schema changes | Structural adjustments |
134
+ | Introduces new public API | Fix creates new external interface |
135
+ | Fix scope exceeds single function/module | Requires coordinated changes |
136
+
137
+ Upgrade method: On current change basis, supplement Design Doc (execute `/opensuper-design`), then proceed normally with full workflow.
138
+
139
+ ---
140
+
141
+ ## Exit Conditions
142
+
143
+ - Bug fixed, tests pass
144
+ - Change archived
145
+ - If spec changes, synced to main spec
146
+ - **Phase guard**: Before build → verify run `bash "$OPENSUPER_GUARD" <change-name> build --apply`; before verify → archive follow `/opensuper-verify` and run `bash "$OPENSUPER_GUARD" <change-name> verify --apply`