@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rpamis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,362 @@
1
+ <p align="center">
2
+ <a href="https://github.com/pzy560117/opensuper/blob/main/img/title-log.png">
3
+ <picture>
4
+ <source srcset="https://github.com/pzy560117/opensuper/blob/main/img/title-log.png">
5
+ <img src="https://github.com/pzy560117/opensuper/blob/main/img/title-log.png" alt="OpenSuper logo">
6
+ </picture>
7
+ </a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://github.com/pzy560117/opensuper/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/pzy560117/opensuper/actions/workflows/ci.yml/badge.svg" /></a>
12
+ <a href="https://www.npmjs.com/package/@pzy560117/opensuper"><img alt="npm version" src="https://img.shields.io/npm/v/%40pzy560117%2Fopensuper?style=flat-square" /></a>
13
+ <a href="https://www.npmjs.com/package/@pzy560117/opensuper"><img alt="npm download count" src="https://img.shields.io/npm/dm/%40pzy560117%2Fopensuper?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
+
17
+ # @pzy560117/opensuper
18
+
19
+ ```
20
+ ██████╗ ██████╗ ███╗ ███╗███████╗████████╗
21
+ ██╔════╝██╔═══██╗████╗ ████║██╔════╝╚══██╔══╝
22
+ ██║ ██║ ██║██╔████╔██║█████╗ ██║
23
+ ██║ ██║ ██║██║╚██╔╝██║██╔══╝ ██║
24
+ ╚██████╗╚██████╔╝██║ ╚═╝ ██║███████╗ ██║
25
+ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝
26
+ ```
27
+
28
+ > 中文版:[README-zh.md](README-zh.md)
29
+ > [B站视频介绍 ](https://www.bilibili.com/video/BV1y4Gi6CEo1/?spm_id_from=333.1387.homepage.video_card.click&vd_source=d22726fe6b108647dbebf1c5d8817377)
30
+
31
+ **OpenSpec + Superpowers dual-star development workflow** — one command from idea to archive.
32
+
33
+ OpenSpec handles **WHAT** (outlines, proposals, spec lifecycle, archiving). Superpowers handles **HOW** (technical design, planning, execution, wrap-up). OpenSuper chains both into a five-phase automated pipeline.
34
+
35
+ ## Why OpenSuper
36
+
37
+ OpenSpec excels at managing requirements, creating proposals, managing Spec lifecycles, and archiving, but its proposals and tasks lack the detail of Superpowers brainstorming.
38
+
39
+ Superpowers generates Spec documents after brainstorming, but these documents typically lack stateful design — after completing requirements, Specs only have tasks checked off in the document, and Agents even forget to check them off. This causes the Agent to re-examine documents and project code to verify on resumption, wasting many tokens.
40
+
41
+ **OpenSuper combines the strengths of both**, integrating the core workflow into 5 phases
42
+
43
+ The main entry `/opensuper` supports current Spec state detection, suitable for long tasks — after completing and closing CC midway, just `/opensuper continue` and OpenSuper will automatically read the active Spec (lists multiple for selection), dynamically identify which phase is currently executing, and continue.
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ npm install -g @pzy560117/opensuper
49
+ ```
50
+
51
+ ## Quick Start
52
+
53
+ ```bash
54
+ cd your-project
55
+ opensuper init
56
+ ```
57
+
58
+ `opensuper init` will:
59
+
60
+ 1. Prompt you to select AI platforms (auto-detects existing configs)
61
+ 2. Choose install scope: project-level (current directory) or global (home directory)
62
+ 3. Select language for OpenSuper skills: English or 中文
63
+ 4. Install [OpenSpec](https://github.com/Fission-AI/OpenSpec) skills
64
+ 5. Install [Superpowers](https://github.com/obra/superpowers) skills
65
+ 6. Deploy OpenSuper skills (in your chosen language) to selected platforms
66
+ 7. Create `docs/superpowers/specs/` and `docs/superpowers/plans/` working directories
67
+
68
+ > [!TIP]
69
+ > update version
70
+ >
71
+ > `opensuper update` or `npm install -g @pzy560117/opensuper@latest` to get the latest features and fixes.
72
+
73
+ ## Screenshots
74
+
75
+ <p align="center">
76
+ <img src="https://github.com/pzy560117/opensuper/blob/main/img/runner.png" alt="runner">
77
+ </p>
78
+
79
+ <p align="center">Auto-install OpenSpec & Superpowers, one-click dev environment setup</p>
80
+ <p align="center">Multi-phase Skill entry, auto-detects current Spec stage, auto-triggers core flow, manual review at key nodes</p>
81
+
82
+ ## Commands
83
+
84
+ | Command | Description |
85
+ |---------|-------------|
86
+ | `opensuper init [path]` | Initialize OpenSuper workflow |
87
+ | `opensuper status [path]` | Show active changes, task progress, and next workflow command |
88
+ | `opensuper doctor [path]` | Diagnose project/global OpenSuper installation health |
89
+ | `opensuper update [path]` | Update the npm package and installed OpenSuper skills |
90
+ | `opensuper --help` | Show help |
91
+ | `opensuper --version` | Show version |
92
+
93
+ ### init Options
94
+
95
+ | Option | Description |
96
+ |--------|-------------|
97
+ | `--yes` | Non-interactive mode, auto-select detected platforms |
98
+ | `--skip-existing` | Skip already installed components |
99
+ | `--overwrite` | Overwrite already installed components |
100
+ | `--json` | Output structured JSON |
101
+
102
+ When multiple existing components are found on the same platform, interactive init offers one bulk choice: overwrite all, skip all, or choose per component.
103
+
104
+ ### status Options
105
+
106
+ | Option | Description |
107
+ |--------|-------------|
108
+ | `--json` | Output active changes with `nextCommand` |
109
+
110
+ ### doctor Options
111
+
112
+ | Option | Description |
113
+ |--------|-------------|
114
+ | `--json` | Output structured diagnostic results |
115
+ | `--scope <scope>` | Diagnose `auto`, `project`, or `global` scope (default: `auto`) |
116
+
117
+ ### update Options
118
+
119
+ | Option | Description |
120
+ |--------|-------------|
121
+ | `--json` | Output npm and skill update results as JSON |
122
+ | `--language <lang>` | Override detected skill language (`en`, `zh`) |
123
+ | `--scope <scope>` | Update only `global` or `project` scope |
124
+
125
+ ## Supported Platforms
126
+
127
+ `opensuper init` supports 28 AI coding platforms:
128
+
129
+ | Platform | Skills Dir | Platform | Skills Dir |
130
+ |----------|-----------|----------|-----------|
131
+ | Claude Code | `.claude/` | Cursor | `.cursor/` |
132
+ | Codex | `.codex/` | OpenCode | `.opencode/` |
133
+ | Windsurf | `.windsurf/` | Cline | `.cline/` |
134
+ | RooCode | `.roo/` | Continue | `.continue/` |
135
+ | GitHub Copilot | `.github/` | Gemini CLI | `.gemini/` |
136
+ | Amazon Q Developer | `.amazonq/` | Qwen Code | `.qwen/` |
137
+ | Kilo Code | `.kilocode/` | Auggie | `.augment/` |
138
+ | Kiro | `.kiro/` | Lingma | `.lingma/` |
139
+ | Junie | `.junie/` | CodeBuddy | `.codebuddy/` |
140
+ | CoStrict | `.cospec/` | Crush | `.crush/` |
141
+ | Factory Droid | `.factory/` | iFlow | `.iflow/` |
142
+ | Pi | `.pi/` | Qoder | `.qoder/` |
143
+ | Antigravity | `.agent/` | Bob Shell | `.bob/` |
144
+ | ForgeCode | `.forge/` | Trae | `.trae/` |
145
+
146
+ ## Skills
147
+
148
+ After `opensuper init`, three groups of skills are installed to the selected platform's `skills/` directory:
149
+
150
+ ### OpenSuper Skills
151
+
152
+ | Skill | Description |
153
+ |-------|-------------|
154
+ | `/opensuper` | Main entry — auto-detects phase and dispatches to sub-commands |
155
+ | `/opensuper-open` | Phase 1: Open a change (proposal, design, task breakdown) |
156
+ | `/opensuper-design` | Phase 2: Deep design (brainstorming, Design Doc) |
157
+ | `/opensuper-build` | Phase 3: Plan and build (implementation plan, code commits) |
158
+ | `/opensuper-verify` | Phase 4: Verify and finish (testing, verification report) |
159
+ | `/opensuper-archive` | Phase 5: Archive (delta spec sync, status annotation) |
160
+ | `/opensuper-hotfix` | Preset: Quick bug fix (skips brainstorming) |
161
+ | `/opensuper-tweak` | Preset: Small change (skips brainstorming and full plan) |
162
+
163
+ ### Guard & Automation Scripts
164
+
165
+ | Script | Purpose |
166
+ |--------|---------|
167
+ | `opensuper-guard.sh` | Phase transition guard — validates exit conditions, `--apply` auto-updates `.opensuper.yaml` |
168
+ | `opensuper-archive.sh` | One-command archive — validates state, syncs specs, moves to archive, updates status |
169
+ | `opensuper-yaml-validate.sh` | Schema validator — validates `.opensuper.yaml` structure and field values |
170
+ | `opensuper-state.sh` | Unified state management — init/set/get/check/scale, agents' exclusive YAML interface |
171
+
172
+ ### OpenSpec Skills
173
+
174
+ Spec lifecycle management: propose, explore, sync, verify, archive, and more.
175
+
176
+ ### Superpowers Skills
177
+
178
+ Development methodology: brainstorming, TDD, subagent-driven development, code review, plan writing, and more.
179
+
180
+ ## Workflow
181
+
182
+ ```
183
+ /opensuper
184
+ ↓ auto-detect
185
+ /opensuper-open --> /opensuper-design --> /opensuper-build --> /opensuper-verify --> /opensuper-archive
186
+ (OpenSpec) (Superpowers) (Superpowers) (Both) (OpenSpec)
187
+
188
+ /opensuper-hotfix (preset path, skips brainstorming)
189
+ open --> build --> verify --> archive
190
+
191
+ /opensuper-tweak (preset path, skips brainstorming and full plan)
192
+ open --> lightweight build --> light verify --> archive
193
+ ```
194
+
195
+ ### Five Phases
196
+
197
+ | Phase | Command | Owner | Artifacts |
198
+ |-------|---------|-------|-----------|
199
+ | 1. Open | `/opensuper-open` | OpenSpec | proposal.md, design.md, tasks.md |
200
+ | 2. Deep Design | `/opensuper-design` | Superpowers | Design Doc, delta spec |
201
+ | 3. Plan & Build | `/opensuper-build` | Superpowers | Implementation plan, code commits |
202
+ | 4. Verify & Finish | `/opensuper-verify` | Both | Verification report, branch handling |
203
+ | 5. Archive | `/opensuper-archive` | OpenSpec | delta→main spec sync, archive |
204
+
205
+ ### Core Principles
206
+
207
+ - **Brainstorming is non-skippable** — every change must go through deep design (except hotfix/tweak)
208
+ - **Delta specs are living documents** — freely editable during Phase 3, synced at archive
209
+ - **Keep tasks.md in sync** — check off each task as completed
210
+ - **Commit frequently** — one commit per task, message reflects design intent
211
+ - **Verify before archive** — `/opensuper-verify` must pass before `/opensuper-archive`
212
+
213
+ ### State Management
214
+
215
+ OpenSuper uses a decoupled state architecture with separate YAML files:
216
+
217
+ | File | Owner | Purpose |
218
+ |------|-------|---------|
219
+ | `.openspec.yaml` | OpenSpec | Spec lifecycle, change metadata |
220
+ | `.opensuper.yaml` | OpenSuper | Workflow phase, execution mode, verification status |
221
+
222
+ **Key Fields in `.opensuper.yaml`:**
223
+
224
+ ```yaml
225
+ workflow: full
226
+ phase: build
227
+ design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
228
+ plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
229
+ build_mode: subagent-driven-development
230
+ isolation: branch
231
+ verify_mode: light
232
+ verify_result: pending
233
+ verification_report: docs/superpowers/reports/YYYY-MM-DD-change-verify.md
234
+ branch_status: pending
235
+ verified_at: null
236
+ archived: false
237
+ ```
238
+
239
+ In full workflow, `build_mode` and `isolation` may temporarily be `null` at init time, but they must be resolved before `build → verify`. `direct` is allowed by default only for hotfix/tweak; full workflow requires `direct_override: true`. Projects can configure `build_command` / `verify_command` in the change or repo root, and guard will run those commands first and print failure output.
240
+
241
+ All states and execution phases are updated via scripts, and **each phase verifies that tasks are truly completed before exiting — conditions are met before the phase exits and state is updated**. Compared to recording complex state management mechanisms in Skills, the script approach strongly guarantees the reliability of core state transitions, correctness of YAML files, and convenience of breakpoint recovery — Agents only need to use OpenSuper's built-in commands to read state and know the current Spec's situation.
242
+
243
+ ### Reliability Features
244
+
245
+ OpenSuper ensures agent execution reliability through automated state transitions:
246
+
247
+ 1. **Entry Verification** — Each phase validates preconditions before execution
248
+ - Checks file existence, state consistency, and phase transitions
249
+ - Outputs `[HARD STOP]` with actionable suggestions if validation fails
250
+
251
+ 2. **Automated State Transitions** — `opensuper-guard.sh --apply` updates `.opensuper.yaml` automatically
252
+ - All phase transitions (design → build → verify → archive) use `guard --apply`
253
+ - No manual state editing required — eliminates write-verification errors
254
+ - `opensuper-state.sh` is the agents' exclusive interface for state operations
255
+ - Guard and archive scripts use `opensuper-state.sh` internally for state management
256
+
257
+ 3. **Schema Validation** — `opensuper-yaml-validate.sh` ensures data integrity
258
+ - Validates required and optional fields
259
+ - Validates enum values, including `direct_override`
260
+ - Validates referenced file paths exist
261
+ - Detects unknown/typos fields
262
+
263
+ 4. **Build Decision Enforcement** — Guard and state transitions both block skipped build choices
264
+ - `isolation` must be `branch` or `worktree`
265
+ - `build_mode` must be selected before leaving build
266
+ - Full workflow `build_mode: direct` requires `direct_override: true`
267
+
268
+ 5. **Verification Evidence** — Guard enforces proof before phase advance
269
+ - `verify-pass` transition requires `verification_report` pointing to an existing report file
270
+ - `branch_status` must be `handled` before verify can pass
271
+ - Guard checks `verification_report exists` and `branch_status=handled` as hard prerequisites
272
+ - Prevents false phase advances when verification or branch handling was skipped
273
+
274
+ 6. **Archive Automation** — `opensuper-archive.sh` handles the full archive flow in one command
275
+ - Validates entry state, syncs delta specs to main specs
276
+ - Annotates design doc and plan frontmatter
277
+ - Moves change to archive directory and updates `archived: true`
278
+ - Supports `--dry-run` for preview
279
+
280
+ **Security**: Path traversal protection on all change name inputs
281
+
282
+ ## Project Structure
283
+
284
+ ```
285
+ your-project/
286
+ ├── .claude/skills/ # Platform skills dir (OpenSuper + OpenSpec + Superpowers)
287
+ │ ├── opensuper/SKILL.md
288
+ │ │ └── scripts/
289
+ │ │ ├── opensuper-guard.sh # Phase transition guard (--apply auto-updates state)
290
+ │ │ ├── opensuper-archive.sh # One-command archive automation
291
+ │ │ ├── opensuper-yaml-validate.sh # Schema validator
292
+ │ │ └── opensuper-state.sh # Unified state management (init/set/get/check/scale)
293
+ │ ├── opensuper-*/SKILL.md
294
+ │ ├── openspec-*/SKILL.md
295
+ │ └── brainstorming/SKILL.md
296
+ ├── openspec/ # OpenSpec — WHAT
297
+ │ ├── config.yaml
298
+ │ └── changes/
299
+ │ └── <name>/
300
+ │ ├── .openspec.yaml # OpenSpec state
301
+ │ ├── .opensuper.yaml # OpenSuper workflow state (decoupled)
302
+ │ ├── proposal.md
303
+ │ ├── design.md
304
+ │ ├── specs/<capability>/spec.md
305
+ │ └── tasks.md
306
+ └── docs/superpowers/ # Superpowers — HOW
307
+ ├── specs/ # Design documents
308
+ └── plans/ # Implementation plans
309
+ ```
310
+
311
+ ## What You'll Learn
312
+
313
+ Many excellent Skill projects exist in the current Skill market, but they generally have preference issues — users may only like some features. For example, when using both OpenSpec and Superpowers, one might only use OpenSpec's Spec management capabilities, but prefer Superpowers' TDD-driven approach for coding.
314
+
315
+ Long-term Skill users know these capabilities can be freely combined, but exactly how to do so still requires real practice. The OpenSuper project can serve as a reference:
316
+
317
+ - **How to reliably trigger nested Skills** — Not letting the Agent rely on document descriptions to perform "look-alike Skill trigger" operations (like writing files based on Skill descriptions), but truly triggering Skills (key feature: Skill trigger prints on CC). OpenSuper will trigger many capabilities from OpenSpec and Superpowers — how is this Prompt written?
318
+
319
+ - **How to make combined Skills multi-phase auto-flow** — Not relying on manual intervention. OpenSuper's 5-phase flow automatically triggers Skills for core processes except necessary user selections, while the **state machine mechanism** also ensures state transition reliability.
320
+
321
+ ## Development
322
+
323
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, commit conventions, PR process, and guidance for adding platforms or skills.
324
+
325
+ ```bash
326
+ # Clone
327
+ git clone https://github.com/pzy560117/opensuper
328
+ cd opensuper
329
+
330
+ # Install dependencies
331
+ pnpm install
332
+
333
+ # Dev mode (watch)
334
+ pnpm dev
335
+
336
+ # Build
337
+ pnpm build
338
+
339
+ # Test (unit + coverage)
340
+ pnpm test
341
+ pnpm test:coverage
342
+ pnpm test:shell # bats shell tests
343
+
344
+ # Lint & format
345
+ pnpm lint
346
+ pnpm format
347
+ ```
348
+
349
+ See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
350
+
351
+ ## Security
352
+
353
+ - Pre-publish scan for API keys, secrets, tokens, and private keys
354
+ - `.npmignore` prevents source code and config files from entering the npm package
355
+ - `.gitignore` covers secrets, credentials, IDE configs, and more
356
+
357
+ ## License
358
+
359
+ [MIT](LICENSE.md)
360
+
361
+ ## Reference
362
+ [LINUX DO - 新的理想型社区](https://linux.do/)
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": "0.2.6",
3
+ "skills": [
4
+ "opensuper/SKILL.md",
5
+ "opensuper/scripts/opensuper-guard.sh",
6
+ "opensuper/scripts/opensuper-state.sh",
7
+ "opensuper/scripts/opensuper-archive.sh",
8
+ "opensuper/scripts/opensuper-yaml-validate.sh",
9
+ "opensuper-open/SKILL.md",
10
+ "opensuper-design/SKILL.md",
11
+ "opensuper-build/SKILL.md",
12
+ "opensuper-verify/SKILL.md",
13
+ "opensuper-archive/SKILL.md",
14
+ "opensuper-hotfix/SKILL.md",
15
+ "opensuper-tweak/SKILL.md"
16
+ ],
17
+ "languages": [
18
+ { "id": "en", "name": "English", "skillsDir": "skills" },
19
+ { "id": "zh", "name": "中文", "skillsDir": "skills-zh" }
20
+ ]
21
+ }
@@ -0,0 +1,268 @@
1
+ ---
2
+ name: opensuper
3
+ description: "OpenSuper — OpenSpec + Superpowers dual-star development workflow. Start with /opensuper for automatic phase detection and dispatch to subcommands. Five phases: open → design → build → verify → archive."
4
+ ---
5
+
6
+ # OpenSuper — OpenSpec + Superpowers Dual-Star Development Workflow
7
+
8
+ OpenSpec and Superpowers orbit the same goal like a binary star system. OpenSpec handles WHAT, Superpowers handles HOW.
9
+
10
+ ```
11
+ OpenSpec handles WHAT — outline, proposal, spec lifecycle, archive
12
+ Superpowers handles HOW — technical design, planning, execution, closing
13
+ ```
14
+
15
+ **Core principle: brainstorming cannot be skipped. Every change must undergo deep design (except hotfix and tweak presets).**
16
+
17
+ ---
18
+
19
+ ## Decision Core
20
+
21
+ Agents need only read this section for decision-making. Refer to the Reference Appendix as needed.
22
+
23
+ ### Automatic Phase Detection
24
+
25
+ **Step 0: Active Change Discovery**
26
+
27
+ 1. Run `openspec list --json` to get all active changes
28
+
29
+ | Active changes | User input | Behavior |
30
+ |----------------|------------|----------|
31
+ | None | any | → Invoke `/opensuper-open` |
32
+ | Exactly 1 | `/opensuper <description>` | → **Ask**: continue this change or create a new change |
33
+ | Multiple | `/opensuper <description>` | → **Ask**: continue existing or create new; if continuing, list changes for selection |
34
+ | Exactly 1 | `/opensuper` with no description | → Auto-select, enter Step 1 |
35
+ | Multiple | `/opensuper` with no description | → List changes for user selection |
36
+
37
+ <IMPORTANT>
38
+ When the user chooses "create a new change", **must invoke `/opensuper-open`**. Do not call `/opsx:new` directly.
39
+ `/opensuper-open` performs dual initialization: OpenSpec artifacts plus `.opensuper.yaml` state.
40
+ Calling `/opsx:new` directly leaves `.opensuper.yaml` missing and breaks later phase detection.
41
+ </IMPORTANT>
42
+
43
+ **Preset detection**:
44
+ - User describes as bug fix / hotfix + meets hotfix conditions → directly invoke `/opensuper-hotfix`
45
+ - User describes as copy, config, docs, prompt or small non-bug adjustment + meets tweak conditions → directly invoke `/opensuper-tweak`
46
+
47
+ **Step 1: Read `.opensuper.yaml` state metadata**
48
+
49
+ Prefer reading `openspec/changes/<name>/.opensuper.yaml`. If not available, fall back to `openspec status --change "<name>" --json`, `tasks.md`, and `docs/superpowers/` file checks.
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 "$OPENSUPER_STATE" transition <name> verify-fail`, then invoke `/opensuper-build`
55
+ - If `phase: open` but proposal/design/tasks are complete, run `bash "$OPENSUPER_GUARD" <change-name> open --apply` to repair state, then continue detection
56
+ - If `phase: archive`, only invoke `/opensuper-archive`; after archive succeeds, the change moves to the archive directory, so do not run guard against the old active directory
57
+
58
+ **Step 2: Phase Determination** (check in order, first match wins)
59
+
60
+ 1. `archived: true` or change moved to archive → Workflow complete
61
+ 2. `verify_result: pass` and `archived` is not `true` → Invoke `/opensuper-archive`
62
+ 3. `verify_result: fail` → run `bash "$OPENSUPER_STATE" transition <name> verify-fail`, then invoke `/opensuper-build`
63
+ 4. `phase: verify` or tasks.md all checked → Invoke `/opensuper-verify`
64
+ 5. `phase: build` or has Design Doc but plan/execution incomplete → Invoke `/opensuper-build`
65
+ 6. `phase: design` or has change but no Design Doc → Invoke `/opensuper-design`
66
+ 7. `phase: open` or active change exists but `.opensuper.yaml` is missing → Invoke `/opensuper-open`
67
+ 8. No active change → Invoke `/opensuper-open`
68
+
69
+ If metadata conflicts with file state, use verifiable file state as source of truth and correct `.opensuper.yaml` before continuing.
70
+
71
+ ### Preset Upgrade Criteria
72
+
73
+ **hotfix → full** (upgrade if any condition met):
74
+ - Change involves **3+ files**
75
+ - Architecture changes (new modules, new interfaces, new dependencies)
76
+ - Database schema changes
77
+ - Fix introduces new public API
78
+ - Fix scope exceeds a single function/module
79
+
80
+ **tweak → full** (upgrade if any condition met):
81
+ - Change involves **5+ files**
82
+ - Cross-module coordination required
83
+ - **5+** new test cases needed
84
+ - Config item additions or deletions (not value changes)
85
+
86
+ ### Error Handling Quick Reference
87
+
88
+ | Scenario | Handling |
89
+ |----------|----------|
90
+ | `openspec list --json` fails | Check if openspec is installed, prompt user to run `openspec init` |
91
+ | Sub-skill unavailable | Stop workflow, prompt to install or enable the corresponding skill |
92
+ | `.opensuper.yaml` malformed or missing | Use file state as source of truth, correct with `bash $OPENSUPER_STATE set` then continue |
93
+ | Build/test fails | Return to build phase for fixes, do not enter verify |
94
+ | Incomplete change directory structure | Fill missing files according to `opensuper-open` artifact requirements |
95
+
96
+ ### Phase Transitions
97
+
98
+ <IMPORTANT>
99
+ A single `/opensuper` invocation starts from the detected phase and advances to the next phase when exit conditions are met.
100
+
101
+ Flow chain: open → design → build → verify → archive
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
+
105
+ Nodes requiring user participation:
106
+ 1. Confirm design approach during brainstorming
107
+ 2. Select execution mode during build phase
108
+ 3. Decide to fix or accept deviation when verify fails
109
+ 4. Choose branch handling method for finishing-branch
110
+ 5. Encounter upgrade conditions (hotfix/tweak → full workflow)
111
+
112
+ Agents should not skip these decision points; other unambiguous phase transitions can proceed automatically.
113
+ </IMPORTANT>
114
+
115
+ ---
116
+
117
+ ## Subcommand Quick Reference
118
+
119
+ | Command | Phase | Owner | Artifacts |
120
+ |---------|-------|-------|-----------|
121
+ | `/opensuper-open` | 1. Open | OpenSpec | proposal.md, design.md, tasks.md |
122
+ | `/opensuper-design` | 2. Deep Design | Superpowers | Design Doc, delta spec |
123
+ | `/opensuper-build` | 3. Plan and Build | Superpowers | Implementation plan, code commits |
124
+ | `/opensuper-verify` | 4. Verify and Close | Both | Verification report, branch handling |
125
+ | `/opensuper-archive` | 5. Archive | OpenSpec | delta→main spec sync, design doc markup, archive |
126
+ | `/opensuper-hotfix` | Preset path | Both | Quick fix (skip brainstorming) |
127
+ | `/opensuper-tweak` | Preset path | Both | Small change (skip brainstorming and full plan) |
128
+
129
+ ```
130
+ /opensuper
131
+ ↓ Auto-detect
132
+ /opensuper-open ──→ /opensuper-design ──→ /opensuper-build ──→ /opensuper-verify ──→ /opensuper-archive
133
+ (OpenSpec) (Superpowers) (Superpowers) (Both) (OpenSpec)
134
+
135
+ /opensuper-hotfix (preset, skip brainstorming)
136
+ open ──→ build ──→ verify ──→ archive
137
+ ↑ If upgrade triggered → supplement Design Doc → return to full workflow
138
+
139
+ /opensuper-tweak (preset, skip brainstorming and full plan)
140
+ open ──→ lightweight build ──→ light verify ──→ archive
141
+ ↑ If upgrade triggered → supplement Design Doc → return to full workflow
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Reference Appendix
147
+
148
+ ### .opensuper.yaml Field Reference
149
+
150
+ ```yaml
151
+ workflow: full
152
+ phase: build
153
+ design_doc: docs/superpowers/specs/YYYY-MM-DD-topic-design.md
154
+ plan: docs/superpowers/plans/YYYY-MM-DD-feature.md
155
+ build_mode: subagent-driven-development
156
+ isolation: branch
157
+ verify_mode: light
158
+ verify_result: pending
159
+ verification_report: null
160
+ branch_status: pending
161
+ verified_at: null
162
+ archived: false
163
+ ```
164
+
165
+ | Field | Meaning |
166
+ |-------|---------|
167
+ | `workflow` | `full`, `hotfix`, or `tweak` |
168
+ | `phase` | Current phase: `open`, `design`, `build`, `verify`, `archive` |
169
+ | `design_doc` | Associated Superpowers Design Doc path, can be empty |
170
+ | `plan` | Associated Superpowers Plan path, can be empty |
171
+ | `build_mode` | Selected execution mode, can be empty |
172
+ | `isolation` | `branch` or `worktree`, workspace isolation method. Full workflow init may leave this as `null`, but only until `/opensuper-build` Step 3; hotfix/tweak default to `branch` |
173
+ | `verify_mode` | `light` or `full`, can be empty |
174
+ | `verify_result` | `pending`, `pass`, or `fail` |
175
+ | `verification_report` | Verification report file path; must point to an existing file before verify can pass |
176
+ | `branch_status` | `pending` or `handled`; set to `handled` after branch handling completes |
177
+ | `verified_at` | Verification pass time, can be empty |
178
+ | `archived` | Whether change is archived |
179
+
180
+ Optional fields:
181
+
182
+ | Field | Meaning |
183
+ |-------|---------|
184
+ | `direct_override` | `true`/`false`. Full workflow may use `build_mode: direct` only when this is explicitly `true` |
185
+ | `build_command` | Project build command. Guard runs this first and prints failure output |
186
+ | `verify_command` | Project verification command. Verify guard runs this first; if absent, it falls back to the build command |
187
+
188
+ State-machine hard constraints:
189
+ - Before `build → verify`, `isolation` must be `branch` or `worktree`
190
+ - Before `build → verify`, `build_mode` must be selected
191
+ - `build_mode: direct` is allowed by default only for `hotfix` / `tweak`; full workflow requires `direct_override: true`
192
+ - These constraints are enforced by both `opensuper-guard.sh build --apply` and `opensuper-state.sh transition <name> build-complete`
193
+
194
+ ### Script Location
195
+
196
+ OpenSuper scripts are distributed in `opensuper/scripts/`. **Do not hardcode paths** — locate once, cache in env vars:
197
+
198
+ ```bash
199
+ OPENSUPER_SEARCH_ROOTS=("." "$HOME/.claude/skills" "$HOME/.codex/skills" "$HOME/.cursor/skills")
200
+ OPENSUPER_GUARD="${OPENSUPER_GUARD:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-guard.sh' -type f -print -quit 2>/dev/null)}"
201
+ OPENSUPER_STATE="${OPENSUPER_STATE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-state.sh' -type f -print -quit 2>/dev/null)}"
202
+ OPENSUPER_ARCHIVE="${OPENSUPER_ARCHIVE:-$(find "${OPENSUPER_SEARCH_ROOTS[@]}" -path '*/opensuper/scripts/opensuper-archive.sh' -type f -print -quit 2>/dev/null)}"
203
+
204
+ if [ -z "$OPENSUPER_GUARD" ] || [ -z "$OPENSUPER_STATE" ] || [ -z "$OPENSUPER_ARCHIVE" ]; then
205
+ echo "ERROR: OpenSuper scripts not found. Ensure the opensuper skill is installed." >&2
206
+ echo "Expected path pattern: */opensuper/scripts/opensuper-*.sh under project or platform skill directories" >&2
207
+ return 1
208
+ fi
209
+ ```
210
+
211
+ **Auto state update**: Guard supports `--apply` flag, automatically updating `.opensuper.yaml` state fields after checks pass:
212
+
213
+ ```bash
214
+ bash "$OPENSUPER_GUARD" <change-name> <phase> --apply
215
+ ```
216
+
217
+ `--apply` delegates to `opensuper-state transition`. Use these semantic events when state changes need to be expressed directly:
218
+
219
+ ```bash
220
+ bash "$OPENSUPER_STATE" transition <change-name> open-complete
221
+ bash "$OPENSUPER_STATE" transition <change-name> design-complete
222
+ bash "$OPENSUPER_STATE" transition <change-name> build-complete
223
+ bash "$OPENSUPER_STATE" transition <change-name> verify-pass
224
+ bash "$OPENSUPER_STATE" transition <change-name> verify-fail
225
+ bash "$OPENSUPER_STATE" transition <archive-name> archived
226
+ ```
227
+
228
+ **Archive script**: Complete all archive steps in one command:
229
+
230
+ ```bash
231
+ bash "$OPENSUPER_ARCHIVE" <change-name>
232
+ ```
233
+
234
+ After loading opensuper, agents should run the three variable assignments above once, then reuse `$OPENSUPER_GUARD`, `$OPENSUPER_STATE`, `$OPENSUPER_ARCHIVE` throughout the session.
235
+
236
+ ### File Structure
237
+
238
+ ```
239
+ openspec/ # OpenSpec — WHAT
240
+ ├── config.yaml
241
+ ├── changes/
242
+ │ ├── <name>/ # Active change
243
+ │ │ ├── .openspec.yaml
244
+ │ │ ├── .opensuper.yaml
245
+ │ │ ├── proposal.md # Why + What
246
+ │ │ ├── design.md # High-level architecture decisions
247
+ │ │ ├── specs/<capability>/spec.md # Delta capability spec
248
+ │ │ └── tasks.md # Task checklist
249
+ │ └── archive/YYYY-MM-DD-<name>/ # Archived
250
+ └── specs/<capability>/spec.md # Main specs (overwritten from delta at archive)
251
+
252
+ docs/superpowers/ # Superpowers — HOW
253
+ ├── specs/YYYY-MM-DD-<topic>-design.md # Design doc (technical RFC, mark status at archive)
254
+ └── plans/YYYY-MM-DD-<feature>.md # Implementation plan (file header contains change association metadata)
255
+ ```
256
+
257
+ ### Best Practices
258
+
259
+ 1. **brainstorming cannot be skipped** — Every change must undergo deep design (except hotfix and tweak)
260
+ 2. **delta spec is a living document** — Freely modify during phase 3, sync at archive
261
+ 3. **Keep tasks.md in sync** — Check off each completed task
262
+ 4. **Commit frequently** — One commit per task, message reflects design intent
263
+ 5. **Verify before archive** — Execute `/opensuper-archive` only after `/opensuper-verify` passes
264
+ 6. **Classify incremental updates** — Small edits, medium brainstorming, large new changes
265
+ 7. **Plan must associate with change** — File header contains `change:` and `design-doc:` metadata
266
+ 8. **Archive closure** — design doc and plan must mark `archived-with` status
267
+ 9. **Modifying existing features** — Just open a new change
268
+ 10. **Preset has limits** — Switch to full workflow promptly when hotfix/tweak meet upgrade conditions