superpowers-manager 0.4.0 → 0.5.1

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 (44) hide show
  1. package/README.md +76 -517
  2. package/dist/artifact-tree.js +111 -0
  3. package/dist/atomic.js +103 -7
  4. package/dist/cli-arguments.js +37 -0
  5. package/dist/cli.js +49 -12
  6. package/dist/commands/install.js +116 -17
  7. package/dist/commands/mutation.js +71 -0
  8. package/dist/commands/prepare.js +23 -17
  9. package/dist/commands/probe.js +164 -14
  10. package/dist/commands/uninstall.js +9 -5
  11. package/dist/commands/update.js +6 -2
  12. package/dist/domain/refs.js +4 -0
  13. package/dist/harness-compatibility.js +13 -0
  14. package/dist/{adapter.js → harnesses/codex/adapter.js} +17 -13
  15. package/dist/harnesses/codex/compatibility.js +126 -0
  16. package/dist/harnesses/codex/conflicts.js +99 -0
  17. package/dist/{generated-plugin.js → harnesses/codex/generated-plugin.js} +7 -73
  18. package/dist/{codex-harness.js → harnesses/codex/harness.js} +55 -5
  19. package/dist/{hooks.js → harnesses/codex/hooks.js} +6 -6
  20. package/dist/{codex-json.js → harnesses/codex/json.js} +9 -2
  21. package/dist/{lifecycle.js → harnesses/codex/lifecycle.js} +2 -2
  22. package/dist/{manifest-overlay.js → harnesses/codex/manifest-overlay.js} +5 -5
  23. package/dist/{codex-prepare.js → harnesses/codex/prepare.js} +72 -16
  24. package/dist/{codex-presentation.js → harnesses/codex/presentation.js} +27 -4
  25. package/dist/{codex-state.js → harnesses/codex/state.js} +3 -3
  26. package/dist/harnesses/pi/compatibility.js +73 -0
  27. package/dist/harnesses/pi/harness.js +63 -0
  28. package/dist/harnesses/pi/install.js +495 -0
  29. package/dist/harnesses/pi/native.js +81 -0
  30. package/dist/harnesses/pi/package.js +153 -0
  31. package/dist/harnesses/pi/paths.js +30 -0
  32. package/dist/harnesses/pi/prepare.js +111 -0
  33. package/dist/harnesses/pi/presentation.js +67 -0
  34. package/dist/harnesses/pi/settings.js +171 -0
  35. package/dist/harnesses/pi/shared-skills.js +413 -0
  36. package/dist/harnesses/pi/state.js +311 -0
  37. package/dist/python-text.js +16 -0
  38. package/dist/resource-lock.js +265 -0
  39. package/dist/safe-path.js +21 -5
  40. package/dist/skill-validation.js +52 -0
  41. package/dist/upstream-workspace.js +8 -0
  42. package/dist/validate-generated-plugin-cli.js +1 -1
  43. package/dist/validator.js +2 -1
  44. package/package.json +12 -8
package/README.md CHANGED
@@ -1,575 +1,134 @@
1
1
  # Superpowers Manager
2
2
 
