specpi 0.10.0 → 0.12.0

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 (50) hide show
  1. package/CHANGELOG.md +181 -150
  2. package/LICENSE +21 -21
  3. package/NPM_RELEASE.md +112 -110
  4. package/README.md +233 -155
  5. package/SECURITY.md +86 -85
  6. package/SECURITY_MODEL.md +153 -107
  7. package/THIRD_PARTY.md +75 -61
  8. package/browser-runtime/package-lock.json +86 -86
  9. package/browser-runtime/package.json +15 -15
  10. package/docs/delegation/README.md +264 -0
  11. package/docs/delegation/design-protocol.md +382 -0
  12. package/docs/delegation/design.md +525 -0
  13. package/docs/delegation/evaluation.md +307 -0
  14. package/docs/delegation/protocol.md +271 -0
  15. package/docs/delegation/research.md +216 -0
  16. package/extensions/command-guard/index.ts +118 -33
  17. package/extensions/command-guard/powershell-parser.ps1 +47 -47
  18. package/extensions/delegation/core.mjs +772 -0
  19. package/extensions/delegation/errors.mjs +8 -0
  20. package/extensions/delegation/extension.mjs +475 -0
  21. package/extensions/delegation/index.ts +9 -0
  22. package/extensions/delegation/managed-files.mjs +13 -0
  23. package/extensions/delegation/native.mjs +155 -0
  24. package/extensions/delegation/presentation.mjs +315 -0
  25. package/extensions/delegation/protocol.mjs +296 -0
  26. package/extensions/delegation/provider.mjs +689 -0
  27. package/extensions/delegation/snapshot.mjs +532 -0
  28. package/extensions/delegation/worker.mjs +218 -0
  29. package/extensions/spec.ts +236 -10
  30. package/extensions/tool-wishlist/capabilities.json +114 -114
  31. package/extensions/tool-wishlist/core.mjs +285 -24
  32. package/extensions/tool-wishlist/index.ts +939 -90
  33. package/extensions/tool-wishlist/verification.mjs +810 -0
  34. package/extensions/workflow-controls/challenge.mjs +139 -13
  35. package/extensions/workflow-controls/index.ts +815 -35
  36. package/extensions/workflow-controls/scope.mjs +41 -5
  37. package/extensions/workflow-controls/smoke.mjs +55 -0
  38. package/extensions/workflow-controls/task-contract.mjs +439 -0
  39. package/package.json +100 -98
  40. package/scripts/check-package.mjs +24 -3
  41. package/scripts/check-pi-package.mjs +107 -4
  42. package/scripts/check-syntax.mjs +61 -0
  43. package/scripts/pi-test-harness.mjs +309 -0
  44. package/scripts/specpi.mjs +37 -2
  45. package/site/logo.svg +1 -9
  46. package/skills/specpi-improve/SKILL.md +60 -54
  47. package/specpi +0 -0
  48. package/templates/AGENTS.md +25 -23
  49. package/templates/settings.json +10 -10
  50. package/themes/specpi-spec.json +96 -96
