@kungfu-tech/buildchain 4.0.1-alpha.4 → 4.0.1-alpha.41

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 (172) hide show
  1. package/actions/release-tail/README.md +8 -0
  2. package/architecture/ci-lane-change-budget.json +187 -0
  3. package/architecture/decisions/0002-next-development-transition.md +101 -0
  4. package/architecture/internal-capabilities.json +117 -8
  5. package/architecture/maintainability-policy.json +43 -25
  6. package/architecture/release-tail-contract-inventory.json +5 -2
  7. package/architecture/v3-core-mechanism-inventory.json +89 -0
  8. package/architecture/v4-adopter-delivery-parity.json +32 -5
  9. package/architecture/v4-capability-state-machine-manifest.json +73 -0
  10. package/architecture/v4-compatibility-facts-parity.json +77 -0
  11. package/architecture/v4-floating-consumer-policy.json +6 -0
  12. package/architecture/v4-next-development-parity.json +192 -0
  13. package/architecture/v4-publication-rehearsal-parity.json +84 -0
  14. package/architecture/v4-release-train-parity.json +1 -0
  15. package/architecture/v4-tail-reseal-parity.json +150 -0
  16. package/bin/buildchain.mjs +23 -2
  17. package/bin/internal/adopter-delivery-cli.mjs +70 -0
  18. package/bin/internal/command-registry.mjs +3 -0
  19. package/bin/internal/compatibility-facts-cli.mjs +101 -0
  20. package/contracts/fixtures/next-development-transition-v1/anchored-manual-waiting.json +47 -0
  21. package/contracts/fixtures/next-development-transition-v1/semver-auto-planned.json +47 -0
  22. package/contracts/fixtures/next-development-transition-v1/version-model-cases.json +40 -0
  23. package/contracts/fixtures/v4-adopter-delivery-v1/archive-template.json +19 -0
  24. package/contracts/fixtures/v4-adopter-delivery-v1/bootstrap-positive.json +93 -0
  25. package/contracts/fixtures/v4-adopter-delivery-v1/gate-positive.json +29 -0
  26. package/contracts/fixtures/v4-adopter-delivery-v1/gate-unknown-selector.json +26 -0
  27. package/contracts/fixtures/v4-adopter-delivery-v1/offline-vectors.json +50 -0
  28. package/contracts/fixtures/v4-compatibility-facts-v1/shared.json +1129 -0
  29. package/contracts/fixtures/v4-floating-consumer-policy-v1/cases.json +7 -1
  30. package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/artifacts/product.bin +1 -0
  31. package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/config/buildchain.toml +5 -0
  32. package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/documents/release-activation.json +1 -0
  33. package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/documents/signed-channel.json +1 -0
  34. package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/evidence/qualification.json +1 -0
  35. package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/manifests/candidate.json +5 -0
  36. package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/manifests/release-passport.json +1 -0
  37. package/contracts/fixtures/v4-publication-rehearsal-v1/capsule.json +707 -0
  38. package/contracts/fixtures/v4-publication-rehearsal-v1/offline-vectors.json +27 -0
  39. package/contracts/fixtures/v4-tail-reseal-v1/valid.json +229 -0
  40. package/contracts/next-development-request-v1.schema.json +66 -0
  41. package/contracts/next-development-transition-v1.schema.json +292 -0
  42. package/contracts/v4-adopter-delivery-v1.schema.json +81 -0
  43. package/contracts/v4-compatibility-facts-v1.schema.json +230 -0
  44. package/contracts/v4-floating-consumer-policy-receipt-v1.schema.json +4 -2
  45. package/contracts/v4-publication-rehearsal-capsule-v1.schema.json +233 -0
  46. package/contracts/v4-tail-reseal-v1.schema.json +276 -0
  47. package/dist/site/agent-index.json +4 -0
  48. package/dist/site/artifact-schemas.json +8 -0
  49. package/dist/site/buildchain-contract.json +1393 -28
  50. package/dist/site/buildchain-site.json +477 -32
  51. package/dist/site/capability-registry.json +17 -14
  52. package/dist/site/cli-registry.json +159 -1
  53. package/dist/site/kfd-claims.json +455 -15
  54. package/dist/site/kfd-upstream-aggregate.json +1 -1
  55. package/dist/site/manual-registry.json +53 -7
  56. package/dist/site/node-api-registry.json +14008 -9602
  57. package/dist/site/page-registry.json +442 -21
  58. package/dist/site/public-surface-audit.json +440 -11
  59. package/dist/site/publication-authority-registry.json +44 -8
  60. package/dist/site/publication-registry.json +4 -4
  61. package/dist/site/release-provenance.json +22 -0
  62. package/dist/site/schemas/release-tail-capabilities-v1.schema.json +199 -0
  63. package/dist/site/schemas/v4-adopter-delivery-v1.schema.json +81 -0
  64. package/dist/site/schemas/v4-compatibility-facts-v1.schema.json +230 -0
  65. package/dist/site/schemas/v4-publication-rehearsal-capsule-v1.schema.json +233 -0
  66. package/dist/site/site-manifest.json +35 -11
  67. package/dist/site/workflow-registry.json +142 -8
  68. package/docs/MAP.md +7 -2
  69. package/docs/cli-reference.md +193 -0
  70. package/docs/cli.md +8 -0
  71. package/docs/dev-alpha-candidate-patrol.md +8 -0
  72. package/docs/dev-delivery-warrant.md +22 -1
  73. package/docs/next-development-transition.md +118 -0
  74. package/docs/node-api-reference.md +583 -288
  75. package/docs/release-candidate.md +7 -0
  76. package/docs/release-tail-provider-plane.md +30 -0
  77. package/docs/v4-adopter-delivery.md +133 -0
  78. package/docs/v4-compatibility-facts.md +91 -0
  79. package/docs/v4-publication-rehearsal.md +130 -0
  80. package/docs/v4-tail-reseal.md +73 -0
  81. package/docs/versioning.md +4 -3
  82. package/package.json +30 -6
  83. package/packages/core/adopter-delivery-passport.js +259 -0
  84. package/packages/core/adopter-delivery-vectors.js +158 -0
  85. package/packages/core/adopter-delivery-vectors.json +77 -0
  86. package/packages/core/buildchain-agent-manuals.js +3 -0
  87. package/packages/core/buildchain-compatibility-authority.js +336 -0
  88. package/packages/core/buildchain-compatibility-fact.js +394 -0
  89. package/packages/core/buildchain-compatibility-facts.json +217 -0
  90. package/packages/core/buildchain-compatibility-proof.js +566 -0
  91. package/packages/core/buildchain-config.js +84 -0
  92. package/packages/core/buildchain-contract.js +93 -141
  93. package/packages/core/buildchain-delivery-bootstrap.js +240 -0
  94. package/packages/core/buildchain-delivery-infrastructure.js +164 -0
  95. package/packages/core/buildchain-delivery-self-dogfood.js +395 -0
  96. package/packages/core/buildchain-publication-authority.js +1 -0
  97. package/packages/core/channel-candidate.js +8 -0
  98. package/packages/core/channel-promotion-baseline.js +55 -0
  99. package/packages/core/ci-lane-change-budget.js +247 -0
  100. package/packages/core/dev-alpha-candidate-selection.js +10 -2
  101. package/packages/core/dev-delivery-execution-transfer.js +21 -1
  102. package/packages/core/dev-delivery-native-proof.js +43 -27
  103. package/packages/core/dev-delivery-process-boundary.js +19 -6
  104. package/packages/core/dev-delivery-provider-heartbeat.js +18 -6
  105. package/packages/core/dev-delivery-warrant-settlement.js +234 -2
  106. package/packages/core/dev-delivery-warrant-state.js +46 -10
  107. package/packages/core/dev-delivery-warrant.js +16 -3
  108. package/packages/core/github-governance-authority.js +1 -0
  109. package/packages/core/index.js +5 -0
  110. package/packages/core/kungfu-temporal-fact.js +557 -0
  111. package/packages/core/legacy-kfd-adopter-driver.js +167 -0
  112. package/packages/core/next-development-candidate-reservation.js +186 -0
  113. package/packages/core/next-development-controller.js +728 -0
  114. package/packages/core/next-development-projection.js +287 -0
  115. package/packages/core/next-development-transition.js +738 -0
  116. package/packages/core/paper-agent-entry.js +11 -5
  117. package/packages/core/paper.js +16 -5
  118. package/packages/core/published-delivery-authority.js +266 -0
  119. package/packages/core/release-candidate-recovery.js +70 -15
  120. package/packages/core/release-candidate.js +2 -2
  121. package/packages/core/release-passport.js +36 -9
  122. package/packages/core/v4-adopter-delivery-parity.js +3 -3
  123. package/packages/core/v4-adopter-delivery.js +359 -0
  124. package/packages/core/v4-canonical-contracts.js +5 -0
  125. package/packages/core/v4-delivery-warrant-read-candidate.js +10 -3
  126. package/packages/core/v4-floating-consumer-evidence.js +18 -4
  127. package/packages/core/v4-floating-consumer-policy.js +143 -20
  128. package/packages/core/v4-floating-consumer-release-passport.js +35 -8
  129. package/packages/core/v4-publication-rehearsal-capsule.js +468 -0
  130. package/packages/core/v4-publication-rehearsal-provider-bindings.js +212 -0
  131. package/packages/core/v4-publication-rehearsal.js +481 -0
  132. package/packages/core/v4-tail-reseal-contract.js +26 -0
  133. package/packages/core/v4-tail-reseal-github.js +178 -0
  134. package/packages/core/v4-tail-reseal-receipt.js +225 -0
  135. package/packages/core/v4-tail-reseal.js +594 -0
  136. package/packages/core/workflow-yaml-contract.js +24 -2
  137. package/scripts/artifact-signing-controller-core.mjs +1 -1
  138. package/scripts/buildchain-cli-help.mjs +30 -0
  139. package/scripts/check-ci-lane-change-budget.mjs +100 -0
  140. package/scripts/check-inventory.mjs +14 -3
  141. package/scripts/check-project-cut-merge-queue-admission.mjs +87 -0
  142. package/scripts/check-v4-floating-consumer-policy-contract.mjs +23 -4
  143. package/scripts/dev-alpha-candidate-patrol.mjs +22 -1
  144. package/scripts/dev-delivery-source-proof-replay.mjs +153 -0
  145. package/scripts/dev-delivery-source-proof-reuse.mjs +13 -97
  146. package/scripts/dev-delivery-warrant-options.mjs +27 -11
  147. package/scripts/dev-delivery-warrant-store.mjs +10 -6
  148. package/scripts/dev-delivery-warrant.mjs +50 -6
  149. package/scripts/dev-pr-auto-merge.mjs +25 -11
  150. package/scripts/dev-pr-delivery-warrant.mjs +45 -0
  151. package/scripts/dev-pr-prequeue-guard.mjs +0 -18
  152. package/scripts/dev-qualification-patrol.mjs +9 -9
  153. package/scripts/dispatch-artifact-signing-authority.mjs +1 -1
  154. package/scripts/generate-channel-promotion-workflow.mjs +2 -2
  155. package/scripts/generate-next-development-guidance.mjs +49 -0
  156. package/scripts/generate-release-candidate-passport.mjs +152 -0
  157. package/scripts/generate-site-bundle.mjs +46 -3
  158. package/scripts/init-repo.mjs +22 -4
  159. package/scripts/next-development-self-dogfood-harness.mjs +460 -0
  160. package/scripts/next-development-self-dogfood.mjs +597 -0
  161. package/scripts/next-development-transition.mjs +47 -0
  162. package/scripts/project-cut-merge-queue-admission.mjs +394 -0
  163. package/scripts/promotion-channel-router.mjs +4 -4
  164. package/scripts/release-candidate-anchor-provenance.mjs +99 -0
  165. package/scripts/release-tail.mjs +51 -3
  166. package/scripts/resume-from-candidate-run.mjs +595 -65
  167. package/scripts/site-capability-metadata.mjs +29 -0
  168. package/scripts/stable-candidate-qualification.mjs +9 -10
  169. package/scripts/v4-consumer-policy.mjs +5 -5
  170. package/scripts/v4-publication-rehearsal-fixture.mjs +144 -0
  171. package/scripts/v4-tail-reseal-macos-rehearsal.mjs +134 -0
  172. package/scripts/v4-tail-reseal.mjs +416 -0
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { pathToFileURL } from "node:url";
6
+
7
+ import { nextDevelopmentManual } from "../packages/core/next-development-projection.js";
8
+
9
+ export const NEXT_DEVELOPMENT_MANUAL_PATH =
10
+ "docs/next-development-transition.md";
11
+
12
+ export function generateNextDevelopmentGuidance({
13
+ cwd = process.cwd(),
14
+ check = false,
15
+ } = {}) {
16
+ const target = path.resolve(cwd, NEXT_DEVELOPMENT_MANUAL_PATH);
17
+ const expected = nextDevelopmentManual();
18
+ const current = fs.existsSync(target) ? fs.readFileSync(target, "utf8") : "";
19
+ if (check) {
20
+ if (current !== expected) {
21
+ throw new Error(
22
+ `${NEXT_DEVELOPMENT_MANUAL_PATH} drifted from its contract source`,
23
+ );
24
+ }
25
+ return { ok: true, changed: false, path: NEXT_DEVELOPMENT_MANUAL_PATH };
26
+ }
27
+ fs.mkdirSync(path.dirname(target), { recursive: true });
28
+ if (current !== expected) fs.writeFileSync(target, expected);
29
+ return {
30
+ ok: true,
31
+ changed: current !== expected,
32
+ path: NEXT_DEVELOPMENT_MANUAL_PATH,
33
+ };
34
+ }
35
+
36
+ if (
37
+ process.argv[1] &&
38
+ import.meta.url === pathToFileURL(process.argv[1]).href
39
+ ) {
40
+ try {
41
+ const result = generateNextDevelopmentGuidance({
42
+ check: process.argv.includes("--check"),
43
+ });
44
+ process.stdout.write(`${JSON.stringify(result)}\n`);
45
+ } catch (error) {
46
+ process.stderr.write(`next-development guidance: ${error.message}\n`);
47
+ process.exitCode = 1;
48
+ }
49
+ }
@@ -5,11 +5,160 @@ import { execFileSync } from "node:child_process";
5
5
  import { pathToFileURL } from "node:url";