3
- Install and update the latest stable
4
- [`obra/superpowers`](https://github.com/obra/superpowers) release directly from
5
- upstream, without waiting for agent marketplaces to catch up.
6
- Codex supported today.
3
+ Install [`obra/superpowers`](https://github.com/obra/superpowers) directly from upstream for Codex and the Pi coding agent. Stay on a known-good release or commit, try a branch, and upgrade when you choose—without waiting for a marketplace copy to catch up.
7
4
 
8
- > Unofficial community integration. Not affiliated with the
9
- > `obra/superpowers` maintainers.
5
+ > Unofficial community integration. Not affiliated with the `obra/superpowers` maintainers.
10
6
 
11
- ## Quick start
7
+ ## Choose what you run
12
8
 
13
- ```sh
14
- npx superpowers-manager install
15
- npx superpowers-manager probe
16
- npx superpowers-manager update
17
- ```
18
-
19
- Use Superpowers Manager to follow the latest stable Superpowers release directly
20
- from upstream and apply updates with one command. By default, `install` and
21
- `update` resolve the highest stable `vX.Y.Z` tag when invoked; saved pins and
22
- invocation overrides take precedence. `probe` reports whether your installation
23
- matches that selection without changing Codex state. Updates are user-triggered.
9
+ Start with the latest stable release by default, or choose the upstream version that works for you. There is no background updater.
24
10
 
25
- | Choose | Version source | Best fit |
26
- |---|---|---|
27
- | `superpowers-manager` | Latest stable upstream tag by default, or your saved/overridden selection | Follow upstream stable with drift reporting and verified updates |
28
- | Direct upstream repository | The configured Git ref, or the repository's default branch | Use Codex's native Git marketplace support |
29
- | `superpowers@openai-curated` | The copy distributed in the curated marketplace | Use the curated integration and its refresh policy |
11
+ | What you want | How to choose it |
12
+ |---|---|
13
+ | Stay on a known-good version | `pin` a release tag or full 40-character commit SHA |
14
+ | Try an upstream fix before its release | Set `SUPERPOWERS_REF` to a branch or other resolvable ref for that invocation |
15
+ | Return to the latest stable release | Save `track-latest`, then explicitly install or update |
30
16
 
31
- See [Comparing installation routes](#comparing-installation-routes) for commands
32
- and update behavior. Use one provider at a time; see
33
- [Provider ownership](#provider-ownership) before switching.
34
-
35
- ### Moving from `superpowers-wrapper`
17
+ For example, save a release pin and install it for your agent:
36
18
 
37
19
  ```sh
38
- npx superpowers-wrapper@0.1.1 uninstall
39
- npx superpowers-manager install
20
+ npx superpowers-manager pin v6.1.1
21
+ npx superpowers-manager install --harness codex
40
22
  ```
41
23
 
42
- The manager detects legacy wrapper-owned Codex state and stops before mutation.
43
- It never removes the legacy provider automatically.
24
+ Use `--harness pi` for Pi. The pin is shared by both agents, but each installation changes only when you run its `install` or `update` command. A saved pin keeps subsequent installs and updates on that version unless you change or override the selection.
44
25
 
45
- ## Requirements and platforms
46
-
47
- The installed Superpowers Manager package requires Node >=24. Native source,
48
- tests, and packaging tooling require Node >=24.12.0. Codex is the only supported
49
- integration today. Every other requirement is per command, enforced by
50
- preflight before any dispatch. This table is checked against production by
51
- `tests/bin/readme-requirements.test.ts`; edit it when a command's requirements
52
- change, in the same pull request.
53
-
54
- <!-- requirements:begin -->
55
- | Command | git | Python 3 | Codex CLI |
56
- |---|---|---|---|
57
- | `pin` | yes | no | no |
58
- | `track-latest` | no | no | no |
59
- | `unpin` | no | no | no |
60
- | `prepare` | yes | only with SUPERPOWERS_VALIDATOR | no |
61
- | `probe` | yes | no | yes |
62
- | `install` | yes | no | yes |
63
- | `update` | yes | no | yes |
64
- | `uninstall` | no | no | yes |
65
- <!-- requirements:end -->
66
-
67
- See `docs/baseline/behavioral-inventory.md`'s `CLI-PREFLIGHT-01` for the
68
- behaviour this table describes.
69
-
70
- macOS and Linux are tested. WSL2 is supported. The native Windows path is
71
- untested; the launcher no longer looks for Git Bash at all — every command runs
72
- in-process, so no POSIX shell is discovered or required — but path handling
73
- between MSYS and Codex remains a known risk area.
74
-
75
- Network needs depend on the saved policy. `pin` verifies its target;
76
- `track-latest` and invocation overrides resolve from upstream when applied; and
77
- `prepare`, `install`, and `update` fetch or verify the effective source. A probe
78
- of a saved exact pin can reuse its recorded identity without upstream access.
79
- Updates remain user-triggered; the manager does not run automatic or background
80
- updates.
81
-
82
- ## Comparing installation routes
83
-
84
- ### Getting the latest stable release
85
-
86
- The manager selects the highest stable upstream `vX.Y.Z` tag when its effective
87
- policy is `latest-release`. It does not require the curated marketplace to
88
- publish that release first. Saved pins and environment overrides can select a
89
- different version or source; see [Choosing the upstream version](#choosing-the-upstream-version).
90
-
91
- The direct repository route uses the Git ref you configure. Adding the repository
92
- without `--ref` uses its default branch, which is not a latest-stable release
93
- policy. The curated route uses the
94
- [copy in `openai/plugins`](https://github.com/openai/plugins/tree/main/plugins/superpowers).
95
- Refreshing that snapshot does not independently resolve the latest stable tag
96
- from `obra/superpowers`; curated may match upstream or lag behind it.
97
-
98
- The native CLI examples below were checked against Codex `0.153.3`. Upstream's
99
- [marketplace manifest](https://github.com/obra/superpowers/blob/main/.agents/plugins/marketplace.json)
100
- names its marketplace `superpowers-dev`.
101
-
102
- ### First install
103
-
104
- These are alternative routes; do not run both to install duplicate providers.
105
-
106
- | Step | Superpowers Manager | Direct upstream repository |
107
- |---|---|---|
108
- | 1 | `npx superpowers-manager install` | `codex plugin marketplace add https://github.com/obra/superpowers` |
109
- | 2 | — | `codex plugin add superpowers@superpowers-dev` |
110
-
111
- The manager follows upstream stable by default. For a specific release on the
112
- direct route, choose its tag and add `--ref TAG` to the marketplace-add command.
113
-
114
- ### Staying current
115
-
116
- | Action | Superpowers Manager | Direct upstream repository |
117
- |---|---|---|
118
- | Explicit update | `npx superpowers-manager update` | `codex plugin marketplace upgrade superpowers-dev` |
119
- | Optional inspection | `npx superpowers-manager probe` | `codex plugin list` |
120
-
121
- The manager probes first, skips prepare/install when current and update control
122
- is valid, and verifies the resulting installed state after a refresh. `probe`
123
- reports requested and resolved refs, desired/generated/installed commits, and
124
- status. With a saved pin, "current" means matching that pin, not necessarily
125
- matching the latest upstream release. See [Lifecycle commands](#lifecycle-commands).
126
-
127
- Native marketplace upgrade follows its configured ref. In the checked Codex
128
- version, it can skip unchanged snapshots and refreshes installed plugins when
129
- the marketplace changes; a second `plugin add` is not required for that refresh.
130
- Codex also has an automatic refresh path for configured Git marketplaces.
131
- See the [native upgrade implementation](https://github.com/openai/codex/blob/rust-v0.153.3/codex-rs/core-plugins/src/manager.rs).
132
- `plugin list` shows installed versions; comparing them with upstream stable is
133
- separate inspection work, not a prerequisite for running an update.
134
-
135
- ### Changing the selected version
136
-
137
- Replace `TAG` below with the exact release tag you want. For an already registered
138
- direct marketplace, remove/add is a CLI route to changing its ref:
139
-
140
- | Step | Superpowers Manager | Direct upstream repository |
141
- |---|---|---|
142
- | 1 | `npx superpowers-manager pin TAG` | `codex plugin marketplace remove superpowers-dev` |
143
- | 2 | `npx superpowers-manager update` | `codex plugin marketplace add https://github.com/obra/superpowers --ref TAG` |
144
- | 3 | — | `codex plugin add superpowers@superpowers-dev` |
145
-
146
- The manager's `pin` saves verified intent without changing Codex state; `update`
147
- applies it. To resume following stable releases, run
148
- `npx superpowers-manager track-latest`, then `npx superpowers-manager update`.
149
- The native sequence changes marketplace configuration immediately. In the checked
150
- CLI, `marketplace upgrade` has no `--ref` option, and adding the same marketplace
151
- name with a different ref is rejected. This sequence does not imply that editing
152
- native configuration is impossible.
153
-
154
- ## What it does
155
-
156
- - Resolves an upstream ref, defaulting to the latest stable `vX.Y.Z` release
157
- tag.
158
- - Clones/fetches upstream at that commit and assembles a Codex plugin tree under
159
- `plugins/superpowers/` (skills, assets, license/readme, manifest, and any
160
- hook files that the upstream manifest allows).
161
- - Stamps the generated manifest with a ref-aware manager version ending in
162
- `+manager.<short-sha>` and writes the upstream provenance to
163
- `.superpowers-upstream.json`.
164
- - Validates the generated tree with the manager's shipped contract validator
165
- before swapping it into place (a failed run never destroys a previously
166
- generated tree).
167
- - Registers the `superpowers-manager` marketplace and installs or refreshes
168
- `superpowers@superpowers-manager` in Codex.
169
-
170
- The generated plugin carries upstream skills, assets, documentation, and the
171
- upstream-owned hook policy. When upstream provides a Codex manifest, its
172
- `hooks` declaration is preserved: exact `{}` suppresses the `hooks/` subtree;
173
- active declarations conditionally materialize the upstream hook files; and a
174
- missing `hooks` key or explicit empty array (`[]`) declaration uses Codex's
175
- default discovery only when upstream ships `hooks/hooks.json`. Manifest-less
176
- fallback refs use the committed minimal template and generate neither a manifest
177
- `hooks` key nor a `hooks/` directory.
178
- The manager never creates its own hooks or mutates Codex trust state.
179
-
180
- Review upstream hook command definitions with Codex's `/hooks` flow. Codex
181
- trust applies to a command definition, not to the contents of scripts that the
182
- definition references. An explicit update of an older pin can therefore change
183
- the contents of a trusted referenced script, or reveal a newly untrusted
184
- upstream definition; review it before trusting or running it. This policy
185
- eliminates latent hook-policy drift.
186
-
187
- ## Runtime architecture
188
-
189
- - The in-process TypeScript runtime under `src/` owns lifecycle dispatch,
190
- status, and adapter-result handling;
191
- see the [in-process adapter result contract](https://github.com/j7an/superpowers-manager/blob/main/docs/adapter-result-contract.md).
192
- - Developers extending that runtime should start with the
193
- [internal harness interface](https://github.com/j7an/superpowers-manager/blob/main/docs/harness-interface.md).
194
- - `src/adapter.ts` owns build, inspection, reconciliation, and Codex mutation.
195
- - Codex is the only supported adapter today; no public harness selector ships
196
- yet.
197
-
198
- Validation checks the manager-owned manifest overlay, generated-tree structure,
199
- skill frontmatter envelope, known local paths, and provenance. It deliberately
200
- does not implement a general YAML parser or mirror every Codex ingestion rule;
201
- upstream owns skill semantics and Codex owns its evolving schema.
202
-
203
- `SUPERPOWERS_VALIDATOR=/path/to/validator.py` adds an optional Python validator
204
- after the built-in check. It receives the candidate plugin root as its only
205
- argument. It cannot replace or bypass built-in validation, and either check
206
- failing prevents the tree swap and all Codex mutation.
207
-
208
- `SUPERPOWERS_VALIDATOR_EXECUTABLE=/path/to/validator` adds an optional external
209
- validator after the built-in check. It names an executable, receiving the
210
- candidate plugin root as its only argument. The manager constructs no shell
211
- command string and supplies argv directly. On Linux, `execvp` may hand that
212
- same argv to `/bin/sh` after `ENOEXEC`, and the values are preserved rather
213
- than re-parsed, so a candidate path containing spaces or shell metacharacters
214
- is passed through intact and cannot inject a command — on either platform. A
215
- file with the exec bit set but no valid executable format is handled by the
216
- platform's own `execvp` fallback, not by the manager: on Linux, `/bin/sh` runs
217
- it as shell source; on darwin, it is
218
- rejected outright as not runnable. Give the validator a shebang line or make
219
- it a real binary, or its behavior will differ by platform. Exit 0 accepts;
220
- any nonzero exit rejects and prevents the tree swap. The manager stops
221
- waiting after 30 seconds and keeps at most 64 KiB of each of its output
222
- streams. It cannot replace or bypass built-in validation, and it is not a
223
- security boundary: it runs with the manager's own privileges, by design.
224
-
225
- `SUPERPOWERS_VALIDATOR` is deprecated in favor of `SUPERPOWERS_VALIDATOR_EXECUTABLE`
226
- and continues to work unchanged. The legacy variable requires `python3`; the
227
- executable hook does not. Setting both is rejected at preflight, before any
228
- network or Codex access, rather than silently resolved. Removal of the legacy
229
- variable is deferred to a future major release.
230
-
231
- The in-process install command keeps harness-specific validation in the Codex
232
- adapter: phase 1 prepares the exact candidate first, then the adapter performs
233
- its Codex and refresh-mode preflight before any Codex mutation. The CLI runs
234
- its Codex preflight before invoking the lifecycle handler.
235
-
236
- ## Provider ownership
237
-
238
- If another `superpowers` provider is installed, remove or disable it yourself
239
- before installing this one. The manager never removes another provider and
240
- mutates only `superpowers@superpowers-manager` and the `superpowers-manager`
241
- marketplace.
242
-
243
- For example, if you intentionally want the manager to take over from the
244
- official provider:
26
+ To try a branch, replace `feature/foo` with an existing upstream branch:
245
27
 
246
28
  ```sh
247
- codex plugin remove superpowers@openai-curated
248
- npx superpowers-manager install
29
+ SUPERPOWERS_REF=feature/foo npx superpowers-manager install --harness codex
249
30
  ```
250
31
 
251
- Manager install, update, and uninstall commands inspect both current and legacy
252
- identities and fail closed when Codex state cannot be read or parsed. If legacy
253
- `superpowers-wrapper` state remains, use the migration commands above; the
254
- manager will not remove it for you.
255
-
256
- ## Lifecycle commands
257
-
258
- | Command | Codex side effects | Purpose |
259
- |---|---|---|
260
- | `npx superpowers-manager pin REF` | None | Resolve and save an exact upstream release tag or full commit |
261
- | `npx superpowers-manager track-latest` | None | Save a policy that resolves the latest stable release when applied |
262
- | `npx superpowers-manager unpin` | None | Remove saved selection and return to the packaged fallback policy |
263
- | `npx superpowers-manager prepare` | None | Resolve upstream, build a staged plugin tree, validate it, and replace the generated tree only on success |
264
- | `npx superpowers-manager probe` | None | Report requested and resolved refs, desired/generated/installed commits, identity state, and status |
265
- | `npx superpowers-manager install` | Marketplace and plugin state | Prepare and validate, register the marketplace, install the plugin, and verify installed state |
266
- | `npx superpowers-manager update` | Marketplace and plugin state when stale | Probe, prepare and/or install as needed, then verify the refresh |
267
- | `npx superpowers-manager uninstall` | Marketplace and plugin state | Remove only manager-owned Codex state and verify removal |
268
-
269
- Calling `npx superpowers-manager` without a subcommand is equivalent to
270
- `update`. `probe` is read-only. Install and update stop before prepare or Codex
271
- mutation when legacy state is present. Uninstall removes only manager-owned
272
- state and reports any legacy residue without modifying it. These commands fail
273
- closed when required state cannot be inspected and refuse to report success
274
- when resulting manager state cannot be verified.
275
-
276
- ## Choosing the upstream version
32
+ This override applies only to that command and leaves your saved selection unchanged; the installed version remains until you explicitly change it. Branches can move. Persistent `pin` accepts exact version tags (including prereleases) and full commit SHAs.
277
33
 
278
- Save a tag pin, commit pin, or explicit latest-stable policy for future
279
- invocations:
34
+ When you are ready to return to the latest stable release:
280
35
 
281
36
  ```sh
282
- npx superpowers-manager pin v6.1.1
283
- npx superpowers-manager pin 0123456789abcdef0123456789abcdef01234567 # replace with a real upstream commit
284
37
  npx superpowers-manager track-latest
285
- npx superpowers-manager unpin
38
+ npx superpowers-manager update --harness codex
286
39
  ```
287
40
 
288
- The selection commands save intent only; they do not prepare generated content
289
- or change Codex state. Run `npx superpowers-manager install` for a first
290
- installation or `npx superpowers-manager update` to apply the saved policy to
291
- an existing installation. There is no background updater: selection changes
292
- take effect only through a user-triggered `prepare`, `install`, or `update`.
293
-
294
- `pin` accepts only an exact `vMAJOR.MINOR.PATCH` tag (optionally with a SemVer
295
- prerelease suffix) or a full 40-character commit. It resolves and verifies the
296
- target before saving both the exact commit identity and its source. The saved
297
- identity is the contract, not the contents of a clone cache: clearing or moving
298
- `SUPERPOWERS_CACHE_DIR` does not change the selection. `track-latest` saves the
299
- source and resolves the highest stable `vX.Y.Z` tag each time the policy is
300
- applied. `unpin` removes only the saved selection and restores the packaged
301
- `config/upstream-ref` fallback, currently `latest-release`.
302
-
303
- The user-wide selection file is `selection.json` under the first configured
304
- location:
305
-
306
- 1. `$SUPERPOWERS_CONFIG_DIR`
307
- 2. `$XDG_CONFIG_HOME/superpowers-manager`
308
- 3. `$HOME/.config/superpowers-manager`
41
+ See [version selection](https://github.com/j7an/superpowers-manager/blob/main/docs/usage.md#choosing-a-source) for source overrides, precedence, and `unpin`.
309
42
 
310
- Each location must be absolute. The ref and source precedence chains are
311
- independent:
43
+ ## Start with your agent
312
44
 
313
- - Ref: `SUPERPOWERS_REF`, then saved selection, then `config/upstream-ref`.
314
- - Source: `SUPERPOWERS_UPSTREAM_URL`, then saved source, then the official
315
- `https://github.com/obra/superpowers` source.
45
+ The two harnesses share upstream selection, while each has independent prepared and installed state. Omitting `--harness` selects Codex.
316
46
 
317
- `SUPERPOWERS_REF` is an invocation-only override and is not persisted. Unlike
318
- an exact saved pin, it accepts stable tags, full commit SHAs, branches, and
319
- other resolvable upstream refs for that invocation:
47
+ ### Codex
320
48
 
321
49
  ```sh
322
- SUPERPOWERS_REF=feature/foo npx superpowers-manager probe
50
+ npx superpowers-manager install --harness codex
51
+ npx superpowers-manager probe --harness codex
52
+ npx superpowers-manager update --harness codex
323
53
  ```
324
54
 
325
- `pin` and `track-latest` bind the current `SUPERPOWERS_UPSTREAM_URL`, or the
326
- official source when that variable is unset, to the saved intent. An invocation
327
- may override only the ref or only the source; `probe` exposes
328
- `selection_origin`, `selection_mode`, `upstream_source_origin`,
329
- `effective_source`, the saved-selection fields, and a mixed-origin warning in
330
- human output so that combination remains visible.
331
-
332
- A saved exact pin lets `probe` determine the desired upstream identity without
333
- contacting Git, even when the saved source is temporarily unavailable. This is
334
- not a general offline installation promise: `pin` verifies the requested
335
- target, `track-latest` must resolve when applied, and `prepare`/`install`/`update`
336
- must fetch or verify content from the effective source. Codex inspection is
337
- still required for lifecycle status.
338
-
339
- HTTP(S) upstream URLs containing userinfo are now rejected, including
340
- token-only userinfo. This is an intentional compatibility break: use a Git
341
- credential helper for HTTP(S) authentication or an SSH source instead of
342
- embedding credentials in the URL.
343
-
344
- Saved selection does not claim or transfer provider ownership. The manager
345
- continues to mutate only `superpowers@superpowers-manager` and never removes or
346
- updates the official provider or any other provider automatically.
347
-
348
- ## How versioning works
349
-
350
- - **Upstream manifest first:** when upstream provides
351
- `.codex-plugin/plugin.json`, `prepare` uses it as the generated manifest base
352
- so future upstream metadata fields, including its hook declaration, are
353
- preserved by default.
354
- - **Fallback template:** `plugins/superpowers/.codex-plugin/plugin.template.json`
355
- is committed as a minimal fallback for older upstream refs that do not ship a
356
- Codex manifest. It carries the placeholder version
357
- `0.0.0+manager.template`, declares no hooks, and produces no `hooks/`
358
- directory.
359
- - **Manager overlay:** `prepare` replaces the version with a ref-aware manager
360
- version and forces `skills` to `./skills/`. Unknown upstream manifest fields,
361
- including `hooks`, remain preserved; the adapter materializes hook files only
362
- according to the upstream declaration.
363
- - Stable tags generate release-looking versions such as
364
- `6.0.3+manager.896224c`; explicit prerelease tags generate versions such as
365
- `6.1.0-beta.1+manager.abc1234`.
366
- - Branch builds deliberately stay below real releases:
367
- `main` generates `0.0.0-main+manager.<short-sha>` and other named refs
368
- generate `0.0.0-ref-<sanitized-ref>+manager.<short-sha>`.
369
- - Raw 40-character commit SHAs generate `0.0.0+manager.<short-sha>`.
370
- - **`.superpowers-upstream.json`** records the authoritative provenance:
371
- `source`, `requested_ref`, `resolved_ref`, `commit`, and the upstream manifest
372
- version. The generated manifest version is for human readability and Codex
373
- package identity; the upstream `commit` is what `probe`/`update` compare
374
- against.
375
-
376
- ## Refresh modes
377
-
378
- `install` and `update` accept `SUPERPOWERS_INSTALL_REFRESH_MODE`:
379
-
380
- - `add-only` (default) — `plugin add` re-reads the local source, which refreshes
381
- a mutated tree. Verified sufficient for local marketplaces.
382
- - `remove-add` — removes the manager's own plugin first, then re-adds it. Use
383
- only if a refresh ever fails to take:
384
-
385
- ```sh
386
- SUPERPOWERS_INSTALL_REFRESH_MODE=remove-add npx superpowers-manager update
387
- ```
388
-
389
- ## pnpm updates
390
-
391
- A weekly Monday workflow (06:00 UTC), also available through manual dispatch,
392
- opens or refreshes a dedicated pull request updating only `package.json`'s
393
- `packageManager` pin. It selects a newer, non-deprecated stable pnpm release
394
- within the pinned major after five days. If the current pin is deprecated,
395
- the shared updater bypasses that waiting period and discloses it in the PR.
396
- Major upgrades remain a manual decision; the lockfile is not updated by this
397
- workflow.
398
-
399
- The caller forwards only `RELEASE_BOT_PRIVATE_KEY` and uses
400
- `vars.RELEASE_BOT_APP_ID` for App-authored PRs that can trigger CI. Keep both
401
- configured. After adopting the caller, verify a manual run's App authentication
402
- and inspect any resulting PR before treating live integration as validated.
403
-
404
- ## Tests
405
-
406
- Install once, run the static gate before submission, and choose the package
407
- script that matches the scope you are iterating on:
55
+ Codex installs the Manager-owned marketplace plugin after preparation and
56
+ validation. Review upstream hook definitions with Codex's `/hooks` flow before
57
+ trusting or running them; updates can change a referenced script or surface a
58
+ new definition. The manager neither creates hooks nor changes Codex trust state.
59
+ See the [Codex reference](https://github.com/j7an/superpowers-manager/blob/main/docs/codex.md).
408
60
 
409
- ```sh
410
- pnpm install --frozen-lockfile
411
- pnpm run check:static
412
- pnpm test
413
- pnpm run test:unit
414
- pnpm run test:integration
415
- pnpm run test:harness:codex
416
- pnpm run test:acceptance
417
- ```
418
-
419
- The package scripts above are alternative iteration selectors; do not run every
420
- row sequentially as a substitute for acceptance. `pnpm test` runs all shared
421
- suites once, while the unit and integration scripts select one shared group.
422
- `test:harness:codex` runs only the isolated Docker Codex probe. Complete
423
- acceptance is `pnpm run check:static` followed by `pnpm run test:acceptance`
424
- with explicit evidence for the package's minimum Node runtime.
425
-
426
- To compare shared-suite scheduling while iterating, use:
61
+ ### Pi
427
62
 
428
63
  ```sh
429
- sh tests/run.sh --concurrency 1
430
- sh tests/run.sh --concurrency 2
64
+ npx superpowers-manager install --harness pi
65
+ npx superpowers-manager probe --harness pi
66
+ npx superpowers-manager update --harness pi
431
67
  ```
432
68
 
433
- Every normally completed shared run emits both `run-node-suites: complete
434
- status=<status>` and `tests/run.sh: complete failed=<count>`. Either sentinel
435
- may report failure; if either is absent, the run was interrupted and is
436
- incomplete.
69
+ Pi installs a separately validated, Manager-owned frozen snapshot. Restart Pi
70
+ after a successful install, activating update, or removal. See the
71
+ [Pi reference](https://github.com/j7an/superpowers-manager/blob/main/docs/pi.md)
72
+ for compatibility, experimental opt-in, and recovery behavior.
437
73
 
438
- Use a Homebrew-managed local pnpm by command name; do not use Corepack.
439
- `check:static` checks formatting, lints, and typechecks production and tests without
440
- emitting JavaScript. Run the maintained CLI directly with `node src/cli.ts`.
441
- Tests and their subprocesses execute TypeScript against `src/` with no checkout
442
- build. Future production coverage covers `src/`, including `src/cli.ts`; emitted
443
- distribution files, tests, and packaging tools are outside that source scope.
444
- No coverage collection is enabled by this migration.
74
+ To remove a Manager-owned installation, choose one harness explicitly:
445
75
 
446
- On macOS, reuse an existing exact package-minimum Node executable when one is
447
- already available:
76
+ ### Uninstall Codex
448
77
 
449
78
  ```sh
450
- export SPW_PACKAGE_NODE=/absolute/path/to/node-v24.0.0
451
- export SPW_PACKAGE_NODE_VERSION=24.0.0
452
- test "$("$SPW_PACKAGE_NODE" -p 'process.versions.node')" = "$SPW_PACKAGE_NODE_VERSION"
79
+ npx superpowers-manager uninstall --harness codex
453
80
  ```
454
81
 
455
- Otherwise, run this prerequisite setup from the worktree while a supported
456
- native Node remains on `PATH`. It downloads an official Node archive into a
457
- new temporary directory and verifies the selected checksum before extraction:
82
+ ### Uninstall Pi
458
83
 
459
84
  ```sh
460
- spw_runtime_dir=$(mktemp -d)
461
- SPW_PACKAGE_NODE_VERSION=$(node -p 'const e=require("./package.json").engines.node; const m=/^>=(\d+)$/.exec(e); if(!m) throw Error("unsupported engines.node"); `${m[1]}.0.0`')
462
- case "$(uname -m)" in
463
- arm64) spw_node_arch=arm64 ;;
464
- x86_64) spw_node_arch=x64 ;;
465
- *) echo "unsupported macOS architecture" >&2; exit 1 ;;
466
- esac
467
- spw_node_archive="node-v${SPW_PACKAGE_NODE_VERSION}-darwin-${spw_node_arch}.tar.gz"
468
- (
469
- set -eu
470
- cd "$spw_runtime_dir"
471
- curl --fail --location --remote-name "https://nodejs.org/dist/v${SPW_PACKAGE_NODE_VERSION}/${spw_node_archive}"
472
- curl --fail --location --remote-name "https://nodejs.org/dist/v${SPW_PACKAGE_NODE_VERSION}/SHASUMS256.txt"
473
- rg -F " ${spw_node_archive}" SHASUMS256.txt > selected-sha256.txt
474
- test "$(wc -l < selected-sha256.txt)" -eq 1
475
- read -r spw_node_sha spw_selected_archive < selected-sha256.txt
476
- test "$spw_selected_archive" = "$spw_node_archive"
477
- shasum -a 256 -c selected-sha256.txt
478
- tar -xzf "$spw_node_archive"
479
- ) || exit 1
480
- SPW_PACKAGE_NODE="$spw_runtime_dir/node-v${SPW_PACKAGE_NODE_VERSION}-darwin-${spw_node_arch}/bin/node"
481
- export SPW_PACKAGE_NODE SPW_PACKAGE_NODE_VERSION
85
+ npx superpowers-manager uninstall --harness pi
482
86
  ```
483
87
 
484
- The native runtime on `PATH` remains unchanged. With the package runtime
485
- variables exported, complete acceptance is:
486
-
487
- ```sh
488
- pnpm install --frozen-lockfile
489
- pnpm run check:static
490
- pnpm run test:acceptance
491
- ```
88
+ The manager never removes another Superpowers provider. See the [ownership guidance](https://github.com/j7an/superpowers-manager/blob/main/docs/usage.md#provider-ownership) before switching providers.
492
89
 
493
- After the checks, remove only the temporary directory created by this
494
- invocation and clear its variables:
90
+ ## Shared selection and lifecycle
495
91
 
496
- ```sh
497
- rm -rf -- "$spw_runtime_dir"
498
- unset SPW_PACKAGE_NODE SPW_PACKAGE_NODE_VERSION spw_node_arch spw_node_archive spw_runtime_dir
499
- ```
92
+ The [selection commands above](#choose-what-you-run) save shared upstream intent. They do not activate Codex or Pi; run the selected harness's `install` or `update` to apply that choice. `unpin` restores the packaged fallback policy.
500
93
 
501
- Linux CI provisions the exact package runtime with `actions/setup-node`.
502
- Downloads happen only during prerequisite setup, never inside the hermetic test
503
- cases.
94
+ | Command | Purpose |
95
+ |---|---|
96
+ | `prepare` | Build and validate the selected harness's prepared output |
97
+ | `install` | Apply the shared selection to the selected harness |
98
+ | `probe` | Inspect the selected harness without mutation |
99
+ | `update` | Explicitly refresh the selected harness when needed and verify it |
100
+ | `uninstall` | Remove only Manager-owned state from the selected harness |
504
101
 
505
- Packaging compiles only production source into fresh external temporary staging:
102
+ Use `--harness codex` or `--harness pi` with each targeted lifecycle command.
506
103
 
507
- ```sh
508
- node tests/tools/pack.ts --out-dir /absolute/existing/temporary/output
104
+ ```text
105
+ shared selection -> prepare / inspect / activate Codex
106
+ -> prepare / inspect / activate Pi
509
107
  ```
510
108
 
511
- Allocate the existing output directory outside the checkout before running this
512
- command. It returns npm-compatible JSON for one validated tarball and removes its
513
- own staging. Bare checkout `npm pack` always fails with this command's guidance,
514
- even if stale `dist/` exists. Maintained or manager-generated JavaScript must not
515
- remain in the checkout; dependencies and generated upstream plugin content have
516
- separate ownership. This developer command does not authorize publication; follow
517
- `RELEASING.md` for the protected release procedure.
109
+ The [usage reference](https://github.com/j7an/superpowers-manager/blob/main/docs/usage.md) covers version selection, precedence, offline behavior, `prepare`, validators, and every lifecycle command. The harness references cover [Codex registration and hooks](https://github.com/j7an/superpowers-manager/blob/main/docs/codex.md) and [Pi snapshots and recovery](https://github.com/j7an/superpowers-manager/blob/main/docs/pi.md).
518
110
 
519
- Layers 1-3 stay offline and hermetic: they use a fake local upstream repo plus
520
- host-side fixtures, and they perform no mutation of the developer's or runner's
521
- real Codex state.
522
-
523
- Layer 4 is the Docker acceptance path. `pnpm run test:harness:codex` runs the
524
- real Codex offline probe inside an isolated container home with networking
525
- disabled. `pnpm run test:acceptance` composes one host-side shared run with that
526
- probe. The container may mutate its throwaway container-local Codex state, but
527
- it performs no mutation of the developer's or runner's real Codex state.
528
-
529
- Release validation deliberately retains the combined shared-plus-Codex path at
530
- both native endpoints:
111
+ ## Requirements and platforms
531
112
 
532
- ```sh
533
- SPW_NATIVE_NODE_VERSION=24.12.0 sh tests/container.sh
534
- SPW_NATIVE_NODE_VERSION=24 sh tests/container.sh
535
- ```
113
+ The installed package requires Node >=24. Native source, tests, and packaging tooling require Node >=24.12.0. Every other requirement is command-specific and is checked before dispatch. This table is derived from production by `tests/bin/readme-requirements.test.ts`.
536
114
 
537
- The container probe uses Codex's `hooks/list` only as compatibility evidence
538
- for the tested Codex build. It is not a stable Superpowers Manager API.
115
+ <!-- requirements:begin -->
116
+ | Command | git | Python 3 | Codex CLI (default) | Pi CLI (`--harness pi`) |
117
+ |---|---|---|---|---|
118
+ | `pin` | yes | no | no | no |
119
+ | `track-latest` | no | no | no | no |
120
+ | `unpin` | no | no | no | no |
121
+ | `prepare` | yes | only with SUPERPOWERS_VALIDATOR | no | no |
122
+ | `probe` | yes | no | yes | no |
123
+ | `install` | yes | no | yes | yes |
124
+ | `update` | yes | no | yes | yes |
125
+ | `uninstall` | no | no | yes | yes |
126
+ <!-- requirements:end -->
539
127
 
540
- `sh tests/manual/codex-behavior-probe.sh` remains opt-in and covers native-only compatibility residue such as
541
- path/cache and version-precedence behavior against an intentionally real local
542
- Codex install. It is not part of acceptance. GitHub Actions runs two focused
543
- `toolchain` entries and one blocking Codex integration job on pull requests
544
- and pushes to `main`. The Node 24.12.0 toolchain entry checks native source
545
- loading, the suite runner/assertion preload, and package-producer success and
546
- failure. The latest-24 toolchain entry alone runs `pnpm run check:static` and
547
- the full shared suite with package-minimum evidence. The independent `test` job
548
- runs only the Codex offline probe on latest Node 24.x. Release acceptance still
549
- runs the combined shared and Codex paths at both native endpoints, and the
550
- installed npm executable is tested with Node 24.0.0. These runtime selectors
551
- are separate from the Homebrew-managed local commands above.
128
+ macOS and Linux are tested. WSL2 is supported for the established Codex path; Pi in WSL2 and native Windows remain untested. The manager runs in-process and does not require Git Bash. The [Pi reference](https://github.com/j7an/superpowers-manager/blob/main/docs/pi.md#runtime-compatibility) explains its runtime qualification and admission checks.
552
129
 
553
- ## Repository layout
130
+ Native test versions qualify integration mechanisms; they are not runtime allowlists, and an untested runtime is not automatically certified as compatible.
554
131
 
555
- ```
556
- .agents/plugins/marketplace.json # local marketplace definition (tracked)
557
- .github/ # CI, security, dependency, and release workflows (tracked)
558
- config/upstream-ref # packaged upstream fallback policy (tracked)
559
- docs/ # adapter result contract and baseline evidence (tracked)
560
- package.json pnpm-lock.yaml tsconfig.json # package contract and locked toolchain (tracked)
561
- plugins/superpowers/
562
- .codex-plugin/plugin.template.json # fallback manifest template (tracked)
563
- generated plugin tree # prepared from upstream (gitignored)
564
- src/ # in-process TypeScript runtime (tracked)
565
- cli.ts # sole maintained CLI entry, parsing, preflight, dispatch
566
- commands/ # lifecycle and selection command handlers
567
- adapter.ts # Codex integration
568
- tests/ # hermetic suite and manual Codex probe (tracked)
569
- migration-inventory/ # frozen historical evidence
570
- tools/pack.ts # external staging and validated package emission
571
- ```
132
+ ## Contributing
572
133
 
573
- Everything under `plugins/superpowers/` except the fallback manifest template is
574
- generated by `npx superpowers-manager prepare` and ignored by Git; re-run that
575
- command to regenerate it.
134
+ See [the contributor guide](https://github.com/j7an/superpowers-manager/blob/main/CONTRIBUTING.md) for development, testing, packaging, CI, and repository layout. Architecture details live in the [harness interface](https://github.com/j7an/superpowers-manager/blob/main/docs/harness-interface.md) and [adapter result contract](https://github.com/j7an/superpowers-manager/blob/main/docs/adapter-result-contract.md).