package/NPM_RELEASE.md CHANGED
@@ -1,110 +1,112 @@
1
- # npm Release Runbook
2
-
3
- This runbook is for SpecPi maintainers. Publishing, changing dist-tags, deprecating versions, and changing package ownership are remote operations and require an explicit human decision.
4
-
5
- ## One-time npm setup
6
-
7
- 1. Sign in to the intended npm owner account and enable two-factor authentication and recovery access.
8
- 2. Confirm that the unscoped `specpi` name is available immediately before the first release.
9
- 3. Create a protected GitHub environment named `npm` with required reviewer approval.
10
- 4. Configure npm trusted publishing for `TannerMidd/SpecPi` and `.github/workflows/npm-publish.yml`.
11
- 5. Do not configure a long-lived `NPM_TOKEN` when trusted publishing is available.
12
-
13
- If npm requires an initial interactive publication before a trusted publisher can be attached, validate the release artifact through every gate below. A local interactive npm session cannot issue GitHub's OIDC provenance, while this package requests provenance by default. For this one bootstrap exception only, publish the exact reviewed tarball with 2FA and an explicit override:
14
-
15
- ```bash
16
- npm publish --ignore-scripts --access public --provenance=false ./specpi-<version>.tgz
17
- ```
18
-
19
- Verify the registry bytes and metadata immediately, then configure trusted publishing before any later release. Do not publish a GitHub Release for that same bootstrap version: the release workflow deliberately rejects versions that already exist. Keep the reviewed source tag as its immutable source reference. All later versions use the protected OIDC workflow and provenance.
20
-
21
- ## Prepare a release
22
-
23
- 1. Select a version that has never appeared on npm. npm versions are immutable.
24
- 2. Update `package.json`, `CHANGELOG.md`, `README.md`, `site/index.html`, and `site/wiki/index.html` to the same version.
25
- 3. For a stable release, add a dated changelog heading. Use a prerelease version when the package should not receive the `latest` dist-tag.
26
- 4. Install the pinned development tools without lifecycle scripts or peers:
27
-
28
- ```bash
29
- npm install --ignore-scripts --omit=peer --no-package-lock
30
- ```
31
-
32
- 5. Run the complete repository and package gates:
33
-
34
- ```bash
35
- npm run check
36
- npm run check:pi-package
37
- npm publish --dry-run --ignore-scripts --provenance=false
38
- git diff --check
39
- ```
40
-
41
- Dry runs explicitly disable provenance because local and validation contexts do not have GitHub OIDC; the protected publish job still requires provenance.
42
-
43
- 6. Inspect the final diff and the JSON file manifest emitted by `npm pack --dry-run --json`.
44
- 7. Obtain fresh read-only review of package metadata, installer behavior, workflow permissions, and the packed artifact.
45
- 8. Commit the reviewed release, create the matching `v<version>` tag, and create a GitHub Release only after explicit approval.
46
-
47
- ## Documentation and publication order
48
-
49
- Publication is a post-merge operation. npm versions are immutable, and the protected workflow must run from a reviewed release tag on `main`, so never publish from an unmerged commit: that would leave permanent public bytes whose source might never land.
50
-
51
- `README.md`, `site/index.html`, and `site/wiki/index.html` document both the canonical `npm install --global specpi@latest` route and a version-pinned example, while `.github/workflows/pages.yml` deploys the site on any push to `main` that touches `site/**`. The release merge therefore deploys install instructions for a version that is not yet on the registry, and the site advertises a command that resolves to `E404` until publication completes.
52
-
53
- Keep that window short and bounded:
54
-
55
- 1. Merge the reviewed release to `main`.
56
- 2. Create the `v<version>` tag and GitHub Release immediately, and approve the `npm` environment without delay. For the one bootstrap version described above, publish the reviewed tarball interactively instead and create no GitHub Release.
57
- 3. Wait for the publish job to verify registry version, integrity, dist-tag, and attestation state.
58
- 4. Complete the registry smoke check below, then confirm the deployed site and announce the release.
59
-
60
- If publication cannot complete, revert the release merge on `main` so the site stops advertising an unavailable version, and restart from a new version rather than reusing the failed one.
61
-
62
- ## Automated publication
63
-
64
- Publishing the GitHub Release starts `.github/workflows/npm-publish.yml`.
65
-
66
- All three jobs pin npm 11.19.1, above npm's 11.5.1 trusted-publishing minimum, on Node.js 22.19.0 and GitHub-hosted runners.
67
-
68
- The build job checks tag, package version, changelog entry, and registry immutability, then creates and checksums one tarball before installing repository development tools. It stores that immutable candidate for seven days.
69
-
70
- The validation job runs as an Ubuntu, Windows, and macOS matrix. Every runner downloads and verifies the same candidate, exercises that exact tarball through the npm and native Pi package lifecycles, and runs an npm publish dry-run; Ubuntu also runs the full repository checks.
71
-
72
- The publish job requires approval in the `npm` environment. Publication runs are serialized, and every candidate must advance its existing dist-tag. The job downloads and verifies the same immutable candidate, publishes through GitHub OIDC with npm provenance, uses `next` for prereleases and `latest` for stable versions, and reads the registry back until version, integrity, dist-tag, and attestation state match.
73
-
74
- ## Registry smoke check
75
-
76
- After publication, install from the registry into disposable state rather than reusing the local tarball:
77
-
78
- ```bash
79
- npm install --global specpi@<version>
80
- specpi plan
81
- ```
82
-
83
- Then complete one isolated install, doctor, and uninstall lifecycle before announcing the release. Verify the npm package page, README images, license, repository links, provenance, and dist-tag.
84
-
85
- ## Update and uninstall contract
86
-
87
- Updating the npm CLI and managed SpecPi state are separate operations:
88
-
89
- ```bash
90
- npm install --global specpi@latest
91
- specpi update
92
- specpi doctor
93
- ```
94
-
95
- Remove managed resources before removing the CLI:
96
-
97
- ```bash
98
- specpi uninstall
99
- npm uninstall --global specpi
100
- ```
101
-
102
- Private wishlist, journal, experiment, and patch state survives managed uninstall unless explicitly removed.
103
-
104
- ## Failure policy
105
-
106
- Before publication, stop and fix any failed gate without changing npm.
107
-
108
- After publication, never attempt to replace a version with different bytes. Verify the defect from the registry artifact, deprecate the affected version when warranted, publish a corrected patch after all gates pass, and change a dist-tag only through an explicit reviewed operation. Use unpublish only when npm policy, legal requirements, or credential exposure makes it necessary.
109
-
110
- If a publishing credential is exposed, revoke it, stop active workflows, inspect npm ownership and dist-tag history, follow the private security-reporting process, and rotate related credentials before resuming.
1
+ # npm Release Runbook
2
+
3
+ This runbook is for SpecPi maintainers. Publishing, changing dist-tags, deprecating versions, and changing package ownership are remote operations and require an explicit human decision.
4
+
5
+ ## One-time npm setup
6
+
7
+ 1. Sign in to the intended npm owner account and enable two-factor authentication and recovery access.
8
+ 2. Confirm that the unscoped `specpi` name is available immediately before the first release.
9
+ 3. Create a protected GitHub environment named `npm` with required reviewer approval.
10
+ 4. Configure npm trusted publishing for `TannerMidd/SpecPi` and `.github/workflows/npm-publish.yml`.
11
+ 5. Do not configure a long-lived `NPM_TOKEN` when trusted publishing is available.
12
+
13
+ If npm requires an initial interactive publication before a trusted publisher can be attached, validate the release artifact through every gate below. A local interactive npm session cannot issue GitHub's OIDC provenance, while this package requests provenance by default. For this one bootstrap exception only, publish the exact reviewed tarball with 2FA and an explicit override:
14
+
15
+ ```bash
16
+ npm publish --ignore-scripts --access public --provenance=false ./specpi-<version>.tgz
17
+ ```
18
+
19
+ Verify the registry bytes and metadata immediately, then configure trusted publishing before any later release. Do not publish a GitHub Release for that same bootstrap version: the release workflow deliberately rejects versions that already exist. Keep the reviewed source tag as its immutable source reference. All later versions use the protected OIDC workflow and provenance.
20
+
21
+ ## Prepare a release
22
+
23
+ 1. Select a version that has never appeared on npm. npm versions are immutable.
24
+ 2. Update `package.json`, `CHANGELOG.md`, `README.md`, `site/index.html`, `site/wiki/index.html`, `site/single-agent/index.html`, and the delegation guide to the same version. Keep historical changelog entries intact and remove stale unreleased-status wording.
25
+ 3. For a stable release, add a dated changelog heading. Use a prerelease version when the package should not receive the `latest` dist-tag.
26
+ 4. Install the pinned development tools without lifecycle scripts or peers:
27
+
28
+ ```bash
29
+ npm install --ignore-scripts --omit=peer --no-package-lock
30
+ ```
31
+
32
+ 5. Run the complete repository and package gates:
33
+
34
+ ```bash
35
+ npm run check
36
+ npm run check:pi-package
37
+ npm publish --dry-run --ignore-scripts --provenance=false
38
+ git diff --check
39
+ ```
40
+
41
+ Dry runs explicitly disable provenance because local and validation contexts do not have GitHub OIDC; the protected publish job still requires provenance.
42
+
43
+ 6. Inspect the final diff and the JSON file manifest emitted by `npm pack --dry-run --json`.
44
+ 7. Obtain fresh read-only review of package metadata, installer behavior, workflow permissions, and the packed artifact.
45
+ 8. Commit the reviewed release, create the matching `v<version>` tag, and create a GitHub Release only after explicit approval.
46
+
47
+ ## Documentation and publication order
48
+
49
+ Publication is a post-merge operation. npm versions are immutable, and the protected workflow must run from a reviewed release tag on `main`, so never publish from an unmerged commit: that would leave permanent public bytes whose source might never land.
50
+
51
+ `README.md`, `site/index.html`, and `site/wiki/index.html` document both the canonical `npm install --global specpi@latest` route and a version-pinned example, while `.github/workflows/pages.yml` deploys the site on any push to `main` that touches `site/**`. The release merge therefore deploys install instructions for a version that is not yet on the registry, and the site advertises a command that resolves to `E404` until publication completes.
52
+
53
+ Keep that window short and bounded:
54
+
55
+ 1. Merge the reviewed release to `main`.
56
+ 2. Create the `v<version>` tag and GitHub Release immediately, and approve the `npm` environment without delay. For the one bootstrap version described above, publish the reviewed tarball interactively instead and create no GitHub Release.
57
+ 3. Wait for the publish job to verify registry version, integrity, dist-tag, and attestation state.
58
+ 4. Complete the registry smoke check below, then confirm the deployed site and announce the release.
59
+
60
+ If publication cannot complete, revert the release merge on `main` so the site stops advertising an unavailable version, and restart from a new version rather than reusing the failed one.
61
+
62
+ ## Automated publication
63
+
64
+ Publishing the GitHub Release starts `.github/workflows/npm-publish.yml`.
65
+
66
+ All three jobs pin npm 11.19.1, above npm's 11.5.1 trusted-publishing minimum, on Node.js 22.19.0 and GitHub-hosted runners.
67
+
68
+ The build job checks tag, package version, changelog entry, and registry immutability, then creates and checksums one tarball before installing repository development tools. It stores that immutable candidate for seven days.
69
+
70
+ The validation job runs as an Ubuntu, Windows, and macOS matrix. Every runner downloads and verifies the same candidate, exercises that exact tarball through the npm and native Pi package lifecycles, and runs an npm publish dry-run; Ubuntu also runs the full repository checks.
71
+
72
+ The publish job requires approval in the `npm` environment. Publication runs are serialized, and every candidate must advance its existing dist-tag. The job downloads and verifies the same immutable candidate, publishes through GitHub OIDC with npm provenance, uses `next` for prereleases and `latest` for stable versions, and reads the registry back until version, integrity, dist-tag, and attestation state match.
73
+
74
+ ## Registry smoke check
75
+
76
+ After publication, install from the registry into disposable state rather than reusing the local tarball:
77
+
78
+ ```bash
79
+ npm install --global specpi@<version>
80
+ specpi plan
81
+ ```
82
+
83
+ Then complete one isolated install, doctor, and uninstall lifecycle before announcing the release. Verify the npm package page, README images, license, repository links, provenance, and dist-tag.
84
+
85
+ ## Update and uninstall contract
86
+
87
+ Updating the npm CLI and managed SpecPi state are separate operations:
88
+
89
+ ```bash
90
+ npm install --global specpi@latest
91
+ specpi update
92
+ specpi doctor
93
+ ```
94
+
95
+ Restart Pi after updating managed resources so it loads the new delegation runtime.
96
+
97
+ Remove managed resources before removing the CLI:
98
+
99
+ ```bash
100
+ specpi uninstall
101
+ npm uninstall --global specpi
102
+ ```
103
+
104
+ Private wishlist, journal, experiment, and patch state survives managed uninstall unless explicitly removed.
105
+
106
+ ## Failure policy
107
+
108
+ Before publication, stop and fix any failed gate without changing npm.
109
+
110
+ After publication, never attempt to replace a version with different bytes. Verify the defect from the registry artifact, deprecate the affected version when warranted, publish a corrected patch after all gates pass, and change a dist-tag only through an explicit reviewed operation. Use unpublish only when npm policy, legal requirements, or credential exposure makes it necessary.
111
+
112
+ If a publishing credential is exposed, revoke it, stop active workflows, inspect npm ownership and dist-tag history, follow the private security-reporting process, and rotate related credentials before resuming.