borgmcp-shared 0.4.0 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/releasing.md CHANGED
@@ -1,291 +1,126 @@
1
1
  # Publishing `borgmcp-shared`
2
2
 
3
- This repository publishes immutable public releases from a protected GitHub
4
- Actions environment. A release is built once, audited as a tarball, and then
5
- published from that exact tarball. Local publication and publication from an
6
- unreviewed branch are not supported.
7
-
8
- The active release policy is governed by the ratified
9
- `shared-package-consumption` and `npm-publish-sole-operator-approval` decisions.
10
- This document describes the operator procedure; it does not authorize a release.
11
-
12
- ## Permanent Repository Configuration
13
-
14
- Configure these controls before creating a release tag:
15
-
16
- 1. Keep `.github/workflows/publish.yml` as the only npm trusted-publisher
17
- workflow. The workflow uses a GitHub-hosted runner, exact Node and npm
18
- versions, no dependency cache, and only `contents: read` plus
19
- `id-token: write` in the protected publish job. npm is installed with
20
- lifecycle scripts disabled under an isolated `${RUNNER_TEMP}` prefix; only
21
- that prefix's bin directory enters `GITHUB_PATH`. Never update the active
22
- global npm installation from within npm itself.
23
- 2. Create a GitHub environment named `npm-publish`. Require an authorized
24
- approval from the sole operator `TheodorStorm`, allow self-review so that the
25
- sole-operator path remains executable, and prevent administrators from
26
- bypassing its protection rules. Store npm bootstrap credentials only in this
27
- environment. This exact shape is ratified by
28
- `npm-publish-sole-operator-approval`; adding any other reviewer or bypass
29
- actor requires a new decision.
30
- 3. Add an active tag ruleset whose only included ref is
31
- `refs/tags/v*.*.*`. Enable creation, update (without fetch-and-merge),
32
- deletion, and non-fast-forward restrictions. The sole bypass actor is the
33
- release-operator user `TheodorStorm` (GitHub user ID `12745431`), with no
34
- role, administrator, team, application, or deploy-key bypass. Require an
35
- annotated tag; the workflow rejects lightweight tags and tags whose commit is
36
- not on `main`.
37
- 4. Set the environment variable `NPM_EXPECTED_OWNER` to `byteventures`, the npm
38
- maintainer returned by `npm view borgmcp maintainers`. Do not infer this value
39
- from package metadata.
40
- 5. Keep the GitHub repository public when provenance is generated. npm cannot
41
- issue provenance for a public package built from a private GitHub repository,
42
- and the workflow stops if the repository is private.
43
- 6. Protect `refs/heads/main` with an active ruleset and no bypass actors. Require
44
- resolved review threads and the `package (20)` and `package (22)` checks from
45
- GitHub Actions application ID `15368`, with strict status checking. Set the
46
- GitHub approval count to zero and disable stale-review dismissal, code-owner
47
- review, and last-push approval: the separately recorded cube CR, Security,
48
- and Release Quality gates are the human evidence, while a GitHub approval
49
- requirement would be inoperable for the sole repository operator. Allow
50
- merge commits only and protect deletion and non-fast-forward operations. Do
51
- not add a restrictive update rule, which would block normal pull-request
52
- merges without a bypass.
53
- 7. Restrict Actions to selected GitHub-owned actions and require full commit-SHA
54
- pins. Do not allow all verified Marketplace publishers or any custom pattern.
55
- The CI and publish workflows need only `actions/checkout`,
56
- `actions/setup-node`, `actions/upload-artifact`, and
57
- `actions/download-artifact`, each pinned in source. Keep workflow tokens
58
- read-only and prohibit them from approving pull requests.
59
- 8. Enable GitHub private vulnerability reporting, secret scanning, push
60
- protection, and Dependabot security updates unconditionally. Enable secret
61
- validity checks and non-provider pattern detection whenever the organization
62
- plan licenses them. GitHub requires a paid plan with GitHub Secret Protection
63
- for [validity checks](https://docs.github.com/en/code-security/how-tos/secure-your-secrets/customize-leak-detection/enable-validity-checks)
64
- and [non-provider patterns](https://docs.github.com/en/code-security/secret-scanning/using-advanced-secret-scanning-and-push-protection-features/non-provider-patterns/enabling-secret-scanning-for-non-provider-patterns).
65
- The configuration guard accepts those two controls as disabled only while the
66
- live organization plan is exactly `free`; a plan change makes them mandatory.
67
- `SECURITY.md` directs reporters to the private reporting path, so disabled
68
- reporting is always a release-blocking documentation failure.
69
-
70
- The environment approval is the final technical control. Approval must remain
71
- pending while Security reviews the artifact produced by the `verify` job.
72
- GitHub's ephemeral workflow token cannot read every repository-administration
73
- setting checked by `scripts/verify-release-configuration.mjs`. An authorized
74
- operator must run the guard with an administration-capable token before creating
75
- the tag and again immediately before approving the environment:
3
+ This repository publishes immutable public releases through one protected workflow job
4
+ in GitHub Actions. The active `minimal-package-release-assurance` decision replaces the
5
+ former cross-run artifact approval protocol. This runbook describes the current
6
+ operator procedure; it does not authorize a tag or publication.
7
+
8
+ ## Assurance Boundary
9
+
10
+ The release lane has one build, test, package, and publication authority:
11
+ `.github/workflows/publish.yml` on an annotated `v*.*.*` tag. The job:
12
+
13
+ 1. verifies the public repository context, exact package version, annotated tag,
14
+ tag commit, and ancestry on protected `main`;
15
+ 2. installs locked dependencies without lifecycle scripts and runs dependency
16
+ audit, type checks, the full test suite, one clean build, and generated-output
17
+ drift detection;
18
+ 3. creates one local tarball, enforces the packed-artifact policy, and installs
19
+ that tarball into a clean consumer that imports every public export;
20
+ 4. rejects an existing immutable version or a package not owned solely by the
21
+ configured npm owner before any registry mutation;
22
+ 5. publishes that exact local tarball through npm Trusted Publishing with
23
+ provenance; and
24
+ 6. uses bounded registry-propagation retries to compare the published
25
+ `dist.integrity` with the tarball, then installs the exact registry version
26
+ with scripts disabled and runs `npm audit signatures`.
27
+
28
+ npm and GitHub verify the registry signature and publish attestation. The
29
+ repository does not reconstruct DSSE or SLSA statements, transfer approval
30
+ tuples between runs, rebuild in a second job, or place checksum, SBOM, and report
31
+ bundles on the critical publication path. SBOM portability remains covered by
32
+ CI and the repository's dedicated deterministic SBOM tests.
33
+
34
+ ## Permanent Configuration
35
+
36
+ Keep these controls in place:
37
+
38
+ 1. `publish.yml` is the only npm Trusted Publisher workflow for organization
39
+ `Byte-Ventures`, repository `borg-mcp-shared`, and environment `npm-publish`.
40
+ 2. The `npm-publish` environment requires the authorized sole operator
41
+ `TheodorStorm`, permits that operator's self-review, prevents administrator
42
+ bypass, and allows only protected `v*.*.*` tags.
43
+ 3. `NPM_EXPECTED_OWNER` is `byteventures`. It comes from the live npm package
44
+ maintainer record, not package metadata.
45
+ 4. No `NPM_TOKEN`, `NODE_AUTH_TOKEN`, or committed `.npmrc` participates in an
46
+ owned-package release. Authentication is the job's short-lived OIDC exchange.
47
+ 5. The publish job uses a GitHub-hosted runner with only `contents: read` and
48
+ `id-token: write`. Actions are GitHub-owned and pinned to full commit SHAs.
49
+ 6. Protected `main`, the release-tag ruleset, private vulnerability reporting,
50
+ secret scanning, push protection, and dependency security updates remain
51
+ enabled as checked by `scripts/verify-release-configuration.mjs`. Secret
52
+ scanning validity checks and non-provider patterns remain mandatory whenever
53
+ the organization plan licenses them.
54
+
55
+ Before creating a tag and again before approving the environment, an authorized
56
+ operator runs:
76
57
 
77
58
  ```sh
78
59
  GITHUB_TOKEN="$(gh auth token)" node scripts/verify-release-configuration.mjs
79
60
  ```
80
61
 
81
- The token is read from the operator's credential store and must not be written
82
- to the repository, an artifact, or workflow output. Any guard failure blocks the
83
- tag or environment approval.
84
-
85
- Every release and verification-only run must be a first attempt. The workflow
86
- logs `GITHUB_RUN_ID` and `GITHUB_RUN_ATTEMPT`, rejects any attempt other than `1`
87
- before dependency installation, and includes the same values in the uploaded
88
- `RUN_EVIDENCE` file. Never use the Actions rerun controls to advance a failed
89
- immutable tag or proof run.
90
-
91
- Both jobs reject a repository-root `.npmrc` before their first npm command. The
92
- exact npm bootstrap uses isolated runner-temp prefix, user config, and cache
93
- paths, forces `https://registry.npmjs.org`, disables scripts, and verifies both
94
- the installed npm version and registry before adding its bin directory to
95
- `GITHUB_PATH`.
96
-
97
- ## First-Publish Bootstrap
98
-
99
- npm trusted publishing cannot be configured until the unscoped package exists.
100
- The initial `v0.2.0` bootstrap run, `29353763609`, failed during verification
101
- before producing an artifact or reaching publication. The failed `v0.2.0` tag is
102
- immutable and MUST NOT be moved, reused, or rerun. The separately authorized
103
- `v0.2.1` tag run, `29355823822`, also failed verification before dependency
104
- installation or artifact creation because the checkout action replaced its local
105
- annotated-tag ref with the peeled commit. The remote `v0.2.1` tag remains valid
106
- and immutable and MUST NOT be moved, reused, or rerun.
107
-
108
- The first protected-main verification-only proof run, `29356980492`, confirmed
109
- the repaired tag/source trust checks, then failed before artifact upload because
110
- npm 11 interpreted the bare `release/<tarball>` argument as a package/GitHub spec
111
- instead of a local file. It produced no auditable artifact and MUST NOT be rerun.
112
- The workflow now passes generated tarballs to both npm dry-run and publication as
113
- explicit `./release/<tarball>` filesystem paths.
114
-
115
- The next protected-main proof run, `29357632667`, passed every verification gate
116
- against immutable `v0.2.1`, structurally skipped the publish job, and produced an
117
- exact artifact that passed Security audit. This proved the corrected tag,
118
- protected-main, input, artifact, and npm local-file handling without reusing the
119
- tag for publication.
120
-
121
- Under the ratified `borgmcp-shared-recovery-version` decision, `0.2.2` is the
122
- selected recovery version. The source bump does not itself authorize a tag,
123
- environment approval, or publication.
124
-
125
- Run `29360398007` published `borgmcp-shared@0.2.2` from the exact approved
126
- artifact, and the registry integrity and maintainer matched that artifact. The
127
- workflow then failed during immediate postpublish verification when the package
128
- ownership read returned HTTP 404 before registry propagation completed. The run
129
- and `v0.2.2` tag are immutable and MUST NOT be rerun, moved, or reused. Consumer
130
- migration was blocked until provenance and signatures were independently verified
131
- and Security approved the recovery evidence.
132
-
133
- Recover out of band without rerunning the workflow:
134
-
135
- 1. Download artifact `8321897865` from run `29360398007` and recheck its recorded
136
- ZIP digest, `RUN_EVIDENCE`, tarball SHA-512, and artifact verifier report.
137
- 2. With `GITHUB_SHA=508f2dc88658d8e00ff036b7ce6913fcfbef239b` and
138
- `NPM_EXPECTED_OWNER=byteventures`, run
139
- `node scripts/verify-registry-release.mjs postpublish <audited-tarball>`. The
140
- verifier retries only transient HTTP 404 propagation responses. Its production
141
- envelope performs at most 18 reads over approximately three and a half minutes
142
- (1, 2, 4, and 8 second waits, then a 15 second cap). Non-404 failures and
143
- integrity, owner, or provenance mismatches remain immediate terminal failures.
144
- 3. Install exact `borgmcp-shared@0.2.2` from the registry into a clean temporary
145
- prefix with scripts disabled and run `npm audit signatures` against that
146
- prefix.
147
- 4. Record the independent integrity, ownership, signed-provenance, and signature
148
- evidence for a fresh Security verdict before changing any consumer dependency.
149
-
150
- That recovery completed successfully: the registry tarball is byte-identical to
151
- the audited artifact, its sole maintainer is `byteventures`, the signed in-toto
152
- SLSA provenance binds the protected workflow/tag/commit/run, and npm verified one
153
- registry signature plus one publish attestation. Security approved the recovery
154
- evidence. Complete the bootstrap credential and Trusted Publisher cleanup below
155
- before migrating consumers.
156
-
157
- The eventual first publication will use one temporary credential while still
158
- generating provenance from GitHub Actions.
159
-
160
- Before creating the tag, the release operator must verify all of the following:
161
-
162
- - The npm account is the account that owns `borgmcp`, uses authentication-and-
163
- writes 2FA, and has tested, protected recovery methods.
164
- - `borgmcp-shared` is still unclaimed. An `E404` is expected. Any package or
165
- ownership result that differs from the reviewed state is a stop condition.
166
- - Code Review, load-bearing Security Review, and Release Quality approved the
167
- exact commit on `main`.
168
- - The Queen explicitly authorized generating the final release artifact. This
169
- authorization does not by itself approve the later environment deployment.
170
-
171
- Create a short-lived, least-privilege npm publish token under the verified owner
172
- account. Store it as the `NPM_TOKEN` secret in the `npm-publish` environment;
173
- never place it in repository variables, workflow files, shell history,
174
- `package.json`, a committed `.npmrc`, or an issue. Set the protected environment
175
- variable `ALLOW_UNCLAIMED_FIRST_PUBLISH` to `true` only for this bootstrap.
176
-
177
- The `0.2.2` package, lockfile, runbook, and version assertions must pass fresh CR,
178
- Security, and Release Quality gates and merge to protected `main` before the
179
- Coordinator creates its matching annotated tag under
180
- `borgmcp-shared-first-publish-autonomy`. The tag starts the workflow but does not
181
- immediately publish. The unprivileged `verify` job performs the following gates
182
- first:
183
-
184
- - verifies the public repository, annotated tag, exact package version, and
185
- ancestry on `main`;
186
- - installs the lockfile without lifecycle scripts and runs audit, type checks,
187
- all tests, a clean build, and the tracked-`dist` drift check;
188
- - creates one tarball with lifecycle scripts disabled;
189
- - enforces the explicit public file allowlist, legal files, dependency and
190
- lifecycle policy, size limits, and resolvable source maps;
191
- - exercises npm's publish metadata in dry-run mode; and
192
- - installs the exact tarball with scripts disabled in a clean consumer, verifies
193
- its production tree, and imports every reviewed public export; and
194
- - uploads the tarball, verifier report, and SHA-512 checksum for seven days.
195
-
196
- Security must download and audit that exact workflow artifact. After Security
197
- approves the tarball, Release Quality confirms the operator procedure, and the
198
- Queen explicitly authorizes the public flip, an authorized reviewer may approve
199
- the waiting `npm-publish` environment deployment. The publish job downloads and
200
- checksum-verifies the same artifact, repeats the artifact verifier, checks that
201
- `0.2.2` is absent and the name is unclaimed as expected, and publishes only the
202
- downloaded tarball with `--access public --provenance`.
203
-
204
- Immediately after a successful first publish:
205
-
206
- 1. Confirm the workflow's registry-integrity, owner, and SLSA provenance checks
207
- passed before changing any consumer dependency.
208
- 2. Configure npm's trusted publisher for organization `Byte-Ventures`, repository
209
- `borg-mcp-shared`, workflow filename `publish.yml`, environment
210
- `npm-publish`, and the `npm publish` action.
211
- 3. Remove the `NPM_TOKEN` environment secret, revoke the bootstrap token at npm,
212
- and set `ALLOW_UNCLAIMED_FIRST_PUBLISH` to `false`.
213
- 4. Configure npm publishing access to require 2FA and disallow traditional
214
- tokens. Future releases authenticate through short-lived OIDC credentials.
215
- 5. Only then replace consumers' exact Git SHA dependencies with
216
- `borgmcp-shared@^0.2.0` and commit their registry lockfiles.
217
-
218
- ## Later Releases
219
-
220
- ### 0.4.0 Clean-Slate v2 Contract
221
-
222
- The ratified `borgmcp-shared-enrollment-version` decision defined this breaking
223
- retry-safe enrollment and idempotent multi-cube contract. `borgmcp-shared@0.3.0`
224
- is now the published, immutable v1 baseline on the registry, so the clean-slate
225
- v2 contract — credential-free tag preflight included — is versioned as the
226
- still-unpublished `0.4.0` candidate (a breaking change on a `0.x` package bumps
227
- the minor). This source now identifies `0.4.0`. That reviewed version bump
228
- does not authorize creating `v0.4.0` or publishing the package, and the source
229
- branch must not republish `0.3.0`.
230
-
231
- Before a separately authorized `v0.4.0` tag is created:
232
-
233
- 1. The exact `0.4.0` source commit must be merged to protected `main` after Code
234
- Review, Security, and Release Quality approve the package identity, public
235
- API, conformance behavior, generated output, and release documentation.
236
- 2. The package and root lockfile, `SHARED_PACKAGE_VERSION`, the exact protocol
237
- version tag, packed-artifact verifier, and version assertions all identify
238
- `0.4.0` (done in this source bump).
239
- 3. The protected workflow must build one exact tarball and pass its full source,
240
- test, audit, public-export, source-map, install/import, dry-run, lock-derived
241
- CycloneDX SBOM, integrity, and provenance gates. Security must approve that
242
- exact workflow artifact.
243
- 4. The `0.4.0` workflow must generate a CycloneDX SBOM, canonicalize npm's
244
- checkout-derived root display name to the already-verified manifest name,
245
- and validate every component's exact canonical registry tarball URL, single
246
- matching CycloneDX distribution reference, purl, and lock SHA-512 plus the
247
- exact installed dependency graph and zero package runtime dependencies. The
248
- tarball, SBOM, and SBOM validation report must be
249
- checksummed and uploaded together for Security audit.
250
- 5. The tag and publication each require their own explicit authorization. A
251
- source-version approval, merge, or successful verification run grants neither.
252
-
253
- After registry publication and independent integrity/provenance verification,
254
- the first borgmcp client and borgmcp-server releases may replace their temporary
255
- development dependency with the reviewed registry range `^0.4.0`. They must not
256
- ship a Git dependency or fall back to the incompatible published `0.3.0` v1
257
- enrollment response.
258
-
259
- Later releases follow the same source gates, annotated protected tag, exact
260
- tarball audit, Queen authorization, and environment approval. The registry
261
- preflight requires the package to be owned by `NPM_EXPECTED_OWNER` and rejects
262
- an existing target version. It also fails if
263
- `ALLOW_UNCLAIMED_FIRST_PUBLISH` is not `false` or any `NPM_TOKEN` remains;
264
- npm must exchange the workflow's OIDC identity through the configured trusted
265
- publisher.
266
-
267
- ## Stop and Recovery Conditions
268
-
269
- Stop without approving the environment when any of these conditions occurs:
270
-
271
- - the repository is private, the tag is lightweight or unprotected, the tag
272
- does not exactly match `v<package version>`, or its commit is not on `main`;
273
- - the approved commit, tag target, tarball checksum, or audit artifact differs;
274
- - `GITHUB_RUN_ATTEMPT` is not `1`, or run/attempt evidence is missing;
275
- - tests, audit, build, tracked output, artifact policy, legal metadata, or dry
276
- run fails;
277
- - the npm name, expected owner, account 2FA, recovery methods, credential scope,
278
- trusted-publisher configuration, or environment protection cannot be verified;
279
- - the target version already exists, npm returns anything other than the
280
- expected ownership/availability response, or npm/GitHub is degraded; or
281
- - final CR, Security, Release Quality, exact-tarball Security approval, or Queen
282
- authorization is missing.
283
-
284
- npm versions are immutable. Never retry by overwriting any published version,
285
- moving a release tag, force-pushing a branch, or publishing from a local rebuild.
286
- A failed verification before publication requires fixing the source and
287
- beginning again with a new reviewed version/tag plan. If npm accepted the version
288
- but integrity or provenance verification failed, block every consumer migration,
289
- preserve the workflow logs and artifact, and escalate as a release incident. Do not unpublish,
290
- deprecate, or publish a replacement version without a separately reviewed and
291
- authorized recovery decision.
62
+ The token must remain in the operator credential store. Never write it to the
63
+ repository, workflow output, artifact, issue, or shell history.
64
+
65
+ ## Release Procedure
66
+
67
+ 1. Merge the exact version, lockfile, generated output, and release documentation
68
+ to protected `main` after the required exact-SHA Code Review, Security Review,
69
+ and Release Quality gates.
70
+ 2. Verify repository controls with the configuration guard above. Confirm the
71
+ target version does not already exist and `borgmcp-shared` is owned solely by
72
+ `byteventures`.
73
+ 3. Obtain the separately required exact-commit tag authorization. Create and push
74
+ one annotated `v<package-version>` tag at that protected-main commit.
75
+ 4. The tag starts the single publish job and leaves it pending at the protected
76
+ `npm-publish` environment. Do not use workflow rerun controls; every immutable
77
+ tag gets one first attempt.
78
+ 5. Obtain the separately required environment approval, then approve that exact
79
+ pending job. Approval does not permit a local rebuild or alternate artifact.
80
+ 6. Require every job step to pass, including exact registry integrity and
81
+ `npm audit signatures`, before announcing the version or updating consumers.
82
+
83
+ The workflow publishes only `./release/<tarball>`. It never publishes from the
84
+ repository directory, a package name, a URL, a prior workflow artifact, or a
85
+ locally rebuilt replacement.
86
+
87
+ ## Stop And Recovery
88
+
89
+ Stop before publication when source identity, tag ancestry, repository
90
+ visibility, environment protection, expected owner, target-version absence,
91
+ tests, build output, tarball policy, clean-consumer imports, or Trusted Publishing
92
+ configuration cannot be verified.
93
+
94
+ If a first-attempt tag run fails before npm accepts the version, preserve the tag
95
+ and run as immutable evidence. Fix the source and begin a separately reviewed and
96
+ authorized version/tag plan. Never move, reuse, rerun, or force-update the failed
97
+ tag.
98
+
99
+ If npm accepts the version but a bounded integrity or signature check fails, do
100
+ not rerun or republish. Preserve the run, inspect the live registry integrity and
101
+ `npm audit signatures` result, and require an explicit recovery decision before
102
+ consumer adoption. npm versions are immutable; never overwrite, unpublish, or
103
+ silently substitute a replacement.
104
+
105
+ ## Immutable Historical Evidence
106
+
107
+ These records remain evidence, not reusable release inputs:
108
+
109
+ - `v0.2.0` run `29353763609` and `v0.2.1` run `29355823822` failed before
110
+ artifact creation or publication.
111
+ - Protected-main proof runs `29356980492` and `29357632667` diagnosed and then
112
+ verified the earlier tag/source and local-file handling. They are not publish
113
+ artifacts.
114
+ - Run `29360398007` published `borgmcp-shared@0.2.2`; its initial ownership
115
+ readback hit registry propagation. Independent integrity, ownership,
116
+ provenance, and npm signature verification completed before consumer adoption.
117
+ - `v0.4.1` run `29701429995` exposed a non-deterministic cross-platform SBOM
118
+ audit path and was never published.
119
+ - `borgmcp-shared@0.4.2` is accepted as published and verified. Its registry
120
+ integrity matches the audited tarball and npm verifies its signature and
121
+ attestation. Publish run `29729515410` must not be rerun; the failed custom
122
+ postpublish check reconstructed the wrong workflow identity and is the reason
123
+ that machinery was removed.
124
+
125
+ This source now identifies `0.4.3`. Its release requires reviewed source and
126
+ artifact gates plus explicit publication authorization.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "borgmcp-shared",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "Shared protocol, domain, templates, and conformance contracts for Borg MCP implementations.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -68,7 +68,7 @@
68
68
  ],
69
69
  "author": "Byte Ventures IO AB",
70
70
  "license": "Apache-2.0",
71
- "homepage": "https://borgmcp.ai",
71
+ "homepage": "https://github.com/Byte-Ventures/borg-mcp-shared",
72
72
  "repository": {
73
73
  "type": "git",
74
74
  "url": "git+https://github.com/Byte-Ventures/borg-mcp-shared.git"