6
6
  import { createReleaseCandidatePassport, validateReleaseCandidatePassport } from "../packages/core/release-candidate.js";
7
7
  import { scanV4FloatingConsumerPolicy, v4ConsumerPolicyScannerRoot } from "../packages/core/v4-floating-consumer-policy.js";
8
+ import { v4ContentRoot } from "../packages/core/v4-canonical-contracts.js";
9
+ import { V4_STAGE_CAPSULE_CONTRACT, V4_STAGE_CAPSULE_IDENTITY_CONTRACT, v4StageCapsuleIdentityRoot, v4StageCapsuleRoot, validateV4StageCapsule } from "../packages/core/v4-stage-capsule.js";
10
+ import { v4RuntimeResumeDocumentRoot } from "../packages/core/v4-runtime-ref-resume-authority.js";
8
11
  import { writeGitHubOutputs } from "./build-contract-core.mjs";
9
12
 
10
13
  const env = (name, fallback = "") => process.env[name] || fallback;
11
14
  const readJsonFile = (filePath) => JSON.parse(fs.readFileSync(filePath, "utf8"));
12
15
 
16
+ export function createReleaseCandidateStageCapsules({
17
+ passport,
18
+ buildSummary,
19
+ coordinates,
20
+ }) {
21
+ if (!passport.consumerPolicy?.receiptRoot) return undefined;
22
+ if (
23
+ coordinates.repository !== passport.repository ||
24
+ String(coordinates.runId) !== String(passport.workflow.runId) ||
25
+ String(coordinates.runAttempt) !== String(passport.workflow.runAttempt) ||
26
+ coordinates.sourceSha !== passport.source.headSha
27
+ ) {
28
+ throw new Error(
29
+ "Stage Capsule coordinate set does not bind the candidate run",
30
+ );
31
+ }
32
+ const coordinateByPlatform = new Map(
33
+ coordinates.artifacts.map((entry) => [entry.platformId, entry]),
34
+ );
35
+ const qualificationRoot = passport.controllerReceipts?.[0]?.receiptDigest;
36
+ const entries = passport.platformMatrix
37
+ .map((platform) => {
38
+ const coordinate = coordinateByPlatform.get(platform.platformId);
39
+ if (!coordinate || coordinate.name !== platform.artifactName) {
40
+ throw new Error(
41
+ `Stage Capsule coordinate missing for ${platform.platformId}`,
42
+ );
43
+ }
44
+ const manifest = readJsonFile(platform.manifestPath);
45
+ const identity = {
46
+ schema: V4_STAGE_CAPSULE_IDENTITY_CONTRACT,
47
+ sourceRoot: v4ContentRoot("candidate-identity", passport.source),
48
+ platform: platform.platformId,
49
+ platformRoot: v4ContentRoot("candidate-identity", manifest.platform),
50
+ stage: "verify",
51
+ toolchainRoots: [],
52
+ runtimeRoot: v4ContentRoot("candidate-identity", {
53
+ sha: passport.buildchain.sha,
54
+ }),
55
+ policyRoot: passport.consumerPolicy.receiptRoot,
56
+ declaredInputs: [
57
+ {
58
+ name: "release-candidate",
59
+ root: `sha256:${passport.candidateHash}`,
60
+ },
61
+ ],
62
+ transformationRoot: v4ContentRoot("candidate-identity", {
63
+ lifecycle: manifest.lifecycle,
64
+ summary: platform.summary,
65
+ }),
66
+ outputManifestRoot: v4ContentRoot(
67
+ "stage-capsule-artifact-manifest",
68
+ { artifact: coordinate, manifest },
69
+ ),
70
+ qualificationRoot,
71
+ observationRoots: [
72
+ {
73
+ name: "provider-coordinate",
74
+ root: v4ContentRoot("provider-readback-sample", coordinate),
75
+ },
76
+ ],
77
+ };
78
+ const capsule = {
79
+ schema: V4_STAGE_CAPSULE_CONTRACT,
80
+ writerAuthority: "typescript-v3",
81
+ rustAuthority: "validation-only",
82
+ identity,
83
+ identityRoot: v4StageCapsuleIdentityRoot(identity),
84
+ retentionPromise: {
85
+ class: "github-artifact",
86
+ retainUntil: coordinate.expiresAt,
87
+ },
88
+ capsuleRoot: `sha256:${"0".repeat(64)}`,
89
+ };
90
+ capsule.capsuleRoot = v4StageCapsuleRoot(capsule);
91
+ validateV4StageCapsule(capsule);
92
+ return {
93
+ platform: platform.platformId,
94
+ artifactName: coordinate.name,
95
+ artifactDigest: coordinate.digest,
96
+ artifact: coordinate,
97
+ capsule,
98
+ };
99
+ })
100
+ .sort((left, right) => left.platform.localeCompare(right.platform));
101
+ const body = {
102
+ schemaVersion: 1,
103
+ contract: "kungfu-buildchain-v4-release-candidate-stage-capsules/v1",
104
+ status: "sealed",
105
+ repository: passport.repository,
106
+ buildAttempt: {
107
+ id: `github-run:${passport.workflow.runId}:attempt:${passport.workflow.runAttempt}`,
108
+ runtimeSha: passport.buildchain.sha,
109
+ },
110
+ source: {
111
+ sha: passport.source.headSha,
112
+ treeSha: passport.source.treeHash,
113
+ },
114
+ consumerPolicyReceiptRoot: passport.consumerPolicy.receiptRoot,
115
+ capsules: entries,
116
+ };
117
+ return { ...body, root: v4RuntimeResumeDocumentRoot(body) };
118
+ }
119
+
120
+ function writeReleaseCandidateStageCapsules({
121
+ passport,
122
+ buildSummary,
123
+ outputPath,
124
+ }) {
125
+ const coordinatesPath = path.resolve(
126
+ env(
127
+ "BUILDCHAIN_ARTIFACT_COORDINATES_PATH",
128
+ ".buildchain/artifacts/artifact-coordinates.json",
129
+ ),
130
+ );
131
+ if (!fs.existsSync(coordinatesPath)) {
132
+ if (passport.consumerPolicy?.receiptRoot) {
133
+ throw new Error(
134
+ "v4 release candidate Stage Capsules require exact artifact coordinates",
135
+ );
136
+ }
137
+ return { path: "", root: "" };
138
+ }
139
+ const stageCapsules = createReleaseCandidateStageCapsules({
140
+ passport,
141
+ buildSummary,
142
+ coordinates: readJsonFile(coordinatesPath),
143
+ });
144
+ if (!stageCapsules) return { path: "", root: "" };
145
+ const stageCapsulesPath = path.join(
146
+ path.dirname(outputPath),
147
+ "release-candidate-stage-capsules.json",
148
+ );
149
+ fs.writeFileSync(
150
+ stageCapsulesPath,
151
+ `${JSON.stringify(stageCapsules, null, 2)}\n`,
152
+ );
153
+ return {
154
+ path: path
155
+ .relative(process.cwd(), stageCapsulesPath)
156
+ .split(path.sep)
157
+ .join("/"),
158
+ root: stageCapsules.root,
159
+ };
160
+ }
161
+
13
162
  export function resolveLegacyConsumerPolicyReceipt(options = {}) {
14
163
  if (options.json) return { receipt: JSON.parse(options.json), receiptRoot: options.receiptRoot };
15
164
  if (options.repository !== "kungfu-systems/buildchain" || options.targetChannel !== "alpha" || options.workflowShellRef !== "v4-alpha" || options.runtimeOverride !== true) return undefined;
@@ -80,6 +229,7 @@ export function generateReleaseCandidatePassportCli() {
80
229
  if (!validation.ok) throw new Error(`release candidate passport invalid: ${validation.errors.join("; ")}`);
81
230
  fs.mkdirSync(path.dirname(outputPath), { recursive: true });
82
231
  fs.writeFileSync(outputPath, `${JSON.stringify(passport, null, 2)}\n`);
232
+ const stageCapsules = writeReleaseCandidateStageCapsules({ passport, buildSummary, outputPath });
83
233
  writeGitHubOutputs({
84
234
  "release-candidate-passport-path": path.relative(process.cwd(), outputPath).split(path.sep).join("/"),
85
235
  "release-candidate-passport-json": JSON.stringify({
@@ -94,6 +244,8 @@ export function generateReleaseCandidatePassportCli() {
94
244
  consumerPolicy: passport.consumerPolicy,
95
245
  controllerReceipts: passport.controllerReceipts || [],
96
246
  }),
247
+ "release-candidate-stage-capsules-path": stageCapsules.path,
248
+ "release-candidate-stage-capsules-root": stageCapsules.root,
97
249
  });
98
250
  return passport;
99
251
  }
@@ -50,6 +50,27 @@ const DEV_DELIVERY_AUTHORITY_SCHEMA =
50
50
  "schemas/dev-delivery-authority-v2.schema.json";
51
51
  const DEV_DELIVERY_AUTHORITY_SCHEMA_SOURCE =
52
52
  "contracts/dev-delivery-authority-v2.schema.json";
53
+ const V4_COMPATIBILITY_FACTS_SCHEMA =
54
+ "schemas/v4-compatibility-facts-v1.schema.json";
55
+ const V4_COMPATIBILITY_FACTS_SCHEMA_SOURCE =
56
+ "contracts/v4-compatibility-facts-v1.schema.json";
57
+ const V4_PUBLICATION_REHEARSAL_SCHEMA =
58
+ "schemas/v4-publication-rehearsal-capsule-v1.schema.json";
59
+ const V4_PUBLICATION_REHEARSAL_SCHEMA_SOURCE =
60
+ "contracts/v4-publication-rehearsal-capsule-v1.schema.json";
61
+ const V4_ADOPTER_DELIVERY_SCHEMA =
62
+ "schemas/v4-adopter-delivery-v1.schema.json";
63
+ const V4_ADOPTER_DELIVERY_SCHEMA_SOURCE =
64
+ "contracts/v4-adopter-delivery-v1.schema.json";
65
+ const RELEASE_TAIL_CAPABILITIES_SCHEMA =
66
+ "schemas/release-tail-capabilities-v1.schema.json";
67
+ const RELEASE_TAIL_CAPABILITIES_SCHEMA_SOURCE =
68
+ "contracts/release-tail-capabilities-v1.schema.json";
69
+ const PUBLICATION_REHEARSAL_SITE_SCHEMAS = [
70
+ V4_PUBLICATION_REHEARSAL_SCHEMA,
71
+ V4_ADOPTER_DELIVERY_SCHEMA,
72
+ RELEASE_TAIL_CAPABILITIES_SCHEMA,
73
+ ];
53
74
  const root = path.resolve(import.meta.dirname, "..");
54
75
  const outputDir = path.join(root, "dist", "site");
55
76
  const requireFromHere = createRequire(import.meta.url);
@@ -78,9 +99,12 @@ function stableJson(value) {
78
99
  }
79
100
 
80
101
  function siteFileBytes(name, value) {
81
- return name === DEV_DELIVERY_AUTHORITY_SCHEMA
82
- ? readText(DEV_DELIVERY_AUTHORITY_SCHEMA_SOURCE)
83
- : stableJson(value);
102
+ if (name === DEV_DELIVERY_AUTHORITY_SCHEMA) return readText(DEV_DELIVERY_AUTHORITY_SCHEMA_SOURCE);
103
+ if (name === V4_COMPATIBILITY_FACTS_SCHEMA) return readText(V4_COMPATIBILITY_FACTS_SCHEMA_SOURCE);
104
+ if (name === V4_PUBLICATION_REHEARSAL_SCHEMA) return readText(V4_PUBLICATION_REHEARSAL_SCHEMA_SOURCE);
105
+ if (name === V4_ADOPTER_DELIVERY_SCHEMA) return readText(V4_ADOPTER_DELIVERY_SCHEMA_SOURCE);
106
+ if (name === RELEASE_TAIL_CAPABILITIES_SCHEMA) return readText(RELEASE_TAIL_CAPABILITIES_SCHEMA_SOURCE);
107
+ return stableJson(value);
84
108
  }
85
109
 
86
110
  function writeSiteFile(name, value) {
@@ -383,13 +407,16 @@ const manualMetaById = new Map(Object.entries({
383
407
  "release-activation-transaction": { capabilityGroup: "release-passport-trust", audience: ["release-operator", "agent"], maturity: "preview", order: 125 },
384
408
  "release-candidate": { capabilityGroup: "reusable-build", audience: ["release-operator", "consumer"], maturity: "stable", order: 130 },
385
409
  "release-train": { capabilityGroup: "governance-versioning", audience: ["release-operator", "consumer", "agent"], maturity: "preview", order: 132 },
410
+ "next-development-transition": { capabilityGroup: "governance-versioning", audience: ["release-operator", "consumer", "agent"], maturity: "preview", order: 133 },
386
411
  "stable-candidate-patrol": { capabilityGroup: "governance-versioning", audience: ["release-operator", "consumer"], maturity: "preview", order: 135 },
387
412
  "dev-qualification-patrol": { capabilityGroup: "governance-versioning", audience: ["release-operator", "consumer", "agent"], maturity: "preview", order: 136 },
388
413
  "dev-alpha-candidate-patrol": { capabilityGroup: "governance-versioning", audience: ["release-operator", "consumer", "agent"], maturity: "preview", order: 137 },
389
414
  "v4-canonical-contracts": { capabilityGroup: "governance-versioning", audience: ["developer", "maintainer", "agent"], maturity: "preview", order: 138 },
415
+ "v4-compatibility-facts": { capabilityGroup: "governance-versioning", audience: ["developer", "maintainer", "agent"], maturity: "preview", order: 139 },
390
416
  "observed-evidence-patrol": { capabilityGroup: "governance-versioning", audience: ["release-operator", "consumer", "agent"], maturity: "preview", order: 140 },
391
417
  "engineering-housekeeper": { capabilityGroup: "governance-versioning", audience: ["maintainer", "consumer", "agent"], maturity: "preview", order: 145 },
392
418
  "reusable-build-surface": { capabilityGroup: "reusable-build", audience: ["consumer", "release-operator"], maturity: "stable", order: 200 },
419
+ "v4-adopter-delivery": { capabilityGroup: "reusable-build", audience: ["consumer", "developer", "agent"], maturity: "preview", order: 205 },
393
420
  "lifecycle-protocol": { capabilityGroup: "reusable-build", audience: ["consumer", "developer"], maturity: "stable", order: 210 },
394
421
  "runtime-train-validation": { capabilityGroup: "governance-versioning", audience: ["maintainer", "consumer"], maturity: "stable", order: 220 },
395
422
  "kfd-support": { capabilityGroup: "kfd-trust", audience: ["agent", "maintainer"], maturity: "stable", order: 300 },
@@ -753,6 +780,7 @@ function buildSiteBundle() {
753
780
  "docs/reusable-build-surface.md",
754
781
  "docs/release-candidate.md",
755
782
  "docs/release-train.md",
783
+ "docs/next-development-transition.md",
756
784
  "docs/stable-candidate-patrol.md",
757
785
  "docs/dev-qualification-patrol.md",
758
786
  "docs/dev-alpha-candidate-patrol.md",
@@ -948,6 +976,8 @@ function buildSiteBundle() {
948
976
  "schemas/kfd-agent-hub-adoption.schema.json",
949
977
  "schemas/kfd-product-gate-input-v1.schema.json",
950
978
  "schemas/dev-delivery-authority-v2.schema.json",
979
+ "schemas/v4-compatibility-facts-v1.schema.json",
980
+ ...PUBLICATION_REHEARSAL_SITE_SCHEMAS,
951
981
  "kfd-support.json",
952
982
  "artifact-evidence.json",
953
983
  "product-mechanism.json",
@@ -983,6 +1013,8 @@ function buildSiteBundle() {
983
1013
  "schemas/kfd-agent-hub-adoption.schema.json",
984
1014
  "schemas/kfd-product-gate-input-v1.schema.json",
985
1015
  "schemas/dev-delivery-authority-v2.schema.json",
1016
+ "schemas/v4-compatibility-facts-v1.schema.json",
1017
+ ...PUBLICATION_REHEARSAL_SITE_SCHEMAS,
986
1018
  "buildchain-contract.json",
987
1019
  "kfd-claims.json",
988
1020
  "product-mechanism.json",
@@ -1114,6 +1146,8 @@ function buildSiteBundle() {
1114
1146
  "schemas/kfd-agent-hub-adoption.schema.json",
1115
1147
  "schemas/kfd-product-gate-input-v1.schema.json",
1116
1148
  "schemas/dev-delivery-authority-v2.schema.json",
1149
+ "schemas/v4-compatibility-facts-v1.schema.json",
1150
+ ...PUBLICATION_REHEARSAL_SITE_SCHEMAS,
1117
1151
  "buildchain-contract.json",
1118
1152
  "kfd-upstream-aggregate.json",
1119
1153
  "kfd-claims.json",
@@ -1291,6 +1325,15 @@ function buildSiteBundle() {
1291
1325
  [DEV_DELIVERY_AUTHORITY_SCHEMA]: readJson(
1292
1326
  DEV_DELIVERY_AUTHORITY_SCHEMA_SOURCE,
1293
1327
  ),
1328
+ [V4_COMPATIBILITY_FACTS_SCHEMA]: readJson(
1329
+ V4_COMPATIBILITY_FACTS_SCHEMA_SOURCE,
1330
+ ),
1331
+ ...Object.fromEntries(
1332
+ PUBLICATION_REHEARSAL_SITE_SCHEMAS.map((name) => [
1333
+ name,
1334
+ JSON.parse(siteFileBytes(name)),
1335
+ ]),
1336
+ ),
1294
1337
  "badge-endpoint-registry.json": badgeEndpointRegistry,
1295
1338
  "publication-registry.json": publicationRegistry,
1296
1339
  "buildchain-contract.json": createBuildchainContractWorld({ root, controllerRegistry }),
@@ -4,6 +4,11 @@ import path from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import { BUILDCHAIN_CONFIG_PATH } from "../packages/core/buildchain-layout.js";
6
6
  import { detectPackageManager, assertPackageManager } from "../packages/core/package-manager.js";
7
+ import {
8
+ appendNextDevelopmentToml,
9
+ mergeNextDevelopmentAgentInstructions,
10
+ nextDevelopmentWorkflowHeader,
11
+ } from "../packages/core/next-development-projection.js";
7
12
 
8
13
  const BUILDCHAIN_WORKFLOW_REF = "kungfu-systems/buildchain/.github/workflows/.build.yml@v4";
9
14
  const DEFAULT_PUBLICATION_LATEX_IMAGE = "ghcr.io/kungfu-systems/build-images/latex-pdf-builder";
@@ -327,7 +332,7 @@ function workflowArtifactPaths(type) {
327
332
  }
328
333
 
329
334
  function publicationWorkflowYaml() {
330
- return `# Commit both .buildchain/contract-lock.json and .buildchain/alpha-contract-lock.json.
335
+ return `${nextDevelopmentWorkflowHeader()}# Commit both .buildchain/contract-lock.json and .buildchain/alpha-contract-lock.json.
331
336
  # Persist only @v4 or @v4-alpha; pass temporary train/SHA runtimes through workflow_dispatch.
332
337
  name: Build
333
338
 
@@ -361,7 +366,7 @@ jobs:
361
366
  }
362
367
 
363
368
  function workflowYaml({ type, runnerPreset, artifactName }) {
364
- return `# Buildchain v4 lifecycle checkpoints are governed by architecture/v4-platform-stage-checkpoints.json.
369
+ return `${nextDevelopmentWorkflowHeader()}# Buildchain v4 lifecycle checkpoints are governed by architecture/v4-platform-stage-checkpoints.json.
365
370
  # Do not add undeclared runner-only inputs, outputs, environment, or provider effects.
366
371
  # Commit both .buildchain/contract-lock.json and .buildchain/alpha-contract-lock.json.
367
372
  # Persist only @v4 or @v4-alpha; pass temporary train/SHA runtimes through workflow_dispatch.
@@ -407,6 +412,13 @@ function writeIfAllowed(filePath, content, { force }) {
407
412
  return filePath;
408
413
  }
409
414
 
415
+ function writeManagedAgentEntry(filePath, current) {
416
+ const content = mergeNextDevelopmentAgentInstructions(current);
417
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
418
+ fs.writeFileSync(filePath, content);
419
+ return filePath;
420
+ }
421
+
410
422
  export function initBuildchainRepo({
411
423
  cwd = process.cwd(),
412
424
  type = "package",
@@ -417,7 +429,7 @@ export function initBuildchainRepo({
417
429
  } = {}) {
418
430
  const resolvedCwd = path.resolve(cwd);
419
431
  const manager = detectOrDefaultPackageManager(resolvedCwd, packageManager);
420
- const toml = (() => {
432
+ const toml = appendNextDevelopmentToml((() => {
421
433
  if (type === "package") {
422
434
  return packageToml(resolvedCwd, manager);
423
435
  }
@@ -437,7 +449,12 @@ export function initBuildchainRepo({
437
449
  return anchoredPackageToml(resolvedCwd, manager);
438
450
  }
439
451
  throw new Error("init --type must be one of package, native, web-surface, infra-contract, publication-artifact, or anchored-package");
440
- })();
452
+ })());
453
+
454
+ const agentsPath = path.join(resolvedCwd, "AGENTS.md");
455
+ const currentAgents = fs.existsSync(agentsPath)
456
+ ? fs.readFileSync(agentsPath, "utf8")
457
+ : "";
441
458
 
442
459
  const written = [
443
460
  writeIfAllowed(path.join(resolvedCwd, BUILDCHAIN_CONFIG_PATH), toml, { force }),
@@ -452,6 +469,7 @@ export function initBuildchainRepo({
452
469
  }),
453
470
  { force },
454
471
  ),
472
+ writeManagedAgentEntry(agentsPath, currentAgents),
455
473
  ];
456
474
 
457
475
  if (type === "anchored-package" && !fs.existsSync(path.join(resolvedCwd, "release.json"))) {