|
1 | | -# openspec-superpowers-opencode (aka oso) |
| 1 | +# oso (openspec-superpowers-opencode) |
2 | 2 |
|
3 | | -> **中文版 → [docs/README.zh.md](docs/README.zh.md)** |
4 | | -
|
5 | | -**CLI scaffold that bridges Superpowers + OpenSpec workflows into OpenCode.** |
| 3 | +> Bridges Superpowers + OpenSpec workflows into OpenCode with enforced worktree isolation. |
6 | 4 |
|
| 5 | +[](https://github.com/moyaspace/openspec-superpowers-opencode/actions) |
| 6 | +[](https://github.com/moyaspace/openspec-superpowers-opencode) |
7 | 7 | [](https://github.com/moyaspace/openspec-superpowers-opencode) |
8 | 8 | [](https://www.npmjs.com/package/@moyaspace/openspec-superpowers-opencode) |
9 | 9 | [](https://www.npmjs.com/package/@moyaspace/openspec-superpowers-opencode) |
10 | | -[](https://www.npmjs.com/package/@moyaspace/openspec-superpowers-opencode) |
| 10 | +[](https://www.npmjs.com/package/@moyaspace/openspec-superpowers-opencode) |
11 | 11 | [](https://github.com/moyaspace/openspec-superpowers-opencode) |
12 | 12 |
|
13 | 13 | > If you find this useful, consider giving it a ⭐ on GitHub! |
14 | 14 |
|
15 | | -- **GitHub**: `https://github.com/moyaspace/openspec-superpowers-opencode` |
16 | | -- **npm**: `https://www.npmjs.com/package/@moyaspace/openspec-superpowers-opencode` |
17 | | -- **Author**: rl <robincn@gmail.com> |
18 | | -- **License**: MIT |
19 | | - |
20 | | -## Features |
21 | | - |
22 | | -| # | Feature | One-liner | |
23 | | -|---|---------|-----------| |
24 | | -| 1 | **One-command init** | `openspec-superpowers-opencode init` → deploy templates + config + first commit | |
25 | | -| 2 | **12 OPSX commands** | `/opsx-ff` → `/opsx-apply` → `/opsx-finish` covers the full change lifecycle | |
26 | | -| 3 | **Git worktree isolation** | Each change lives in its own `.worktrees/<name>/` dir and `feature/<name>` branch; main stays clean | |
27 | | -| 4 | **Layered architecture** | Superpowers (HOW) → OpenSpec (WHAT) → Worktree (WHERE) → Commands (WHEN) | |
28 | | -| 5 | **Greenfield/brownfield** | Auto-deploy on new projects; per-file overwrite prompts on existing ones | |
29 | | -| 6 | **Brownfield override system** | `BROWN_OVERRIDE_*` env vars or interactive prompts control overwrite decisions | |
30 | | -| 7 | **Skill lock verification** | SHA-256 hashes of upstream Superpowers skill files are validated on deploy | |
31 | | -| 8 | **Cross-platform + i18n** | Windows (`setup.ps1`) / Linux (`setup.sh`), `--lang zh-CN | zh-TW | en` | |
32 | | - |
33 | | -> Detailed feature descriptions → [docs/FEATURES.md](docs/FEATURES.md). |
34 | | -
|
35 | | -## Install |
36 | | - |
37 | | -```bash |
38 | | -# From npm |
39 | | -npm install -g @moyaspace/openspec-superpowers-opencode |
40 | | - |
41 | | -# From local tgz (offline/preview) |
42 | | -npm install -g ./<name>-<version>.tgz |
| 15 | +--- |
43 | 16 |
|
44 | | -# Verify |
45 | | -openspec-superpowers-opencode --help |
46 | | -``` |
| 17 | +## The Problem |
47 | 18 |
|
48 | | -Requirements: `openspec` CLI v1.3+, `opencode` CLI, `git`, Superpowers plugin. |
| 19 | +Install **OpenSpec** and **Superpowers** separately, and you get two powerful but disconnected tools. |
49 | 20 |
|
50 | | -## Usage |
| 21 | +OpenSpec gives you artifact-driven development — brainstorm → specs → tasks → plan. |
51 | 22 |
|
52 | | -```powershell |
53 | | -# One-step init |
54 | | -mkdir my-project && cd my-project |
55 | | -openspec-superpowers-opencode init |
| 23 | +Superpowers gives you battle-tested methodologies — brainstorming, writing-plans, TDD. |
56 | 24 |
|
57 | | -# Or specify a target directory |
58 | | -openspec-superpowers-opencode init my-project |
59 | | -``` |
| 25 | +But out of the box, they don't talk to each other. OpenSpec generates generic artifacts, Superpowers skills sit in a separate cache directory, and there's nothing connecting them into a unified workflow. |
60 | 26 |
|
61 | | -`init` automatically: deploys template files → `git init` → first commit. |
| 27 | +You can use both, but you'll spend more time stitching them together than actually building features. |
62 | 28 |
|
63 | | -## Prerequisites |
| 29 | +And even if you do wire them up, you're still stuck with a **single working tree** — one change at a time. Want to add login and search simultaneously? Context collision, partial commits, reverting. You either wait, or you break things. |
64 | 30 |
|
65 | | -- `openspec` CLI v1.3+ |
66 | | -- `opencode` CLI |
67 | | -- `git` |
68 | | -- Superpowers plugin installed |
| 31 | +**oso bridges the gap and adds isolation.** |
69 | 32 |
|
70 | | -The setup script will check these automatically. |
| 33 | +## The oso Solution |
71 | 34 |
|
72 | | -## Using in OpenCode |
| 35 | +oso is a CLI scaffold that does two things: |
73 | 36 |
|
74 | | -Open the initialized project in OpenCode, then use the full workflow: |
| 37 | +**① Bridges OpenSpec + Superpowers** — one command deploys the complete integration: schema, AGENTS.md, skill lock verification, 12 OPSX commands, all pre-configured and tested together. |
75 | 38 |
|
76 | | -| Command | Description | |
77 | | -|---------|-------------| |
78 | | -| `/opsx-ff <name>` | Create a change and generate all artifacts | |
79 | | -| `/opsx-apply [name]` | Get context, start implementation | |
80 | | -| `/opsx-verify` | Verify implementation vs spec | |
81 | | -| `/opsx-finish [name]` | Complete change (merge/cleanup) | |
82 | | -| `/opsx-archive` | Archive completed changes | |
| 39 | +**② Enforces worktree isolation** — every change gets its own git worktree. Parallel changes, zero conflicts. |
83 | 40 |
|
84 | | -### Parallel changes |
| 41 | +``` |
| 42 | + ┌─ .worktrees/feature-a/ (feature/feature-a branch) |
| 43 | +main ─────┼─ .worktrees/feature-b/ (feature/feature-b branch) |
| 44 | + └─ .worktrees/feature-c/ (feature/feature-c branch) |
| 45 | +``` |
85 | 46 |
|
86 | | -Each change is isolated in its own git worktree. AI handles all directory switching: |
| 47 | +<!-- TODO: 30s 终端录屏 GIF — 展示 /opsx-ff feature-a → /opsx-ff feature-b → 各自 apply,互不干扰 --> |
87 | 48 |
|
88 | 49 | ```bash |
89 | 50 | # Create two changes simultaneously |
90 | | -/opsx-ff feature-a # → background: cd .worktrees/feature-a/ create artifacts → back to main |
91 | | -/opsx-ff feature-b # → background: cd .worktrees/feature-b/ create artifacts → back to main |
| 51 | +/opsx-ff feature-a |
| 52 | +/opsx-ff feature-b |
92 | 53 |
|
93 | | -# Switch to feature-a (AI auto-cds) |
94 | | -/opsx-apply feature-a # → background: cd .worktrees/feature-a/ code, commit |
| 54 | +# Work on feature-a |
| 55 | +/opsx-apply feature-a # AI auto-cds into .worktrees/feature-a/ |
95 | 56 | # ... write code ... |
96 | 57 |
|
97 | 58 | # Switch to feature-b (no need to finish feature-a first) |
98 | | -/opsx-apply feature-b # → background: cd .worktrees/feature-b/ code, commit |
| 59 | +/opsx-apply feature-b # AI auto-cds into .worktrees/feature-b/ |
99 | 60 | # ... write code ... |
100 | 61 |
|
101 | 62 | # Finish independently |
102 | | -/opsx-finish feature-a # → background: test → merge → cleanup worktree |
| 63 | +/opsx-finish feature-a # test → merge → cleanup |
103 | 64 | /opsx-finish feature-b |
104 | 65 | ``` |
105 | 66 |
|
106 | | -| Concept | Description | |
107 | | -|---------|-------------| |
108 | | -| One worktree per change | `.worktrees/<name>/` dir + `feature/<name>` branch, fully isolated | |
109 | | -| Named switch | `/opsx-apply <name>`, `/opsx-finish <name>` targets the right worktree | |
110 | | -| Omitting name | Auto-detected from `.worktrees/`; single → use it, multiple → AskUser | |
111 | | -| Transparent directories | AI handles all `cd`, user only types command names | |
112 | | -| Main stays clean | All artifacts and code stay in their worktrees | |
113 | | - |
114 | | -### Browsing worktree content manually |
| 67 | +## Quick Start |
115 | 68 |
|
116 | 69 | ```bash |
117 | | -# List worktree directory |
118 | | -cd .worktrees/<name> |
119 | | -ls -la |
| 70 | +# 1. Install |
| 71 | +npm install -g @moyaspace/openspec-superpowers-opencode |
120 | 72 |
|
121 | | -# View change branch history |
122 | | -git log feature/<name> |
| 73 | +# 2. Init a project |
| 74 | +mkdir my-project && cd my-project |
| 75 | +openspec-superpowers-opencode init |
123 | 76 |
|
124 | | -# Back to project root |
125 | | -cd <project-root> |
| 77 | +# 3. Open in OpenCode, then use the workflow |
| 78 | +/opsx-ff add-user-auth # create change + generate artifacts |
| 79 | +/opsx-apply # AI implements in isolated worktree |
| 80 | +/opsx-finish # test → merge → cleanup |
126 | 81 | ``` |
127 | 82 |
|
128 | | -Usually not needed—editors can browse `.worktrees/<name>/` directly. |
| 83 | +## Features |
| 84 | + |
| 85 | +| # | Feature | One-liner | |
| 86 | +|---|---------|-----------| |
| 87 | +| 1 | **12 OPSX commands** | `/opsx-ff` → `/opsx-apply` → `/opsx-finish` — full change lifecycle | |
| 88 | +| 2 | **Git worktree isolation** | Each change in its own `.worktrees/<name>/` dir + `feature/<name>` branch | |
| 89 | +| 3 | **One-command init** | `oso init` → deploy templates + config + `git init` + first commit | |
| 90 | +| 4 | **Bridged OpenSpec + Superpowers** | Pre-configured schema + skill mapping + lock verification, one-command deploy | |
| 91 | +| 5 | **Greenfield/brownfield** | Auto-deploy on new projects; safe merge on existing ones | |
| 92 | +| 6 | **Cross-platform + i18n** | Windows `setup.ps1` / Linux `setup.sh`, `--lang zh-CN \| zh-TW \| en` | |
| 93 | +| 7 | **SHA-256 lock** | Skill file integrity verified on deploy | |
| 94 | +| 8 | **Layered architecture** | Superpowers (HOW) → OpenSpec (WHAT) → Worktree (WHERE) → Commands (WHEN) | |
129 | 95 |
|
130 | | -## CLI Commands |
| 96 | +> Detailed features → [docs/FEATURES.md](docs/FEATURES.md) |
131 | 97 |
|
132 | | -| Command | Description | |
133 | | -|---------|-------------| |
134 | | -| `openspec-superpowers-opencode init` | Initialize a project | |
135 | | -| `openspec-superpowers-opencode reset` | Revert to uninitialized state (removes all installed files) | |
136 | | -| `openspec-superpowers-opencode dry-run` | Preview changes | |
137 | | -| `openspec-superpowers-opencode ensure-worktree <name>` | Ensure a worktree exists | |
138 | | -| `create-openspec-superpowers-opencode` | Alias, equivalent to init | |
| 98 | +## Documentation |
139 | 99 |
|
140 | | -## Updating Project Templates |
| 100 | +| Doc | Description | |
| 101 | +|-----|-------------| |
| 102 | +| [Quick start](docs/QUICKSTART.md) | 10-minute first change | |
| 103 | +| [How it works](docs/HOW-IT-WORKS.md) | Command execution chain explained | |
| 104 | +| [Worktree creation](docs/WORKTREE-CREATION.md) | Three-layer code-level guarantees | |
| 105 | +| [Design decisions](docs/DESIGN.md) | ADRs: architecture tradeoffs | |
| 106 | +| [Testing](docs/TESTING.md) | 12-phase test suite | |
| 107 | +| [Why oso](docs/WHY-OSO.md) | Deep dive: 6 gaps between OpenSpec and Superpowers | |
141 | 108 |
|
142 | | -`reset + init` does NOT touch Superpowers skill files—those are managed by the Superpowers plugin itself. |
143 | | -`reset + init` only redeploys packaged template files (`AGENTS.md`, `schema.yaml`, `skills.lock.json`, etc.). |
| 109 | +## Prerequisites |
144 | 110 |
|
145 | | -Two types of updates: |
| 111 | +- Node.js >= 16 (recommended) |
| 112 | +- `openspec` CLI v1.3+ |
| 113 | +- `opencode` CLI |
| 114 | +- `git` |
| 115 | +- Superpowers plugin |
146 | 116 |
|
147 | | -| What updates | Action | Notes | |
148 | | -|-------------|--------|-------| |
149 | | -| Superpowers plugin | **Nothing needed** | Skills update themselves, paths usually unchanged | |
150 | | -| This package (new version) | `reset + init` | Redeploy new templates, lock file, config | |
| 117 | +Setup script checks these automatically. |
151 | 118 |
|
152 | | -After a new release: |
| 119 | +## Local Development |
153 | 120 |
|
154 | 121 | ```bash |
155 | | -npm update -g @moyaspace/openspec-superpowers-opencode # upgrade package |
156 | | -openspec-superpowers-opencode reset # remove old config |
157 | | -openspec-superpowers-opencode init # install new templates |
| 122 | +node bin/cli.js init test-project # test locally |
| 123 | +npm publish # publish to npm |
158 | 124 | ``` |
159 | 125 |
|
160 | | -## skills.lock.json |
161 | | - |
162 | | -`skills.lock.json` records SHA-256 hashes of 7 Superpowers skill files for integrity verification. |
163 | | -It ships with this package, locking the **tested-compatible** Superpowers version. |
164 | | - |
165 | | -If Superpowers updates and SHA-256 doesn't match, `init` shows a yellow WARNING. **Non-blocking, workflow unaffected.** |
166 | | - |
167 | | -To clear the WARNING, wait for a new package release with updated hashes. |
168 | | - |
169 | | -## Related Docs |
170 | | - |
171 | | -| Doc | Description | |
172 | | -|-----|-------------| |
173 | | -| [Quick start](docs/QUICKSTART.md) | 10-minute first change: install → init → /opsx-ff → /opsx-apply → /opsx-finish | |
174 | | -| [How it works](docs/HOW-IT-WORKS.md) | Command execution chain from user input to artifact generation | |
175 | | -| [Features](docs/FEATURES.md) | CLI, OPSX commands, worktree isolation, layered architecture | |
176 | | -| [Worktree creation](docs/WORKTREE-CREATION.md) | Three-layer code-level guarantees for isolated worktrees | |
177 | | -| [Design decisions](docs/DESIGN.md) | ADRs: opencode.json location, brownfield-first, no-overwrite policy | |
178 | | -| [Implementation strategy](docs/IMPLEMENTATION-STRATEGY.md) | Deployment gate flow, four-dimension partitioning, mode behaviors | |
179 | | -| [Testing](docs/TEST.md) | 12-phase test suite | |
180 | | -| [Upstream schema reference](docs/UPSTREAM-superpowers-bridge-schema-README.md) | Original superpowers-bridge schema definition | |
181 | | - |
182 | | -## Local Development |
183 | | - |
184 | | -```powershell |
185 | | -# Test |
186 | | -node bin/cli.js init test-project |
| 126 | +--- |
187 | 127 |
|
188 | | -# Publish |
189 | | -npm publish |
190 | | -``` |
| 128 | +**GitHub**: https://github.com/moyaspace/openspec-superpowers-opencode |
| 129 | +**npm**: https://www.npmjs.com/package/@moyaspace/openspec-superpowers-opencode |
| 130 | +**Author**: rl <robincn@gmail.com> |
| 131 | +**License**: MIT |
0 commit comments