@kungfu-tech/buildchain 4.0.1-alpha.4 → 4.0.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/release-tail/README.md +8 -0
- package/architecture/decisions/0002-next-development-transition.md +101 -0
- package/architecture/internal-capabilities.json +117 -8
- package/architecture/maintainability-policy.json +38 -20
- package/architecture/release-tail-contract-inventory.json +5 -2
- package/architecture/v3-core-mechanism-inventory.json +89 -0
- package/architecture/v4-adopter-delivery-parity.json +32 -5
- package/architecture/v4-capability-state-machine-manifest.json +73 -0
- package/architecture/v4-compatibility-facts-parity.json +77 -0
- package/architecture/v4-next-development-parity.json +192 -0
- package/architecture/v4-publication-rehearsal-parity.json +84 -0
- package/architecture/v4-release-train-parity.json +1 -0
- package/architecture/v4-tail-reseal-parity.json +150 -0
- package/bin/buildchain.mjs +23 -2
- package/bin/internal/adopter-delivery-cli.mjs +70 -0
- package/bin/internal/command-registry.mjs +3 -0
- package/bin/internal/compatibility-facts-cli.mjs +101 -0
- package/contracts/fixtures/next-development-transition-v1/anchored-manual-waiting.json +47 -0
- package/contracts/fixtures/next-development-transition-v1/semver-auto-planned.json +47 -0
- package/contracts/fixtures/next-development-transition-v1/version-model-cases.json +40 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/archive-template.json +19 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/bootstrap-positive.json +93 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/gate-positive.json +29 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/gate-unknown-selector.json +26 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/offline-vectors.json +50 -0
- package/contracts/fixtures/v4-compatibility-facts-v1/shared.json +1129 -0
- package/contracts/fixtures/v4-floating-consumer-policy-v1/cases.json +7 -1
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/artifacts/product.bin +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/config/buildchain.toml +5 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/documents/release-activation.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/documents/signed-channel.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/evidence/qualification.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/manifests/candidate.json +5 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/manifests/release-passport.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/capsule.json +707 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/offline-vectors.json +27 -0
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +229 -0
- package/contracts/next-development-request-v1.schema.json +66 -0
- package/contracts/next-development-transition-v1.schema.json +292 -0
- package/contracts/v4-adopter-delivery-v1.schema.json +81 -0
- package/contracts/v4-compatibility-facts-v1.schema.json +230 -0
- package/contracts/v4-publication-rehearsal-capsule-v1.schema.json +233 -0
- package/contracts/v4-tail-reseal-v1.schema.json +276 -0
- package/dist/site/agent-index.json +4 -0
- package/dist/site/artifact-schemas.json +8 -0
- package/dist/site/buildchain-contract.json +1393 -28
- package/dist/site/buildchain-site.json +462 -27
- package/dist/site/capability-registry.json +17 -14
- package/dist/site/cli-registry.json +159 -1
- package/dist/site/kfd-claims.json +429 -15
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +52 -6
- package/dist/site/node-api-registry.json +13972 -9697
- package/dist/site/page-registry.json +428 -17
- package/dist/site/public-surface-audit.json +429 -11
- package/dist/site/publication-authority-registry.json +22 -4
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +21 -0
- package/dist/site/schemas/release-tail-capabilities-v1.schema.json +199 -0
- package/dist/site/schemas/v4-adopter-delivery-v1.schema.json +81 -0
- package/dist/site/schemas/v4-compatibility-facts-v1.schema.json +230 -0
- package/dist/site/schemas/v4-publication-rehearsal-capsule-v1.schema.json +233 -0
- package/dist/site/site-manifest.json +34 -10
- package/dist/site/workflow-registry.json +121 -8
- package/docs/MAP.md +7 -2
- package/docs/cli-reference.md +193 -0
- package/docs/cli.md +8 -0
- package/docs/dev-alpha-candidate-patrol.md +8 -0
- package/docs/next-development-transition.md +118 -0
- package/docs/node-api-reference.md +448 -168
- package/docs/release-tail-provider-plane.md +30 -0
- package/docs/v4-adopter-delivery.md +133 -0
- package/docs/v4-compatibility-facts.md +91 -0
- package/docs/v4-publication-rehearsal.md +130 -0
- package/docs/v4-tail-reseal.md +73 -0
- package/docs/versioning.md +4 -3
- package/package.json +29 -6
- package/packages/core/adopter-delivery-passport.js +259 -0
- package/packages/core/adopter-delivery-vectors.js +158 -0
- package/packages/core/adopter-delivery-vectors.json +77 -0
- package/packages/core/buildchain-agent-manuals.js +3 -0
- package/packages/core/buildchain-compatibility-authority.js +336 -0
- package/packages/core/buildchain-compatibility-fact.js +394 -0
- package/packages/core/buildchain-compatibility-facts.json +217 -0
- package/packages/core/buildchain-compatibility-proof.js +566 -0
- package/packages/core/buildchain-config.js +84 -0
- package/packages/core/buildchain-contract.js +93 -141
- package/packages/core/buildchain-delivery-bootstrap.js +240 -0
- package/packages/core/buildchain-delivery-infrastructure.js +164 -0
- package/packages/core/buildchain-delivery-self-dogfood.js +395 -0
- package/packages/core/channel-candidate.js +8 -0
- package/packages/core/channel-promotion-baseline.js +55 -0
- package/packages/core/dev-alpha-candidate-selection.js +10 -2
- package/packages/core/dev-delivery-execution-transfer.js +21 -1
- package/packages/core/dev-delivery-process-boundary.js +19 -6
- package/packages/core/dev-delivery-provider-heartbeat.js +18 -6
- package/packages/core/kungfu-temporal-fact.js +557 -0
- package/packages/core/legacy-kfd-adopter-driver.js +167 -0
- package/packages/core/next-development-candidate-reservation.js +186 -0
- package/packages/core/next-development-controller.js +728 -0
- package/packages/core/next-development-projection.js +287 -0
- package/packages/core/next-development-transition.js +738 -0
- package/packages/core/paper-agent-entry.js +11 -5
- package/packages/core/paper.js +16 -5
- package/packages/core/published-delivery-authority.js +266 -0
- package/packages/core/release-passport.js +26 -8
- package/packages/core/v4-adopter-delivery-parity.js +3 -3
- package/packages/core/v4-adopter-delivery.js +359 -0
- package/packages/core/v4-canonical-contracts.js +5 -0
- package/packages/core/v4-floating-consumer-policy.js +29 -9
- package/packages/core/v4-publication-rehearsal-capsule.js +468 -0
- package/packages/core/v4-publication-rehearsal-provider-bindings.js +212 -0
- package/packages/core/v4-publication-rehearsal.js +481 -0
- package/packages/core/v4-tail-reseal-contract.js +26 -0
- package/packages/core/v4-tail-reseal-github.js +178 -0
- package/packages/core/v4-tail-reseal-receipt.js +225 -0
- package/packages/core/v4-tail-reseal.js +594 -0
- package/scripts/buildchain-cli-help.mjs +30 -0
- package/scripts/check-inventory.mjs +14 -3
- package/scripts/dev-alpha-candidate-patrol.mjs +22 -1
- package/scripts/dev-delivery-source-proof-replay.mjs +153 -0
- package/scripts/dev-delivery-source-proof-reuse.mjs +13 -97
- package/scripts/generate-next-development-guidance.mjs +49 -0
- package/scripts/generate-release-candidate-passport.mjs +152 -0
- package/scripts/generate-site-bundle.mjs +46 -3
- package/scripts/init-repo.mjs +22 -4
- package/scripts/next-development-self-dogfood-harness.mjs +460 -0
- package/scripts/next-development-self-dogfood.mjs +597 -0
- package/scripts/next-development-transition.mjs +47 -0
- package/scripts/release-tail.mjs +51 -3
- package/scripts/resume-from-candidate-run.mjs +545 -15
- package/scripts/site-capability-metadata.mjs +28 -0
- package/scripts/v4-consumer-policy.mjs +1 -5
- package/scripts/v4-publication-rehearsal-fixture.mjs +144 -0
- package/scripts/v4-tail-reseal-macos-rehearsal.mjs +134 -0
- package/scripts/v4-tail-reseal.mjs +416 -0
|
@@ -13,6 +13,11 @@ export function cliCommandMeta(id) {
|
|
|
13
13
|
const map = new Map(Object.entries({
|
|
14
14
|
audit: { group: "release-passport-trust", purpose: "Inspect read-only publication authority audit commands." },
|
|
15
15
|
architecture: { group: "governance-versioning", purpose: "Inspect and qualify the Buildchain v4 capability and state-machine architecture contract." },
|
|
16
|
+
"adopter-delivery": { group: "reusable-build", purpose: "Run public protocol-neutral adopter delivery, exact readback, N-1 bootstrap, and published archive checks." },
|
|
17
|
+
"adopter-delivery-run": { group: "reusable-build", purpose: "Run one exact public adopter driver and artifact-profile selection offline." },
|
|
18
|
+
"adopter-delivery-verify": { group: "reusable-build", purpose: "Recompute and verify exact adopter delivery readback without authority widening." },
|
|
19
|
+
"adopter-delivery-bootstrap": { group: "reusable-build", purpose: "Qualify exact v3 N-1 bootstrap lineage against the v4 adopter delivery substrate." },
|
|
20
|
+
"adopter-delivery-archive": { group: "reusable-build", purpose: "Load content-addressed public npm archive bytes and verify their exact identity and readback root." },
|
|
16
21
|
"architecture-list": { group: "governance-versioning", purpose: "Generate the Agent-readable capability list from the validated v4 architecture manifest." },
|
|
17
22
|
"architecture-qualify": { group: "governance-versioning", purpose: "Qualify an exact candidate against a distinct N-1 Git authority revision without candidate self-qualification." },
|
|
18
23
|
"architecture-show": { group: "governance-versioning", purpose: "Generate one capability and its state-machine details from the validated v4 architecture manifest." },
|
|
@@ -39,6 +44,10 @@ export function cliCommandMeta(id) {
|
|
|
39
44
|
"explain-artifact": { group: "release-passport-trust", purpose: "Explain artifact evidence for humans or agents." },
|
|
40
45
|
"explain-release": { group: "release-passport-trust", purpose: "Explain a release passport for humans or agents." },
|
|
41
46
|
facts: { group: "observability-diagnostics", purpose: "Inspect build facts command families." },
|
|
47
|
+
"facts-compatibility-project": { group: "governance-versioning", purpose: "Project legacy digest and proof views from the current Cut-bound compatibility Fact registry." },
|
|
48
|
+
"facts-compatibility-query": { group: "governance-versioning", purpose: "Verify one explicit directional compatibility path and emit a rooted receipt." },
|
|
49
|
+
"facts-compatibility-query-template": { group: "governance-versioning", purpose: "Create a direct query template for one current compatibility Fact." },
|
|
50
|
+
"facts-compatibility-verify": { group: "governance-versioning", purpose: "Verify the exact append-only compatibility Fact registry and current Cut." },
|
|
42
51
|
help: { group: "getting-started", purpose: "Print Buildchain CLI help." },
|
|
43
52
|
homebrew: { group: "distribution-indexes", purpose: "Inspect Homebrew distribution-index command families." },
|
|
44
53
|
"homebrew-check": { group: "distribution-indexes", purpose: "Verify Homebrew tap metadata against upstream release passport evidence." },
|
|
@@ -139,6 +148,7 @@ export function cliCommandMeta(id) {
|
|
|
139
148
|
"paper-status": { group: "reusable-build", purpose: "Report explicit evidence for every paper lifecycle state without unsupported inference." },
|
|
140
149
|
"paper-work-start": { group: "getting-started", purpose: "Create a safe Paper work branch from the exact canonical remote development SHA." },
|
|
141
150
|
"paper-work-submit": { group: "governance-versioning", purpose: "Push a Paper work branch without force and open or reuse the correctly targeted development PR." },
|
|
151
|
+
"next-development": { group: "governance-versioning", purpose: "Plan or apply one rooted declared-path next-development version transition without release or ref authority." },
|
|
142
152
|
"publish-source": { group: "release-passport-trust", purpose: "Create, inspect, or verify publish-gate source-lock refs." },
|
|
143
153
|
"publication-artifact": { group: "reusable-build", purpose: "Generate publication artifact manifests, passports, and source bundles for paper/report repositories." },
|
|
144
154
|
"publication-artifact-manifest": { group: "reusable-build", purpose: "Write a site-consumable publication artifact manifest, publication passport, and source bundle." },
|
|
@@ -151,6 +161,7 @@ export function cliCommandMeta(id) {
|
|
|
151
161
|
"release-governance": { group: "governance-versioning", purpose: "Reconcile a managed branch's Buildchain aggregate check to an already-tested pull request SHA." },
|
|
152
162
|
"release-propagation": { group: "site-and-propagation", purpose: "Route exact Paper, KFD, Buildchain, or Core Site updates through one resumable propagation Work." },
|
|
153
163
|
"release-tail": { group: "release-passport-trust", purpose: "Plan, initialize, resume, and verify one declarative provider-owned release-tail transaction." },
|
|
164
|
+
"tail-reseal": { group: "release-passport-trust", purpose: "Plan, admit, byte-verify, and seal one exact retained v4 Alpha candidate signing-finalization tail." },
|
|
154
165
|
"release-transaction": { group: "release-passport-trust", purpose: "Inspect, recover, finalize, or abort durable release transactions." },
|
|
155
166
|
sample: { group: "observability-diagnostics", purpose: "Inspect sampler command families." },
|
|
156
167
|
"sample-process-tree": { group: "observability-diagnostics", purpose: "Sample process-tree diagnostics for a wrapped command." },
|
|
@@ -215,8 +226,24 @@ export function nodeApiMeta(exportName) {
|
|
|
215
226
|
"./release-candidate": { group: "reusable-build", summary: "PR-stage release-candidate artifact, passport, and promote-only resolver APIs." },
|
|
216
227
|
"./v4-floating-consumer-policy": { group: "governance-versioning", summary: "Semantic floating-selector admission, dual-lock receipt, and independent v4 consumer certification APIs." },
|
|
217
228
|
"./v4-runtime-ref-resume-authority": { group: "release-passport-trust", summary: "Transient exact-runtime authorization, persisted-selector rejection, fresh-attempt Stage Capsule reuse, and A+B Passport lineage APIs." },
|
|
229
|
+
"./v4-tail-reseal": { group: "release-passport-trust", summary: "Effect-pure retained Stage Capsule validation and explicit Warrant-, credential-, and release-tail-fenced macOS reseal planning APIs." },
|
|
230
|
+
"./v4-tail-reseal-receipt": { group: "release-passport-trust", summary: "Four-platform byte readback, standard candidate Passport binding, and terminal v4 tail-reseal receipt APIs." },
|
|
231
|
+
"./v4-publication-rehearsal": { group: "release-passport-trust", summary: "Content-addressed v4 publication rehearsal capsules, shared production release-tail execution, replay, provider observation, and fail-closed verification APIs." },
|
|
232
|
+
"./adopter-delivery-gate": { group: "reusable-build", summary: "Protocol-neutral adopter delivery gate, driver interface, artifact profiles, and canonical result APIs." },
|
|
233
|
+
"./kfd-adopter-category-driver": { group: "kfd-trust", summary: "Published KFD adopter-category driver and exact package-cut verification APIs." },
|
|
234
|
+
"./buildchain-delivery-infrastructure": { group: "reusable-build", summary: "Public delivery-infrastructure instance creation and KFD verification APIs." },
|
|
235
|
+
"./buildchain-delivery-bootstrap": { group: "reusable-build", summary: "Protected, published N-1 Buildchain delivery bootstrap qualification APIs." },
|
|
236
|
+
"./buildchain-delivery-self-dogfood": { group: "reusable-build", summary: "Public archive-backed Buildchain delivery-infrastructure self-dogfood APIs." },
|
|
237
|
+
"./published-delivery-authority": { group: "release-passport-trust", summary: "Content-addressed public Buildchain and KFD archive loading and identity verification APIs." },
|
|
238
|
+
"./legacy-kfd-adopter-driver": { group: "kfd-trust", summary: "One-way legacy KFD support-matrix adapter driver APIs." },
|
|
239
|
+
"./adopter-delivery-passport": { group: "release-passport-trust", summary: "Non-authoritative adopter delivery Release Passport binding and substitution checks." },
|
|
240
|
+
"./adopter-delivery-vectors": { group: "reusable-build", summary: "Rooted public adopter delivery conformance vector suite APIs." },
|
|
241
|
+
"./v4-adopter-delivery": { group: "reusable-build", summary: "Public v4 adopter delivery runtime, exact readback, N-1 lineage, and published archive verification APIs." },
|
|
218
242
|
"./release-candidate-recovery": { group: "release-passport-trust", summary: "Fail-closed verification and immutable receipts for reusing a successful sealed candidate run without rebuilding product payloads." },
|
|
219
243
|
"./release-train": { group: "governance-versioning", summary: "Frozen Release Cut identity, rooted Release Train transitions, Dev observations, supersession, replay, and legacy read compatibility APIs." },
|
|
244
|
+
"./next-development-transition": { group: "governance-versioning", summary: "Provider-neutral completed-Alpha preservation and rooted next-development state, version-model, idempotency, and local materialization APIs." },
|
|
245
|
+
"./next-development-controller": { group: "governance-versioning", summary: "Durable completed-Alpha child scheduling, fresh-runner checkpoint resume, latest protected-Dev reconciliation, and exact version-root readback APIs." },
|
|
246
|
+
"./next-development-projection": { group: "governance-versioning", summary: "Canonical generated config, Agent, workflow-header, and manual projections for the next-development transition contract." },
|
|
220
247
|
"./stable-candidate-ledger": { group: "governance-versioning", summary: "Immutable alpha candidate ledger, qualification, revocation, selection, and exact stable source-lock APIs." },
|
|
221
248
|
"./release-propagation": { group: "site-and-propagation", summary: "Release propagation graph, plan, and exact upstream lock APIs." },
|
|
222
249
|
"./release-activation-transaction": { group: "release-passport-trust", summary: "Ordered cross-repository activation, exact receipt-set binding, retry, abort, rollback, and shadow-rehearsal APIs." },
|
|
@@ -225,6 +252,7 @@ export function nodeApiMeta(exportName) {
|
|
|
225
252
|
"./release-tail-compatibility": { group: "release-passport-trust", summary: "Bounded v3 release-hook compatibility diagnostics that reject new executable release-tail inputs." },
|
|
226
253
|
"./release-line-bootstrap": { group: "governance-versioning", summary: "Semver release-line bootstrap planning and version-state APIs." },
|
|
227
254
|
"./buildchain-contract": { group: "governance-versioning", summary: "Runtime contract world and compatibility digest APIs for floating-ref drift checks." },
|
|
255
|
+
"./compatibility-fact-authority": { group: "governance-versioning", summary: "Directional Cut-bound compatibility Fact, lifecycle, explicit path receipt, legacy projection, and Release Passport evidence APIs." },
|
|
228
256
|
"./controller-evidence": { group: "reusable-build", summary: "Project-independent controller descriptors, source/runtime-bound plans, receipts, aggregates, and validation APIs." },
|
|
229
257
|
"./surface-manifest": { group: "site-and-propagation", summary: "Surface manifest timestamp and reproducibility policy APIs." },
|
|
230
258
|
"./issue-reporting": { group: "observability-diagnostics", summary: "Buildchain-owned issue reporting API for workflow friction feedback." },
|
|
@@ -139,10 +139,6 @@ export function certifyCommand(options = {}) {
|
|
|
139
139
|
stableLockPath,
|
|
140
140
|
alphaLockPath,
|
|
141
141
|
});
|
|
142
|
-
const selectedLock =
|
|
143
|
-
receipt?.invocation?.visibleSelector === "v4-alpha"
|
|
144
|
-
? readJson(path.join(callerRoot, alphaLockPath))
|
|
145
|
-
: readJson(path.join(callerRoot, stableLockPath));
|
|
146
142
|
const authorityScan = scanV4FloatingConsumerPolicy({
|
|
147
143
|
root: callerRoot,
|
|
148
144
|
repository,
|
|
@@ -150,7 +146,7 @@ export function certifyCommand(options = {}) {
|
|
|
150
146
|
invokedWorkflow,
|
|
151
147
|
invocationSourcePath: receipt?.invocation?.sourcePath,
|
|
152
148
|
expectedInvocationChannel: receipt?.invocation?.channel,
|
|
153
|
-
resolvedWorkflowSha:
|
|
149
|
+
resolvedWorkflowSha: receipt?.invocation?.resolvedWorkflowSha,
|
|
154
150
|
resolvedRuntimeSha,
|
|
155
151
|
stableLockPath,
|
|
156
152
|
alphaLockPath,
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import crypto from "node:crypto";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
createV4PublicationRehearsalCapsule,
|
|
10
|
+
executeV4PublicationRehearsal,
|
|
11
|
+
} from "../packages/core/v4-publication-rehearsal.js";
|
|
12
|
+
|
|
13
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
14
|
+
const fixtureRoot = path.join(
|
|
15
|
+
root,
|
|
16
|
+
"contracts/fixtures/v4-publication-rehearsal-v1",
|
|
17
|
+
);
|
|
18
|
+
const candidateRoot = path.join(fixtureRoot, "candidate");
|
|
19
|
+
|
|
20
|
+
function digest(bytes) {
|
|
21
|
+
return `sha256:${crypto.createHash("sha256").update(bytes).digest("hex")}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function candidateFiles() {
|
|
25
|
+
const roles = {
|
|
26
|
+
"artifacts/product.bin": "installable-product",
|
|
27
|
+
"config/buildchain.toml": "buildchain-config",
|
|
28
|
+
"documents/release-activation.json": "release-activation-document",
|
|
29
|
+
"documents/signed-channel.json": "signed-channel-document",
|
|
30
|
+
"evidence/qualification.json": "qualification-evidence",
|
|
31
|
+
"manifests/candidate.json": "candidate-manifest",
|
|
32
|
+
"manifests/release-passport.json": "release-passport",
|
|
33
|
+
};
|
|
34
|
+
return Object.keys(roles)
|
|
35
|
+
.map((relative) => {
|
|
36
|
+
const bytes = fs.readFileSync(path.join(candidateRoot, relative));
|
|
37
|
+
return {
|
|
38
|
+
role: roles[relative],
|
|
39
|
+
path: relative,
|
|
40
|
+
size: bytes.length,
|
|
41
|
+
root: digest(bytes),
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
.sort((left, right) =>
|
|
45
|
+
Buffer.from(left.path).compare(Buffer.from(right.path)),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function generated() {
|
|
50
|
+
const declaration = JSON.parse(
|
|
51
|
+
fs.readFileSync(
|
|
52
|
+
path.join(
|
|
53
|
+
root,
|
|
54
|
+
"contracts/fixtures/release-tail-capabilities-v1/kungfu-alpha.json",
|
|
55
|
+
),
|
|
56
|
+
"utf8",
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
const files = candidateFiles();
|
|
60
|
+
const binding = (relative) => ({
|
|
61
|
+
path: relative,
|
|
62
|
+
root: files.find((entry) => entry.path === relative).root,
|
|
63
|
+
});
|
|
64
|
+
const capsule = createV4PublicationRehearsalCapsule({
|
|
65
|
+
source: {
|
|
66
|
+
repository: "kungfu-systems/buildchain",
|
|
67
|
+
revision: "bc12cd0ff18a7e1d918777ea093c169349952d34",
|
|
68
|
+
},
|
|
69
|
+
declaration,
|
|
70
|
+
manifest: binding("manifests/candidate.json"),
|
|
71
|
+
config: binding("config/buildchain.toml"),
|
|
72
|
+
providerBindings: {
|
|
73
|
+
schema: "kungfu.buildchain.release-tail.provider-bindings/v1",
|
|
74
|
+
artifacts: {
|
|
75
|
+
"installable-product": {
|
|
76
|
+
path: "artifacts/product.bin",
|
|
77
|
+
name: "product.bin",
|
|
78
|
+
},
|
|
79
|
+
"release-passport": {
|
|
80
|
+
path: "manifests/release-passport.json",
|
|
81
|
+
name: "release-passport.json",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
documents: {
|
|
85
|
+
"release.activate": {
|
|
86
|
+
path: "documents/release-activation.json",
|
|
87
|
+
method: "PUT",
|
|
88
|
+
},
|
|
89
|
+
"signed-channel.commit": {
|
|
90
|
+
path: "documents/signed-channel.json",
|
|
91
|
+
method: "PUT",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
evidence: {
|
|
95
|
+
inputs: ["evidence/qualification.json"],
|
|
96
|
+
output: "generated/released-evidence.json",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
files,
|
|
100
|
+
});
|
|
101
|
+
const vectors = [];
|
|
102
|
+
for (const platform of ["linux", "macos", "windows"]) {
|
|
103
|
+
const result = await executeV4PublicationRehearsal({
|
|
104
|
+
capsule,
|
|
105
|
+
candidateRoot,
|
|
106
|
+
mode: "simulate",
|
|
107
|
+
});
|
|
108
|
+
vectors.push({
|
|
109
|
+
platform,
|
|
110
|
+
capsuleRoot: result.evidence.capsuleRoot,
|
|
111
|
+
transactionRoot: result.evidence.transactionRoot,
|
|
112
|
+
stateRoot: result.evidence.stateRoot,
|
|
113
|
+
evidenceRoot: result.evidence.evidenceRoot,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
capsule,
|
|
118
|
+
vectors: {
|
|
119
|
+
schema: "buildchain-v4-publication-rehearsal-offline-vectors/v1",
|
|
120
|
+
vectors,
|
|
121
|
+
vectorRoot: digest(JSON.stringify(vectors)),
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const { capsule, vectors } = await generated();
|
|
127
|
+
const outputs = new Map([
|
|
128
|
+
[path.join(fixtureRoot, "capsule.json"), capsule],
|
|
129
|
+
[path.join(fixtureRoot, "offline-vectors.json"), vectors],
|
|
130
|
+
]);
|
|
131
|
+
const check = process.argv.includes("--check");
|
|
132
|
+
for (const [file, value] of outputs) {
|
|
133
|
+
const bytes = `${JSON.stringify(value, null, 2)}\n`;
|
|
134
|
+
if (check) {
|
|
135
|
+
if (!fs.existsSync(file) || fs.readFileSync(file, "utf8") !== bytes)
|
|
136
|
+
throw new Error(`${path.relative(root, file)} is stale`);
|
|
137
|
+
} else {
|
|
138
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
139
|
+
fs.writeFileSync(file, bytes);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
process.stdout.write(
|
|
143
|
+
`${JSON.stringify({ capsuleRoot: capsule.capsuleRoot, vectorRoot: vectors.vectorRoot })}\n`,
|
|
144
|
+
);
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import crypto from "node:crypto";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
|
|
9
|
+
import { v4ContentRoot } from "../packages/core/v4-canonical-contracts.js";
|
|
10
|
+
import { verifyV4TailResealPlatform } from "./v4-tail-reseal.mjs";
|
|
11
|
+
|
|
12
|
+
function flag(args, name, fallback = "") {
|
|
13
|
+
const index = args.indexOf(`--${name}`);
|
|
14
|
+
return index < 0 ? fallback : String(args[index + 1] || "");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function fileRoot(file) {
|
|
18
|
+
return `sha256:${crypto
|
|
19
|
+
.createHash("sha256")
|
|
20
|
+
.update(fs.readFileSync(file))
|
|
21
|
+
.digest("hex")}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function writeCandidate(root, request, content) {
|
|
25
|
+
const platform = request.platforms.find(({ id }) => id === "macos-arm64");
|
|
26
|
+
const payload = path.join(root, "product/release/macos-arm64/payload.bin");
|
|
27
|
+
fs.mkdirSync(path.dirname(payload), { recursive: true });
|
|
28
|
+
fs.writeFileSync(payload, content);
|
|
29
|
+
const relative = path.relative(root, payload);
|
|
30
|
+
const file = {
|
|
31
|
+
path: relative,
|
|
32
|
+
size: fs.statSync(payload).size,
|
|
33
|
+
digest: fileRoot(payload),
|
|
34
|
+
};
|
|
35
|
+
const manifest = {
|
|
36
|
+
contract: "kungfu-buildchain-artifact",
|
|
37
|
+
artifactName: platform.artifactName,
|
|
38
|
+
git: {
|
|
39
|
+
repository: request.repository,
|
|
40
|
+
sha: request.source.sha,
|
|
41
|
+
treeSha: request.source.treeSha,
|
|
42
|
+
runId: String(request.source.runId),
|
|
43
|
+
runAttempt: String(request.source.runAttempt),
|
|
44
|
+
},
|
|
45
|
+
platform: { id: platform.id, name: platform.name },
|
|
46
|
+
files: [
|
|
47
|
+
{
|
|
48
|
+
path: relative,
|
|
49
|
+
size: file.size,
|
|
50
|
+
sha256: file.digest.replace(/^sha256:/u, ""),
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
summary: { fileCount: 1, totalBytes: file.size },
|
|
54
|
+
};
|
|
55
|
+
const manifestPath = path.join(root, "evidence/macos-arm64/manifest.json");
|
|
56
|
+
fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
|
|
57
|
+
fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
58
|
+
return {
|
|
59
|
+
artifactRoot: v4ContentRoot("tail-reseal-artifact-files", [file]),
|
|
60
|
+
manifestRoot: fileRoot(manifestPath),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function rehearseV4TailResealMacos({
|
|
65
|
+
fixturePath = "contracts/fixtures/v4-tail-reseal-v1/valid.json",
|
|
66
|
+
outputPath = "",
|
|
67
|
+
} = {}) {
|
|
68
|
+
const request = JSON.parse(
|
|
69
|
+
fs.readFileSync(path.resolve(fixturePath), "utf8"),
|
|
70
|
+
);
|
|
71
|
+
const workRoot = fs.mkdtempSync(
|
|
72
|
+
path.join(os.tmpdir(), "buildchain-v4-tail-macos-"),
|
|
73
|
+
);
|
|
74
|
+
try {
|
|
75
|
+
const retainedRoots = writeCandidate(workRoot, request, "unsigned");
|
|
76
|
+
const platform = request.platforms.find(({ id }) => id === "macos-arm64");
|
|
77
|
+
Object.assign(platform, retainedRoots);
|
|
78
|
+
const retained = verifyV4TailResealPlatform({
|
|
79
|
+
request,
|
|
80
|
+
platformId: "macos-arm64",
|
|
81
|
+
artifactRoot: workRoot,
|
|
82
|
+
mode: "retained",
|
|
83
|
+
});
|
|
84
|
+
writeCandidate(workRoot, request, "signed-and-notarized");
|
|
85
|
+
const resealed = verifyV4TailResealPlatform({
|
|
86
|
+
request,
|
|
87
|
+
platformId: "macos-arm64",
|
|
88
|
+
artifactRoot: workRoot,
|
|
89
|
+
mode: "resealed",
|
|
90
|
+
providerReadbackRoot: request.signing.providerReadbackRoot,
|
|
91
|
+
});
|
|
92
|
+
const payload = {
|
|
93
|
+
schema: "kungfu-buildchain-v4-tail-reseal-macos-rehearsal/v1",
|
|
94
|
+
platformId: "macos-arm64",
|
|
95
|
+
retained,
|
|
96
|
+
resealed,
|
|
97
|
+
buildStagesExecuted: 0,
|
|
98
|
+
signingFinalizationExecutions: 1,
|
|
99
|
+
providerReadbackRoot: request.signing.providerReadbackRoot,
|
|
100
|
+
};
|
|
101
|
+
const evidence = {
|
|
102
|
+
...payload,
|
|
103
|
+
evidenceRoot: v4ContentRoot("tail-reseal-admission", payload),
|
|
104
|
+
};
|
|
105
|
+
if (outputPath) {
|
|
106
|
+
const output = path.resolve(outputPath);
|
|
107
|
+
fs.mkdirSync(path.dirname(output), { recursive: true });
|
|
108
|
+
fs.writeFileSync(output, `${JSON.stringify(evidence, null, 2)}\n`);
|
|
109
|
+
}
|
|
110
|
+
return evidence;
|
|
111
|
+
} finally {
|
|
112
|
+
fs.rmSync(workRoot, { recursive: true, force: true });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (
|
|
117
|
+
process.argv[1] &&
|
|
118
|
+
import.meta.url === pathToFileURL(process.argv[1]).href
|
|
119
|
+
) {
|
|
120
|
+
try {
|
|
121
|
+
const evidence = rehearseV4TailResealMacos({
|
|
122
|
+
fixturePath: flag(
|
|
123
|
+
process.argv.slice(2),
|
|
124
|
+
"fixture",
|
|
125
|
+
"contracts/fixtures/v4-tail-reseal-v1/valid.json",
|
|
126
|
+
),
|
|
127
|
+
outputPath: flag(process.argv.slice(2), "output"),
|
|
128
|
+
});
|
|
129
|
+
process.stdout.write(`${JSON.stringify(evidence, null, 2)}\n`);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error(`v4-tail-reseal-macos-rehearsal: ${error.message}`);
|
|
132
|
+
process.exitCode = 1;
|
|
133
|
+
}
|
|
134
|
+
}
|