@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.
- package/LICENSE +21 -0
- package/README.md +362 -0
- package/assets/manifest.json +21 -0
- package/assets/skills/opensuper/SKILL.md +268 -0
- package/assets/skills/opensuper/scripts/opensuper-archive.sh +255 -0
- package/assets/skills/opensuper/scripts/opensuper-guard.sh +407 -0
- package/assets/skills/opensuper/scripts/opensuper-state.sh +680 -0
- package/assets/skills/opensuper/scripts/opensuper-yaml-validate.sh +157 -0
- package/assets/skills/opensuper-archive/SKILL.md +69 -0
- package/assets/skills/opensuper-build/SKILL.md +194 -0
- package/assets/skills/opensuper-design/SKILL.md +84 -0
- package/assets/skills/opensuper-hotfix/SKILL.md +146 -0
- package/assets/skills/opensuper-open/SKILL.md +82 -0
- package/assets/skills/opensuper-tweak/SKILL.md +133 -0
- package/assets/skills/opensuper-verify/SKILL.md +139 -0
- package/assets/skills-zh/opensuper/SKILL.md +271 -0
- package/assets/skills-zh/opensuper-archive/SKILL.md +69 -0
- package/assets/skills-zh/opensuper-build/SKILL.md +194 -0
- package/assets/skills-zh/opensuper-design/SKILL.md +84 -0
- package/assets/skills-zh/opensuper-hotfix/SKILL.md +152 -0
- package/assets/skills-zh/opensuper-open/SKILL.md +84 -0
- package/assets/skills-zh/opensuper-tweak/SKILL.md +139 -0
- package/assets/skills-zh/opensuper-verify/SKILL.md +154 -0
- package/bin/opensuper.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +63 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/doctor.d.ts +9 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +191 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +17 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +242 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +108 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/update.d.ts +28 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +193 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/core/detect.d.ts +13 -0
- package/dist/core/detect.d.ts.map +1 -0
- package/dist/core/detect.js +101 -0
- package/dist/core/detect.js.map +1 -0
- package/dist/core/openspec.d.ts +5 -0
- package/dist/core/openspec.d.ts.map +1 -0
- package/dist/core/openspec.js +58 -0
- package/dist/core/openspec.js.map +1 -0
- package/dist/core/platforms.d.ts +15 -0
- package/dist/core/platforms.d.ts.map +1 -0
- package/dist/core/platforms.js +48 -0
- package/dist/core/platforms.js.map +1 -0
- package/dist/core/skills.d.ts +22 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +59 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/superpowers.d.ts +5 -0
- package/dist/core/superpowers.d.ts.map +1 -0
- package/dist/core/superpowers.js +60 -0
- package/dist/core/superpowers.js.map +1 -0
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/utils/file-system.d.ts +25 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +53 -0
- package/dist/utils/file-system.js.map +1 -0
- package/package.json +60 -0
- package/scripts/postinstall.js +44 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opensuper-open
|
|
3
|
+
description: "OpenSuper Phase 1: Open. Invoke with /opensuper-open. Explore ideas through OpenSpec and create change structure (proposal + design + tasks)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenSuper Phase 1: Open
|
|
7
|
+
|
|
8
|
+
## Prerequisites
|
|
9
|
+
|
|
10
|
+
- No active change, or user wishes to create a new change
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
### 0. Locate OpenSuper Scripts
|
|
15
|
+
|
|
16
|
+
Locate scripts before creating state:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
OPENSUPER_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
|
|
20
|
+
OPENSUPER_STATE="${OPENSUPER_STATE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-state.sh' -type f -print -quit 2>/dev/null)}"
|
|
21
|
+
OPENSUPER_GUARD="${OPENSUPER_GUARD:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-guard.sh' -type f -print -quit 2>/dev/null)}"
|
|
22
|
+
|
|
23
|
+
if [ -z "$OPENSUPER_STATE" ] || [ -z "$OPENSUPER_GUARD" ]; then
|
|
24
|
+
echo "ERROR: OpenSuper scripts not found. Ensure the opensuper skill is installed." >&2
|
|
25
|
+
return 1
|
|
26
|
+
fi
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 1. Explore Idea
|
|
30
|
+
|
|
31
|
+
**Immediately execute:** Use the Skill tool to load the `openspec-explore` skill. Skipping this step is prohibited.
|
|
32
|
+
|
|
33
|
+
After the skill loads, freely explore the problem space following its guidance.
|
|
34
|
+
|
|
35
|
+
### 2. Create Change Structure
|
|
36
|
+
|
|
37
|
+
**Immediately execute:** Use the Skill tool to load the `openspec-new-change` skill. If user intent is unclear and needs to form a proposal first, load `openspec-propose` instead. Skipping this step is prohibited.
|
|
38
|
+
|
|
39
|
+
Confirm the following artifacts have been created:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
openspec/changes/<name>/
|
|
43
|
+
├── .openspec.yaml
|
|
44
|
+
├── .opensuper.yaml
|
|
45
|
+
├── proposal.md # Why + What: problem, goals, scope
|
|
46
|
+
├── design.md # How (high-level): architectural decisions, solution selection
|
|
47
|
+
└── tasks.md # Task checklist (checkboxes)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Initialize OpenSuper State
|
|
51
|
+
|
|
52
|
+
Initialize OpenSuper state file:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
bash "$OPENSUPER_STATE" init <name> full
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Content Completeness Check
|
|
59
|
+
|
|
60
|
+
Confirm the three documents have complete content:
|
|
61
|
+
- **proposal.md**: problem background, goals, scope, non-goals
|
|
62
|
+
- **design.md**: high-level architectural decisions, solution selection, data flow
|
|
63
|
+
- **tasks.md**: task list, each task has a clear description
|
|
64
|
+
|
|
65
|
+
## Exit Conditions
|
|
66
|
+
|
|
67
|
+
- proposal.md, design.md, and tasks.md are all created with complete content
|
|
68
|
+
- **Phase guard**: Run `bash "$OPENSUPER_GUARD" <change-name> open --apply`; after all PASS, state automatically advances to the next phase
|
|
69
|
+
|
|
70
|
+
You must use `--apply` before exiting. Otherwise `.opensuper.yaml` stays at `phase: open`, and the next phase entry check will fail.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
bash "$OPENSUPER_GUARD" <change-name> open --apply
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Full workflow advances to `phase: design`; hotfix/tweak presets advance to `phase: build`.
|
|
77
|
+
|
|
78
|
+
## Automatic Transition
|
|
79
|
+
|
|
80
|
+
After exit conditions are met, **proceed immediately to the next phase without waiting for user input**:
|
|
81
|
+
|
|
82
|
+
> **REQUIRED NEXT SKILL:** Invoke `opensuper-design` skill to enter the deep design phase.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opensuper-tweak
|
|
3
|
+
description: "OpenSuper preset path: Non-bug small changes (tweak). Skip brainstorming and full plan, directly open → lightweight build → light verify → archive. Applicable for copy, configuration, documentation or prompt local optimization."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenSuper Preset Path: Tweak
|
|
7
|
+
|
|
8
|
+
Tweak is a preset workflow of OpenSuper's five-phase capabilities, not a separate parallel process. It reuses open, build, verify, archive capabilities, only skipping brainstorming and full plan.
|
|
9
|
+
|
|
10
|
+
Applicable for small-scale non-bug changes, such as copy adjustments, configuration adjustments, documentation or prompt local optimization.
|
|
11
|
+
|
|
12
|
+
**Applicable conditions** (all must be met):
|
|
13
|
+
1. No new capability
|
|
14
|
+
2. No architecture changes
|
|
15
|
+
3. No interface changes involved
|
|
16
|
+
4. Usually not exceeding 3 tasks, 4 files
|
|
17
|
+
|
|
18
|
+
**Not applicable**: If change process discovers need for capability, architecture, or interface adjustments, should upgrade to full `/opensuper` workflow.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Process (preset workflow, 4 phases)
|
|
23
|
+
|
|
24
|
+
Execution chain: open → lightweight build → light verify → archive. Tweak provides default decisions for each phase: streamlined open, lightweight build, lightweight verification, archive after verification passes.
|
|
25
|
+
|
|
26
|
+
Locate OpenSuper scripts before starting:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
OPENSUPER_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
|
|
30
|
+
OPENSUPER_STATE="${OPENSUPER_STATE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-state.sh' -type f -print -quit 2>/dev/null)}"
|
|
31
|
+
OPENSUPER_GUARD="${OPENSUPER_GUARD:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-guard.sh' -type f -print -quit 2>/dev/null)}"
|
|
32
|
+
OPENSUPER_ARCHIVE="${OPENSUPER_ARCHIVE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-archive.sh' -type f -print -quit 2>/dev/null)}"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 1. Quick Open (preset open)
|
|
36
|
+
|
|
37
|
+
Reuse OpenSuper open capability to create change, but use tweak defaults: do not execute `openspec-explore` long exploration, directly enter streamlined change creation.
|
|
38
|
+
|
|
39
|
+
**Immediately execute:** Use the Skill tool to load the `openspec-new-change` skill. Skipping this step is prohibited.
|
|
40
|
+
|
|
41
|
+
After the skill loads, follow its guidance to create streamlined artifacts:
|
|
42
|
+
- `proposal.md` — change motivation + goals + scope
|
|
43
|
+
- `design.md` — brief implementation description (no solution comparison needed)
|
|
44
|
+
- `tasks.md` — not exceeding 3 tasks
|
|
45
|
+
- **No delta spec needed** (unless change changes existing spec acceptance scenarios; once delta spec needed, upgrade to full `/opensuper`)
|
|
46
|
+
|
|
47
|
+
Initialize OpenSuper state file:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bash "$OPENSUPER_STATE" init <name> tweak
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Run phase guard to transition open → build:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
bash "$OPENSUPER_GUARD" <change-name> open --apply
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 2. Lightweight Build (preset build)
|
|
60
|
+
|
|
61
|
+
Use tweak defaults: `build_mode: direct`. Skip `superpowers:brainstorming` and `superpowers:writing-plans`.
|
|
62
|
+
|
|
63
|
+
**Immediately execute:** Execute tasks one by one according to tasks.md:
|
|
64
|
+
|
|
65
|
+
1. Read `openspec/changes/<name>/tasks.md`, get incomplete task list
|
|
66
|
+
2. For each incomplete task:
|
|
67
|
+
- Modify target file according to task description
|
|
68
|
+
- Run project formatter (e.g., `mvn spotless:apply`, `npm run format`)
|
|
69
|
+
- Run related tests to confirm pass
|
|
70
|
+
- Check corresponding `- [ ]` to `- [x]` in tasks.md
|
|
71
|
+
- Commit code, commit message format: `tweak: <brief change description>`
|
|
72
|
+
3. After all tasks complete, explicitly run relevant project tests and build commands
|
|
73
|
+
4. Run phase guard to transition build → verify:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
bash "$OPENSUPER_GUARD" <change-name> build --apply
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
State automatically updates to `phase: verify`, `verify_result: pending`, then enter verification.
|
|
80
|
+
|
|
81
|
+
### 3. Lightweight Verification (preset verify)
|
|
82
|
+
|
|
83
|
+
Reuse `/opensuper-verify`. Tweak must maintain lightweight verification conditions: ≤ 3 tasks, ≤ 4 files, no delta spec, no new capability.
|
|
84
|
+
|
|
85
|
+
**Immediately execute:** Use the Skill tool to load the `opensuper-verify` skill. Skipping this step is prohibited.
|
|
86
|
+
|
|
87
|
+
If scale assessment enters full verification path, stop tweak, upgrade to full `/opensuper`.
|
|
88
|
+
|
|
89
|
+
After verification passes, record `.opensuper.yaml` `verify_result` as `pass` according to `/opensuper-verify` rules, must not skip this status before archiving.
|
|
90
|
+
|
|
91
|
+
### 4. Archive (preset archive)
|
|
92
|
+
|
|
93
|
+
Reuse `/opensuper-archive`. Must satisfy `verify_result: pass` in `.opensuper.yaml` before archiving.
|
|
94
|
+
|
|
95
|
+
**Immediately execute:** Use the Skill tool to load the `opensuper-archive` skill to archive. Skipping this step is prohibited.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Continuous Execution Mode
|
|
100
|
+
|
|
101
|
+
<IMPORTANT>
|
|
102
|
+
Tweak workflow is **one-time continuous execution**. After invoking `/opensuper-tweak`, agent must automatically complete all 4 phases, without pausing to wait for user input mid-way (unless encountering upgrade conditions requiring user confirmation).
|
|
103
|
+
|
|
104
|
+
Execution order: quick open → lightweight build → lightweight verification → archive → complete
|
|
105
|
+
|
|
106
|
+
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.
|
|
107
|
+
</IMPORTANT>
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Upgrade Conditions
|
|
112
|
+
|
|
113
|
+
Upgrade to full `/opensuper` when **any** of the following conditions are met:
|
|
114
|
+
|
|
115
|
+
| Condition | Explanation |
|
|
116
|
+
|-----------|-------------|
|
|
117
|
+
| Change involves **5+ files** | Exceeds small change scope |
|
|
118
|
+
| Cross-module coordination required | Needs coordination across components |
|
|
119
|
+
| **5+** new test cases needed | Change complexity increasing |
|
|
120
|
+
| Config item additions or deletions | Non-value config changes |
|
|
121
|
+
| New capability needed | Exceeds local optimization |
|
|
122
|
+
| Delta spec needed | Affects existing specifications |
|
|
123
|
+
|
|
124
|
+
Upgrade method: On current change basis, supplement Design Doc (execute `/opensuper-design`), then proceed normally with full workflow.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Exit Conditions
|
|
129
|
+
|
|
130
|
+
- Small change completed, tests pass
|
|
131
|
+
- Change archived
|
|
132
|
+
- No new capability, architecture adjustments, or interface changes
|
|
133
|
+
- **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`
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opensuper-verify
|
|
3
|
+
description: "OpenSuper Phase 4: Verify and Complete. Invoke with /opensuper-verify. Verify implementation matches design, handle development branch."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenSuper Phase 4: Verify and Complete (Verify)
|
|
7
|
+
|
|
8
|
+
## Prerequisites
|
|
9
|
+
|
|
10
|
+
- Code has been committed (Phase 3 complete)
|
|
11
|
+
- All tasks in tasks.md are complete
|
|
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> verify
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Proceed to Step 1 after verification passes. The script outputs specific failure reasons when verification fails.
|
|
27
|
+
|
|
28
|
+
### 1. Change Scale Assessment
|
|
29
|
+
|
|
30
|
+
Execute scale assessment:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bash "$OPENSUPER_STATE" scale <name>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Script automatically counts tasks, delta specs, and changed files to determine whether to use light or full verification mode, and sets the verify_mode field.
|
|
37
|
+
|
|
38
|
+
Note: if the build phase committed after each task, worktree diff can underestimate change size. In that case, read the plan header `base-ref` and re-check the full commit range:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
PLAN=$(bash "$OPENSUPER_STATE" get <name> plan)
|
|
42
|
+
BASE_REF=$(grep '^base-ref:' "$PLAN" 2>/dev/null | head -1 | sed 's/^base-ref: *//')
|
|
43
|
+
git diff --stat "$BASE_REF"...HEAD
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If the commit range exceeds lightweight thresholds (> 5 files, cross-module coordination, or more than 1 delta spec capability), manually switch to full verification:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
bash "$OPENSUPER_STATE" set <name> verify_mode full
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2a. Lightweight Verification (Small Changes)
|
|
53
|
+
|
|
54
|
+
When scale assessment result is "small", skip `openspec-verify-change`, directly execute the following checks:
|
|
55
|
+
|
|
56
|
+
1. All tasks in tasks.md completed `[x]`
|
|
57
|
+
2. Changed files consistent with tasks.md description (compare `git diff --stat` against task content)
|
|
58
|
+
3. Build passes (run project-appropriate build command, e.g., `npm run build`, `mvn compile`, `cargo build`)
|
|
59
|
+
4. Related tests pass
|
|
60
|
+
5. No obvious security issues (no hardcoded secrets, no new unsafe operations)
|
|
61
|
+
|
|
62
|
+
**Pass standard**: All 5 items OK, no CRITICAL issues.
|
|
63
|
+
|
|
64
|
+
**When failing**: report failed items, record failure, move back to build, then invoke `/opensuper-build`.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
bash "$OPENSUPER_STATE" transition <name> verify-fail
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Report format**: Brief table listing 5 check results + PASS/FAIL.
|
|
71
|
+
|
|
72
|
+
**Skipped items** (not checked in lightweight verification):
|
|
73
|
+
- spec scenario coverage
|
|
74
|
+
- design doc consistency deep comparison
|
|
75
|
+
- code pattern consistency recommendations
|
|
76
|
+
- delta spec and design doc drift detection
|
|
77
|
+
|
|
78
|
+
### 2b. Full Verification (Large Changes)
|
|
79
|
+
|
|
80
|
+
When scale assessment result is "large":
|
|
81
|
+
|
|
82
|
+
**Immediately execute:** Use the Skill tool to load the `openspec-verify-change` skill. Skipping this step is prohibited.
|
|
83
|
+
|
|
84
|
+
After the skill loads, follow its guidance to verify. Check items:
|
|
85
|
+
1. All tasks in tasks.md completed (`[x]`)
|
|
86
|
+
2. Implementation matches design.md design decisions
|
|
87
|
+
3. Implementation matches brainstorming design document
|
|
88
|
+
4. All capability specification scenarios pass
|
|
89
|
+
5. proposal.md goals satisfied
|
|
90
|
+
6. No contradiction between delta spec and design doc (if Build phase had incremental spec modifications, check if design doc has corresponding records)
|
|
91
|
+
7. `docs/superpowers/specs/` associated design document can be located (file exists and relates to current change)
|
|
92
|
+
|
|
93
|
+
When verification fails: report missing items, record failure, move back to build, then invoke `/opensuper-build`.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
bash "$OPENSUPER_STATE" transition <name> verify-fail
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Spec drift handling**:
|
|
100
|
+
- If check item 6 finds contradiction (delta spec has content but design doc doesn't reflect it), prompt user:
|
|
101
|
+
- Option A: Append "Implementation Divergence" section to design doc recording deviation reason
|
|
102
|
+
- Option B: Roll back to Build phase, supplement brainstorming to update design doc
|
|
103
|
+
- Option C: Confirm deviation acceptable, continue verification (design doc will be marked as `superseded-by-main-spec` during archiving)
|
|
104
|
+
|
|
105
|
+
### 3. Completion (Superpowers)
|
|
106
|
+
|
|
107
|
+
**Immediately execute:** Use the Skill tool to load the `superpowers:finishing-a-development-branch` skill. Skipping this step is prohibited.
|
|
108
|
+
|
|
109
|
+
If `superpowers:finishing-a-development-branch` is unavailable, stop the process and prompt to install or enable Superpowers skills. Do not substitute this step with normal conversation.
|
|
110
|
+
|
|
111
|
+
After the skill loads, follow its guidance to complete. Branch handling options:
|
|
112
|
+
1. Local merge to main branch
|
|
113
|
+
2. Push and create PR
|
|
114
|
+
3. Keep branch (handle later)
|
|
115
|
+
4. Discard work
|
|
116
|
+
|
|
117
|
+
**Confirmation items**:
|
|
118
|
+
- All tests pass
|
|
119
|
+
- No hardcoded secrets or security issues
|
|
120
|
+
|
|
121
|
+
## Exit Conditions
|
|
122
|
+
|
|
123
|
+
- Verification report passed
|
|
124
|
+
- Branch handled
|
|
125
|
+
- **Phase guard**: Run `bash "$OPENSUPER_GUARD" <change-name> verify --apply`; after all PASS, it uses `opensuper-state transition verify-pass` to advance to `phase: archive`
|
|
126
|
+
|
|
127
|
+
After verification and branch handling are complete, run guard to auto-transition:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
bash "$OPENSUPER_GUARD" <change-name> verify --apply
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
State file is automatically updated to `phase: archive`, `verify_result: pass`, `verified_at: YYYY-MM-DD`.
|
|
134
|
+
|
|
135
|
+
## Automatic Transition
|
|
136
|
+
|
|
137
|
+
After exit conditions are met, **proceed immediately to the next phase without waiting for user input**:
|
|
138
|
+
|
|
139
|
+
> **REQUIRED NEXT SKILL:** Invoke `opensuper-archive` skill to enter the archiving phase.
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opensuper
|
|
3
|
+
description: "OpenSuper — OpenSpec + Superpowers 双星开发流程。用 /opensuper 启动,自动检测阶段并分发到子命令。五阶段:开启 → 深度设计 → 计划与构建 → 验证与收尾 → 归档。"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenSuper — OpenSpec + Superpowers 双星开发流程
|
|
7
|
+
|
|
8
|
+
OpenSpec 与 Superpowers 如双星系统围绕同一目标运转。
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
OpenSpec 负责 WHAT — 大纲、提案、spec 生命周期、归档
|
|
12
|
+
Superpowers 负责 HOW — 技术设计、计划、执行、收尾
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**核心原则:brainstorming 必不可跳过。每次变更都必须经过深度设计(hotfix 和 tweak preset 除外)。**
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 决策核心(Decision Core)
|
|
20
|
+
|
|
21
|
+
agent 做决策只需读本节,参考附录按需查阅。
|
|
22
|
+
|
|
23
|
+
### 阶段自动检测
|
|
24
|
+
|
|
25
|
+
**Step 0: 活跃 Change 发现与意图判定**
|
|
26
|
+
|
|
27
|
+
1. 先做 Preset 检测;命中 hotfix/tweak 时直接调用对应 preset skill,不进入普通 open 分支
|
|
28
|
+
2. 未命中 preset 时,运行 `openspec list --json` 获取所有活跃 change
|
|
29
|
+
|
|
30
|
+
**Preset 检测优先级最高**:
|
|
31
|
+
- 用户明确描述为 bug fix / 热修复 + 满足 hotfix 条件 → 直接 `/opensuper-hotfix`
|
|
32
|
+
- 用户明确描述为文案/配置/文档/prompt 小调整 + 满足 tweak 条件 → 直接 `/opensuper-tweak`
|
|
33
|
+
- 未命中 preset → 按下表处理
|
|
34
|
+
|
|
35
|
+
| 活跃 change | 用户输入 | 行为 |
|
|
36
|
+
|-------------|---------|------|
|
|
37
|
+
| 无 | 非 preset 输入 | → 调用 `/opensuper-open` |
|
|
38
|
+
| 恰好 1 个 | `/opensuper <描述>` | → **询问**:继续该变更 or 创建新变更 |
|
|
39
|
+
| 多个 | `/opensuper <描述>` | → **询问**:继续现有变更 or 创建新变更;若选继续 → 列出清单让用户选择 |
|
|
40
|
+
| 恰好 1 个 | `/opensuper`(无描述) | → 自动选中,进入 Step 1 |
|
|
41
|
+
| 多个 | `/opensuper`(无描述) | → 列出清单让用户选择 |
|
|
42
|
+
|
|
43
|
+
<IMPORTANT>
|
|
44
|
+
当用户选择「创建新变更」时,**必须调用 `/opensuper-open`**(禁止直接调用 `/opsx:new`)。
|
|
45
|
+
`/opensuper-open` 负责完整双初始化:OpenSpec artifacts(由内部 `/opsx:new` 创建)+ `.opensuper.yaml` 状态文件。
|
|
46
|
+
直接调用 `/opsx:new` 会缺失 `.opensuper.yaml`,导致后续阶段判定失败。
|
|
47
|
+
</IMPORTANT>
|
|
48
|
+
|
|
49
|
+
**Step 1: 读取 `.opensuper.yaml` 状态元数据**
|
|
50
|
+
|
|
51
|
+
优先读取 `openspec/changes/<name>/.opensuper.yaml`。不存在时回退到 `openspec status --change "<name>" --json`、`tasks.md` 和 `docs/superpowers/` 文件检查。
|
|
52
|
+
|
|
53
|
+
**断点恢复规则**:
|
|
54
|
+
- 每次恢复上下文时,先重新执行 Step 0 和 Step 1,不依赖对话历史判断阶段
|
|
55
|
+
- 若 `phase: build`,读取 tasks.md 的下一个未勾选任务继续
|
|
56
|
+
- 若 `phase: verify` 且 `verify_result: fail`,先运行 `bash "$OPENSUPER_STATE" transition <name> verify-fail`,再调用 `/opensuper-build`
|
|
57
|
+
- 若 `phase: open` 但 proposal/design/tasks 已完整,先运行 `bash "$OPENSUPER_GUARD" <change-name> open --apply` 修正状态,再继续判定
|
|
58
|
+
- 若 `phase: archive`,只允许调用 `/opensuper-archive`;归档成功后 change 会移动到 archive 目录,不再对原活跃目录运行 guard
|
|
59
|
+
|
|
60
|
+
**Step 2: 阶段判定**(按顺序,命中即停)
|
|
61
|
+
|
|
62
|
+
1. `archived: true` 或 change 已移入 archive → 流程已完成
|
|
63
|
+
2. `verify_result: pass` 且 `archived` 不是 `true` → `/opensuper-archive`
|
|
64
|
+
3. `verify_result: fail` → `bash "$OPENSUPER_STATE" transition <name> verify-fail` 后 `/opensuper-build`
|
|
65
|
+
4. `phase: verify` 或 tasks.md 全部勾选 → `/opensuper-verify`
|
|
66
|
+
5. `phase: build` 或已有 Design Doc 但计划/执行未完成 → `/opensuper-build`
|
|
67
|
+
6. `phase: design` 或有 change 但无 Design Doc → `/opensuper-design`
|
|
68
|
+
7. `phase: open` 或有活跃 change 但 `.opensuper.yaml` 缺失 → `/opensuper-open`
|
|
69
|
+
8. 无活跃 change → `/opensuper-open`
|
|
70
|
+
|
|
71
|
+
如果元数据与文件状态冲突,以文件状态为准,修正 `.opensuper.yaml` 后继续。
|
|
72
|
+
|
|
73
|
+
### 预设升级条件
|
|
74
|
+
|
|
75
|
+
**hotfix → full**(满足任一即升级):
|
|
76
|
+
- 改动涉及 **3+ 文件**
|
|
77
|
+
- 涉及架构变更(新模块、新接口、新依赖)
|
|
78
|
+
- 涉及数据库 schema 变更
|
|
79
|
+
- 修复引入新的 public API
|
|
80
|
+
- 修复范围超出单一函数/模块
|
|
81
|
+
|
|
82
|
+
**tweak → full**(满足任一即升级):
|
|
83
|
+
- 改动涉及 **5+ 文件**
|
|
84
|
+
- 涉及多个模块的协调修改
|
|
85
|
+
- 需要新增测试用例 **5+**
|
|
86
|
+
- 涉及配置项的新增或删除(非值修改)
|
|
87
|
+
|
|
88
|
+
### 错误处理速查
|
|
89
|
+
|
|
90
|
+
| 场景 | 处理方式 |
|
|
91
|
+
|------|---------|
|
|
92
|
+
| `openspec list --json` 失败 | 检查 openspec 是否已安装,提示 `openspec init` |
|
|
93
|
+
| 子 skill 不可用 | 停止流程,提示安装或启用对应 skill |
|
|
94
|
+
| `.opensuper.yaml` 格式异常或缺失 | 以文件状态为准,用 `bash $OPENSUPER_STATE set` 修正后继续 |
|
|
95
|
+
| 构建/测试失败 | 返回 build 阶段修复,不进入 verify |
|
|
96
|
+
| change 目录结构不完整 | 按 `opensuper-open` 产物要求补齐 |
|
|
97
|
+
|
|
98
|
+
### 阶段衔接
|
|
99
|
+
|
|
100
|
+
<IMPORTANT>
|
|
101
|
+
单次 `/opensuper` 调用从检测到的阶段开始,退出条件满足后进入下一阶段。
|
|
102
|
+
|
|
103
|
+
流转链:open → design → build → verify → archive
|
|
104
|
+
|
|
105
|
+
**连续执行要求**:从检测到的阶段开始,agent 必须自动走完后续所有阶段,中间不停顿等待用户输入(除非遇到需要用户决策的节点)。每个阶段完成后立即进入下一阶段,无需用户再次输入。
|
|
106
|
+
|
|
107
|
+
需要用户参与的节点(仅在这些节点暂停):
|
|
108
|
+
1. brainstorming 确认设计方案
|
|
109
|
+
2. build 阶段选择执行方式
|
|
110
|
+
3. verify 不通过时决定修复或接受偏差
|
|
111
|
+
4. finishing-branch 选择分支处理方式
|
|
112
|
+
5. 遇到升级条件(hotfix/tweak → 完整流程)
|
|
113
|
+
|
|
114
|
+
agent 不应跳过这些决策点;其他明确无歧义的阶段衔接必须自动继续推进,不得中途退出。
|
|
115
|
+
</IMPORTANT>
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 子命令速查
|
|
120
|
+
|
|
121
|
+
| 命令 | 阶段 | 归属 | 产物 |
|
|
122
|
+
|------|------|------|------|
|
|
123
|
+
| `/opensuper-open` | 1. 开启 | OpenSpec | proposal.md、design.md、tasks.md |
|
|
124
|
+
| `/opensuper-design` | 2. 深度设计 | Superpowers | Design Doc、delta spec |
|
|
125
|
+
| `/opensuper-build` | 3. 计划与构建 | Superpowers | 实施计划、代码提交 |
|
|
126
|
+
| `/opensuper-verify` | 4. 验证与收尾 | Both | 验证报告、分支处理 |
|
|
127
|
+
| `/opensuper-archive` | 5. 归档 | OpenSpec | delta→main spec 同步、design doc 标注、归档 |
|
|
128
|
+
| `/opensuper-hotfix` | 预设路径 | Both | 快速修复(跳过 brainstorming) |
|
|
129
|
+
| `/opensuper-tweak` | 预设路径 | Both | 小改动(跳过 brainstorming 和完整 plan) |
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
/opensuper
|
|
133
|
+
↓ 自动检测
|
|
134
|
+
/opensuper-open ──→ /opensuper-design ──→ /opensuper-build ──→ /opensuper-verify ──→ /opensuper-archive
|
|
135
|
+
(OpenSpec) (Superpowers) (Superpowers) (Both) (OpenSpec)
|
|
136
|
+
|
|
137
|
+
/opensuper-hotfix(预设路径,跳过 brainstorming)
|
|
138
|
+
open ──→ build ──→ verify ──→ archive
|
|
139
|
+
↑ 如触发升级条件 → 补充 Design Doc → 回到完整流程
|
|
140
|
+
|
|
141
|
+
/opensuper-tweak(预设路径,跳过 brainstorming 和完整 plan)
|
|
142
|
+
open ──→ lightweight build ──→ light verify ──→ archive
|
|
143
|
+
↑ 如触发升级条件 → 补充 Design Doc → 回到完整流程
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 参考附录(Reference Appendix)
|
|
149
|
+
|
|
150
|
+
### .opensuper.yaml 字段说明
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
workflow: full
|
|
154
|
+
phase: build
|
|
155
|
+
design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
|
|
156
|
+
plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
|
|
157
|
+
build_mode: subagent-driven-development
|
|
158
|
+
isolation: branch
|
|
159
|
+
verify_mode: light
|
|
160
|
+
verify_result: pending
|
|
161
|
+
verification_report: null
|
|
162
|
+
branch_status: pending
|
|
163
|
+
verified_at: null
|
|
164
|
+
archived: false
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
| 字段 | 含义 |
|
|
168
|
+
|------|------|
|
|
169
|
+
| `workflow` | `full`、`hotfix` 或 `tweak` |
|
|
170
|
+
| `phase` | 当前阶段:`open`、`design`、`build`、`verify`、`archive`(init 统一设为 `open`,guard 负责过渡) |
|
|
171
|
+
| `design_doc` | 关联的 Superpowers Design Doc 路径,可为空 |
|
|
172
|
+
| `plan` | 关联的 Superpowers Plan 路径,可为空 |
|
|
173
|
+
| `build_mode` | 已选择的执行方式,可为空 |
|
|
174
|
+
| `isolation` | `branch` 或 `worktree`,工作区隔离方式。full 初始化可为 `null`,但只允许持续到 `/opensuper-build` Step 3 前;hotfix/tweak 默认 `branch` |
|
|
175
|
+
| `verify_mode` | `light` 或 `full`,可为空 |
|
|
176
|
+
| `verify_result` | `pending`、`pass` 或 `fail` |
|
|
177
|
+
| `verification_report` | 验证报告文件路径,verify 通过前必须指向已存在文件 |
|
|
178
|
+
| `branch_status` | `pending` 或 `handled`,分支处理完成后设为 `handled` |
|
|
179
|
+
| `verified_at` | 验证通过时间,可为空 |
|
|
180
|
+
| `archived` | change 是否已归档 |
|
|
181
|
+
|
|
182
|
+
可选字段:
|
|
183
|
+
|
|
184
|
+
| 字段 | 含义 |
|
|
185
|
+
|------|------|
|
|
186
|
+
| `direct_override` | `true`/`false`。full workflow 如需使用 `build_mode: direct`,必须显式设为 `true` |
|
|
187
|
+
| `build_command` | 项目构建命令。guard 优先运行该命令,失败时打印命令输出 |
|
|
188
|
+
| `verify_command` | 项目验证命令。verify guard 优先运行该命令,未配置时回退到构建命令 |
|
|
189
|
+
|
|
190
|
+
状态机硬约束:
|
|
191
|
+
- `build → verify` 前,`isolation` 必须是 `branch` 或 `worktree`
|
|
192
|
+
- `build → verify` 前,`build_mode` 必须已选择
|
|
193
|
+
- `build_mode: direct` 默认只允许 `hotfix` / `tweak`;full workflow 需要 `direct_override: true`
|
|
194
|
+
- 这些约束同时存在于 `opensuper-guard.sh build --apply` 和 `opensuper-state.sh transition <name> build-complete`
|
|
195
|
+
|
|
196
|
+
### 脚本定位
|
|
197
|
+
|
|
198
|
+
OpenSuper 脚本随 skill 包分发在 `opensuper/scripts/` 下。**不硬编码路径** — 定位一次,缓存到环境变量:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
OPENSUPER_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
|
|
202
|
+
OPENSUPER_GUARD="${OPENSUPER_GUARD:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-guard.sh' -type f -print -quit 2>/dev/null)}"
|
|
203
|
+
OPENSUPER_STATE="${OPENSUPER_STATE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-state.sh' -type f -print -quit 2>/dev/null)}"
|
|
204
|
+
OPENSUPER_ARCHIVE="${OPENSUPER_ARCHIVE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-archive.sh' -type f -print -quit 2>/dev/null)}"
|
|
205
|
+
|
|
206
|
+
# 脚本定位失败时停止流程
|
|
207
|
+
if [ -z "$OPENSUPER_GUARD" ] || [ -z "$OPENSUPER_STATE" ] || [ -z "$OPENSUPER_ARCHIVE" ]; then
|
|
208
|
+
echo "ERROR: OpenSuper scripts not found. Ensure the opensuper skill is installed." >&2
|
|
209
|
+
echo "Expected path pattern: */opensuper/scripts/opensuper-*.sh under project or platform skill directories" >&2
|
|
210
|
+
return 1
|
|
211
|
+
fi
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**自动状态更新**:guard 支持 `--apply` 参数,验证通过后自动更新 `.opensuper.yaml` 状态字段:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
bash "$OPENSUPER_GUARD" <change-name> <phase> --apply
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`--apply` 内部委托给 `opensuper-state transition`。需要直接表达状态事件时使用:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
bash "$OPENSUPER_STATE" transition <change-name> open-complete
|
|
224
|
+
bash "$OPENSUPER_STATE" transition <change-name> design-complete
|
|
225
|
+
bash "$OPENSUPER_STATE" transition <change-name> build-complete
|
|
226
|
+
bash "$OPENSUPER_STATE" transition <change-name> verify-pass
|
|
227
|
+
bash "$OPENSUPER_STATE" transition <change-name> verify-fail
|
|
228
|
+
bash "$OPENSUPER_STATE" transition <archive-name> archived
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**归档脚本**:一键完成归档全部步骤:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
bash "$OPENSUPER_ARCHIVE" <change-name>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
加载 opensuper 后,agent 应执行以上三条变量赋值一次,后续全程复用 `$OPENSUPER_GUARD`、`$OPENSUPER_STATE`、`$OPENSUPER_ARCHIVE`。
|
|
238
|
+
|
|
239
|
+
### 文件结构
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
openspec/ # OpenSpec — WHAT
|
|
243
|
+
├── config.yaml
|
|
244
|
+
├── changes/
|
|
245
|
+
│ ├── <name>/ # 活跃 change
|
|
246
|
+
│ │ ├── .openspec.yaml
|
|
247
|
+
│ │ ├── .opensuper.yaml
|
|
248
|
+
│ │ ├── proposal.md # Why + What
|
|
249
|
+
│ │ ├── design.md # 高层架构决策
|
|
250
|
+
│ │ ├── specs/<capability>/spec.md # Delta 能力规格
|
|
251
|
+
│ │ └── tasks.md # 任务清单
|
|
252
|
+
│ └── archive/YYYY-MM-DD-<name>/ # 已归档
|
|
253
|
+
└── specs/<capability>/spec.md # 主 specs(归档时从 delta 覆盖)
|
|
254
|
+
|
|
255
|
+
docs/superpowers/ # Superpowers — HOW
|
|
256
|
+
├── specs/YYYY-MM-DD-<topic>-design.md # 设计文档(技术 RFC,归档时标注状态)
|
|
257
|
+
└── plans/YYYY-MM-DD-<feature>.md # 实施计划(文件头含 change 关联元数据)
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 最佳实践
|
|
261
|
+
|
|
262
|
+
1. **brainstorming 不可跳过** — 每次变更必须经过深度设计(hotfix 和 tweak 除外)
|
|
263
|
+
2. **delta spec 是活文档** — 阶段 3 期间可自由修改,归档时同步
|
|
264
|
+
3. **保持 tasks.md 同步** — 完成一个勾一个
|
|
265
|
+
4. **频繁提交** — 每个任务一次提交,message 体现设计意图
|
|
266
|
+
5. **先验证再归档** — `/opensuper-verify` 通过后才执行 `/opensuper-archive`
|
|
267
|
+
6. **增量更新分级** — 小编辑、中重 brainstorming、大新 change
|
|
268
|
+
7. **Plan 必须关联 change** — 文件头包含 `change:` 和 `design-doc:` 元数据
|
|
269
|
+
8. **归档闭环** — design doc 和 plan 必须标注 `archived-with` 状态
|
|
270
|
+
9. **修改已有功能** — 直接 open 新 change 即可
|
|
271
|
+
10. **Preset 有上限** — hotfix/tweak 满足升级条件时及时切换到完整流程
|