@kungfu-tech/buildchain 2.10.4 → 2.10.5

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 (37) hide show
  1. package/README.md +16 -1
  2. package/bin/buildchain.mjs +299 -16
  3. package/dist/site/buildchain-contract.json +7 -7
  4. package/dist/site/buildchain-site.json +42 -37
  5. package/dist/site/capability-registry.json +2 -2
  6. package/dist/site/cli-registry.json +164 -8
  7. package/dist/site/kfd-claims.json +190 -19
  8. package/dist/site/manual-registry.json +10 -10
  9. package/dist/site/node-api-registry.json +24 -11
  10. package/dist/site/page-registry.json +27 -22
  11. package/dist/site/public-surface-audit.json +334 -126
  12. package/dist/site/release-provenance.json +2 -1
  13. package/dist/site/site-manifest.json +14 -14
  14. package/dist/site/workflow-registry.json +4 -1
  15. package/docs/MAP.md +2 -2
  16. package/docs/cli.md +48 -14
  17. package/docs/install.md +1 -1
  18. package/docs/kfd-support.md +80 -21
  19. package/docs/lifecycle-protocol.md +7 -2
  20. package/docs/publish-transaction.md +1 -1
  21. package/docs/readme-badges.md +2 -2
  22. package/docs/release-passport.md +1 -1
  23. package/docs/reusable-build-surface.md +7 -7
  24. package/docs/web-surface-deployments.md +33 -4
  25. package/package.json +3 -2
  26. package/packages/core/buildchain-config.js +10 -5
  27. package/packages/core/buildchain-layout.js +157 -0
  28. package/packages/core/index.js +34 -0
  29. package/packages/core/kfd.js +273 -0
  30. package/packages/core/kfd3-surface-register.js +25 -17
  31. package/packages/core/public-surface-audit.js +14 -7
  32. package/scripts/buildchain-contract-lock.mjs +6 -2
  33. package/scripts/check-inventory.mjs +5 -4
  34. package/scripts/generate-site-bundle.mjs +20 -3
  35. package/scripts/init-repo.mjs +2 -1
  36. package/scripts/web-surface-production-release-pr.mjs +209 -36
  37. package/scripts/web-surface-release-pr-review.mjs +2 -1
@@ -17,7 +17,8 @@
17
17
  "./diagnostics": "./packages/core/diagnostics.js",
18
18
  "./homebrew": "./packages/core/homebrew.js",
19
19
  "./issue-reporting": "./packages/core/issue-reporting.js",
20
- "./kfd-3-surfaces": "./packages/core/kfd3-surface-register.js",
20
+ "./kfd": "./packages/core/kfd.js",
21
+ "./buildchain-layout": "./packages/core/buildchain-layout.js",
21
22
  "./release-line-bootstrap": "./packages/core/release-line-bootstrap.js",
22
23
  "./readme-badges": "./packages/core/readme-badges.js",
23
24
  "./public-surface-audit": "./packages/core/public-surface-audit.js",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "contract": "kungfu-buildchain-site-manifest",
4
- "generatedAt": "2026-07-08T12:25:38.748Z",
5
- "publishedAt": "2026-07-08T12:25:38.748Z",
4
+ "generatedAt": "2026-07-08T14:10:07.317Z",
5
+ "publishedAt": "2026-07-08T14:10:07.317Z",
6
6
  "reproducible": true,
7
7
  "timestampPolicy": "ci-injected",
8
8
  "deterministicInputs": [
@@ -19,7 +19,7 @@
19
19
  "declared Buildchain surface manifest contract"
20
20
  ],
21
21
  "sourceDateEpoch": "0",
22
- "sourceRevision": "2c2936458d8b1d9af67f4421af00a647de6284bb",
22
+ "sourceRevision": "4d0eaca9c0b22f057a347838f2526b88355aa397",
23
23
  "timestampPolicyDetails": {
24
24
  "contract": "kungfu-buildchain-surface-timestamp-policy",
25
25
  "timestampFields": [
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "package": {
39
39
  "name": "@kungfu-tech/buildchain",
40
- "version": "2.10.4",
40
+ "version": "2.10.5",
41
41
  "versionSource": "package.json#version"
42
42
  },
43
43
  "entrypoint": "buildchain-site.json",
@@ -53,7 +53,7 @@
53
53
  "path": "docs/MAP.md",
54
54
  "plane": "use",
55
55
  "exists": true,
56
- "digest": "sha256:67a0e6b63a943904eacbf7d26227e3c9ad650d17e8aa937c40b3fdad8f389fdd"
56
+ "digest": "sha256:b12caa887a325820c591d462ae2c0a4521eda001cb71d3def72e9b55924f892f"
57
57
  },
58
58
  {
59
59
  "id": "install",
@@ -61,7 +61,7 @@
61
61
  "path": "docs/install.md",
62
62
  "plane": "use",
63
63
  "exists": true,
64
- "digest": "sha256:34bc161a26595f95684694d341616e47bfd65b0c51a63225e68a575179636175"
64
+ "digest": "sha256:2600738a92b5853bc26d4e01211f0c07b8b36a21d4d72ca809bc6032dff5dc5f"
65
65
  },
66
66
  {
67
67
  "id": "release-passport",
@@ -69,7 +69,7 @@
69
69
  "path": "docs/release-passport.md",
70
70
  "plane": "verify",
71
71
  "exists": true,
72
- "digest": "sha256:ca764740841b364ff7cfea79b87221d29c09df09fee6d19e78ed4b0b173bfad3"
72
+ "digest": "sha256:332f058d9a016cc31c709a3447a56dc43ffd0c5e6cdbcd15f9a62f61bb16eb15"
73
73
  },
74
74
  {
75
75
  "id": "release-candidate",
@@ -93,7 +93,7 @@
93
93
  "path": "docs/readme-badges.md",
94
94
  "plane": "use",
95
95
  "exists": true,
96
- "digest": "sha256:ddaf49a7d6e6c11aea8d21d1ba736159897e16207cd74af0044014425faf8a2c"
96
+ "digest": "sha256:d032ddd27db62bdb21031cbd0673d9ae61af0250c12522fe6106e7aff835fb21"
97
97
  },
98
98
  {
99
99
  "id": "homebrew",
@@ -173,7 +173,7 @@
173
173
  "path": "docs/cli.md",
174
174
  "plane": "use",
175
175
  "exists": true,
176
- "digest": "sha256:2f55874feb9acecce1c471b96e07bb9a198a8da93efd0f859d69f353bf9c36a8"
176
+ "digest": "sha256:b6bc32831d202d5c542d72f6e63322f632014751e7db00862b28fb9ce5318fd3"
177
177
  },
178
178
  {
179
179
  "id": "build-facts",
@@ -189,7 +189,7 @@
189
189
  "path": "docs/kfd-support.md",
190
190
  "plane": "verify",
191
191
  "exists": true,
192
- "digest": "sha256:4bb33e408a2129e1534e92bea78d3cc0e4d8f986b0fbb27fe73ae6eae46b9ca3"
192
+ "digest": "sha256:704efbf7be24d641d8b119737eb33b3e98fea8c55cf434f7f475160809f4e3a4"
193
193
  },
194
194
  {
195
195
  "id": "lifecycle-protocol",
@@ -197,7 +197,7 @@
197
197
  "path": "docs/lifecycle-protocol.md",
198
198
  "plane": "use",
199
199
  "exists": true,
200
- "digest": "sha256:c76516894cf540da9a6722ba96c475386901ab448ab71ede5850a185f6a716c9"
200
+ "digest": "sha256:191d706801abe5cea7927042b9cd7989f19cf868e726f8ac5852dff9490aa14f"
201
201
  },
202
202
  {
203
203
  "id": "reusable-build-surface",
@@ -205,7 +205,7 @@
205
205
  "path": "docs/reusable-build-surface.md",
206
206
  "plane": "use",
207
207
  "exists": true,
208
- "digest": "sha256:a3f979fcede4450dabe5b8d6182395993c9f28559f7176b071a6ff9db565a355"
208
+ "digest": "sha256:5f56d66ad2798bc46acde3f8091c2e5ccee80412c1b26b70c8197ff9c7f6a406"
209
209
  },
210
210
  {
211
211
  "id": "publish-transaction",
@@ -213,7 +213,7 @@
213
213
  "path": "docs/publish-transaction.md",
214
214
  "plane": "verify",
215
215
  "exists": true,
216
- "digest": "sha256:c3fc5c49180db9167e1cf5bc5ff403e5a21cb55d1ba750bd0cfcd2429ad825b2"
216
+ "digest": "sha256:2523dd9a81e837918afae30c203349a7b29f00fdf953962a6db360fd95e0c6cb"
217
217
  },
218
218
  {
219
219
  "id": "release-governance",
@@ -253,7 +253,7 @@
253
253
  "path": "docs/web-surface-deployments.md",
254
254
  "plane": "use",
255
255
  "exists": true,
256
- "digest": "sha256:58673b84879a219572fe39aa8b4d01cfc34fabf664b3318753d61043821edaff"
256
+ "digest": "sha256:8d60ee80b1d4af1faa092ff9d7170330b02361d1f479221f73c6dc021aac1e60"
257
257
  }
258
258
  ],
259
259
  "facts": [
@@ -259,6 +259,7 @@
259
259
  "buildchain-contract-lock-path",
260
260
  "buildchain-ref",
261
261
  "buildchain-repository",
262
+ "fail-on-release-pr-error",
262
263
  "node-version",
263
264
  "preview-apply",
264
265
  "preview-aws-role-arn",
@@ -273,6 +274,8 @@
273
274
  "production-release-head-prefix",
274
275
  "production-release-label",
275
276
  "production-release-on-main",
277
+ "production-release-pr-mode",
278
+ "production-release-pr-token",
276
279
  "release-feedback-actor-privacy",
277
280
  "staging-apply",
278
281
  "staging-aws-role-arn",
@@ -280,7 +283,7 @@
280
283
  "verify-command",
281
284
  "working-directory"
282
285
  ],
283
- "inputCount": 28,
286
+ "inputCount": 31,
284
287
  "surface": "reusable-workflow",
285
288
  "capabilityGroup": "api-cli-reference",
286
289
  "status": "active"
package/docs/MAP.md CHANGED
@@ -38,10 +38,10 @@ workflow, action, and Node API export also carries a `capabilityGroup`,
38
38
 
39
39
  | Capability | Machine-readable entry | Manual entry |
40
40
  | --- | --- | --- |
41
- | Capability-grouped KFD-3 navigation | `dist/site/capability-registry.json`, `dist/site/page-registry.json`, `dist/site/manual-registry.json`, `dist/site/cli-registry.json`, `dist/site/node-api-registry.json` | this map, [`site-bundle-contract.md`](site-bundle-contract.md), [`kfd-support.md`](kfd-support.md) |
41
+ | Capability-grouped KFD navigation | `dist/site/capability-registry.json`, `dist/site/page-registry.json`, `dist/site/manual-registry.json`, `dist/site/cli-registry.json`, `dist/site/node-api-registry.json` | this map, [`site-bundle-contract.md`](site-bundle-contract.md), [`kfd-support.md`](kfd-support.md) |
42
42
  | KFD-1 / KFD-2 / KFD-3 release-passport gates | `dist/site/kfd-claims.json`, `dist/site/buildchain-contract.json`, `dist/site/artifact-schemas.json` | [`release-passport.md`](release-passport.md) |
43
43
  | KFD-3 public surface reverse audit | `dist/site/public-surface-audit.json`, `dist/site/cli-registry.json`, `dist/site/workflow-registry.json`, `dist/site/page-registry.json` | [`cli.md`](cli.md), [`site-bundle-contract.md`](site-bundle-contract.md) |
44
- | KFD-3 surface registration and capability query | `buildchain.kfd3.json`, `dist/site/kfd-claims.json`, `buildchain.release.json` | [`kfd-support.md`](kfd-support.md) |
44
+ | KFD-1 / KFD-2 / KFD-3 first-class CLI and Node API | `.buildchain/kfd/kfd-3-surfaces.json`, `dist/site/kfd-claims.json`, `buildchain.release.json`, KFD schemas from `@kungfu-tech/kfd` | [`kfd-support.md`](kfd-support.md), [`cli.md`](cli.md#commands) |
45
45
  | Floating `@v2` drift detection and compatibility issues | `dist/site/buildchain-contract.json` | [`reusable-build-surface.md`](reusable-build-surface.md#floating-ref-contract-lock) |
46
46
  | npm publish transactions, evidence, dist-tags, and recovery | `dist/site/release-model.json`, `dist/site/artifact-schemas.json` | [`publish-transaction.md`](publish-transaction.md) |
47
47
  | Git/source/version/module/product build facts | `dist/site/node-api-registry.json`, `dist/site/cli-registry.json`, `kungfu-buildchain-module-build-facts`, `kungfu-buildchain-product-build-facts` | [`build-facts.md`](build-facts.md) |
package/docs/cli.md CHANGED
@@ -90,7 +90,7 @@ floating-ref contract world for a runtime such as `@v2`.
90
90
 
91
91
  ## Commands
92
92
 
93
- `buildchain init` writes a starter `buildchain.toml` and a reusable workflow
93
+ `buildchain init` writes a starter `.buildchain/buildchain.toml` and a reusable workflow
94
94
  caller at `.github/workflows/build.yml`.
95
95
 
96
96
  Supported presets:
@@ -111,7 +111,7 @@ The native preset includes an opt-in `[diagnostics.native]` profile with common
111
111
  tool/cache/artifact probes. Consumers can keep it enabled, adjust the tool and
112
112
  directory lists, or disable it if a repository does not need native diagnostics.
113
113
 
114
- `buildchain validate` parses `buildchain.toml`, checks configured version-state
114
+ `buildchain validate` parses `.buildchain/buildchain.toml`, checks configured version-state
115
115
  files, and can require named lifecycle stages:
116
116
 
117
117
  ```bash
@@ -173,23 +173,57 @@ import {
173
173
  assertPublicSurfaceReverseAudit(collectPublicSurfaceReverseAudit({ root: process.cwd() }));
174
174
  ```
175
175
 
176
- `buildchain kfd-3` is the product-facing registration and query entrypoint for
177
- KFD-3 surfaces. It is separate from Buildchain's self reverse audit: products
178
- can detect standard public surfaces, register the accepted boundary, audit the
176
+ `buildchain kfd` is the product-facing KFD namespace. Schema commands expose the
177
+ machine-readable KFD standards shipped by `@kungfu-tech/kfd`, while versioned
178
+ subcommands host concrete product workflows. KFD-1, KFD-2, and KFD-3 are
179
+ first-class Buildchain surfaces. KFD-4 is schema-only until Buildchain has a
180
+ real verification protocol for it.
181
+
182
+ `status` reports implemented support and the active repo-owned file layout.
183
+ `migrate-layout` moves legacy root files into `.buildchain/`:
184
+
185
+ ```bash
186
+ buildchain kfd status --json
187
+ buildchain kfd migrate-layout --write
188
+ ```
189
+
190
+ KFD-1 commands generate and validate contract-world release evidence:
191
+
192
+ ```bash
193
+ buildchain kfd 1 schema --json
194
+ buildchain kfd 1 witness --json
195
+ buildchain kfd 1 gate --witness-json kfd-1-witness.json --json
196
+ buildchain kfd 1 verify --gate-json kfd-1-gate.json --json
197
+ ```
198
+
199
+ KFD-2 commands validate trust taxonomy entries and generate Buildchain's public
200
+ claim evidence:
201
+
202
+ ```bash
203
+ buildchain kfd 2 schema --json
204
+ buildchain kfd 2 taxonomy --entry-json residual-risk.json --kind residualRisk --json
205
+ buildchain kfd 2 claims --json
206
+ ```
207
+
208
+ KFD-3 commands are separate from Buildchain's self reverse audit: products can
209
+ detect standard public surfaces, register the accepted boundary, audit the
179
210
  current source or artifact tree, generate a release-passport-compatible witness,
180
211
  and expose a capability map for agents:
181
212
 
182
213
  ```bash
183
- buildchain kfd-3 detect --kind node-api --kind cli --json
184
- buildchain kfd-3 register node-api --product Buildchain
185
- buildchain kfd-3 audit --json
186
- buildchain kfd-3 witness --kind prebuild --output .buildchain/kfd-3/collaboration-interface.prebuild.json
187
- buildchain kfd-3 query buildchain --json
214
+ buildchain kfd schema list --json
215
+ buildchain kfd schema show kfd-3 --json
216
+ buildchain kfd 3 detect --kind node-api --kind cli --json
217
+ buildchain kfd 3 register node-api --product Buildchain
218
+ buildchain kfd 3 audit --json
219
+ buildchain kfd 3 witness --kind prebuild --output .buildchain/kfd-3/collaboration-interface.prebuild.json
220
+ buildchain kfd 3 query buildchain --json
221
+ buildchain kfd 4 schema --json
188
222
  ```
189
223
 
190
- The public Node API is exported from
191
- `@kungfu-tech/buildchain/kfd-3-surfaces`. See [`kfd-support.md`](kfd-support.md)
192
- for the detected / declared / enforced model and the agent query flow.
224
+ The public Node API is exported from `@kungfu-tech/buildchain/kfd`. See
225
+ [`kfd-support.md`](kfd-support.md) for the detected / declared / enforced model
226
+ and the agent query flow.
193
227
 
194
228
  Lifecycle runs also write a Buildchain observability JSONL log at
195
229
  `.buildchain/logs/events.jsonl` by default. Framework events use
@@ -320,7 +354,7 @@ spend long stretches in low-concurrency compile, archive, link, or cache steps.
320
354
  buildchain doctor --json
321
355
  ```
322
356
 
323
- It validates `buildchain.toml`, package-manager detection, Git repository state,
357
+ It validates `.buildchain/buildchain.toml`, package-manager detection, Git repository state,
324
358
  and the reusable workflow caller. For `version.strategy = "anchored"` with
325
359
  `version.next = "manual"`, it also embeds the anchored package release contract
326
360
  check: anchor manifest readability, configured version files, trusted
package/docs/install.md CHANGED
@@ -87,7 +87,7 @@ npx @kungfu-tech/buildchain validate --require-version-state
87
87
  npx @kungfu-tech/buildchain release --dry-run --target-ref alpha/v2/v2.2
88
88
  ```
89
89
 
90
- Use `buildchain.toml` to declare lifecycle commands. The commands may use Node
90
+ Use `.buildchain/buildchain.toml` to declare lifecycle commands. The commands may use Node
91
91
  package managers or non-Node tools such as pip, Conan, CMake, Make, or project
92
92
  scripts.
93
93
 
@@ -9,7 +9,33 @@ facts, not as README prose. The machine-readable sources are:
9
9
  workflow, action, site, and documented command surfaces;
10
10
  - `buildchain.release.json` for release-specific KFD-1, KFD-2, and KFD-3
11
11
  passport results;
12
- - `buildchain.kfd3.json` for product-owned KFD-3 surface registration.
12
+ - `.buildchain/buildchain.toml` for repository-owned Buildchain configuration;
13
+ - `.buildchain/kfd/kfd-3-surfaces.json` for product-owned KFD-3 surface
14
+ registration;
15
+ - `.buildchain/contract-lock.json` for accepted floating runtime contracts.
16
+
17
+ Buildchain still reads the legacy root files `buildchain.toml`,
18
+ `buildchain.contract-lock.json`, and `buildchain.kfd3.json` so existing
19
+ consumers do not break, but new repositories should keep repo-owned Buildchain
20
+ files under `.buildchain/`.
21
+
22
+ ## Unified Namespace
23
+
24
+ KFD support is exposed through one first-class namespace:
25
+
26
+ ```bash
27
+ buildchain kfd status --json
28
+ buildchain kfd migrate-layout --write
29
+ buildchain kfd schema list --json
30
+ buildchain kfd 1 witness --json
31
+ buildchain kfd 2 claims --json
32
+ buildchain kfd 3 query buildchain --json
33
+ buildchain kfd 4 schema --json
34
+ ```
35
+
36
+ KFD-1, KFD-2, and KFD-3 have concrete Buildchain workflows. KFD-4 is currently
37
+ schema-only in Buildchain: agents can discover and read the KFD-4 schema from
38
+ `@kungfu-tech/kfd`, but Buildchain does not claim KFD-4 verification.
13
39
 
14
40
  ## KFD-1
15
41
 
@@ -22,6 +48,15 @@ For Buildchain itself, the source registry lives in
22
48
  `dist/site/kfd-claims.json`. Release promotion binds that registry to exact
23
49
  source and artifact hashes in the release passport.
24
50
 
51
+ Buildchain exposes KFD-1 through:
52
+
53
+ ```bash
54
+ buildchain kfd 1 schema --json
55
+ buildchain kfd 1 witness --json
56
+ buildchain kfd 1 gate --witness-json kfd-1-witness.json --json
57
+ buildchain kfd 1 verify --gate-json kfd-1-gate.json --json
58
+ ```
59
+
25
60
  ## KFD-2
26
61
 
27
62
  KFD-2 requires public trust claims to be backed by machine-readable evidence.
@@ -38,6 +73,14 @@ Every public claim binds:
38
73
  - responsibility state;
39
74
  - residual risk.
40
75
 
76
+ Buildchain exposes KFD-2 through:
77
+
78
+ ```bash
79
+ buildchain kfd 2 schema --json
80
+ buildchain kfd 2 taxonomy --entry-json residual-risk.json --kind residualRisk --json
81
+ buildchain kfd 2 claims --json
82
+ ```
83
+
41
84
  ## KFD-3
42
85
 
43
86
  KFD-3 closes participant-facing collaboration surfaces over a declared public
@@ -60,7 +103,7 @@ KFD-3 surface registration uses three states.
60
103
  | State | Meaning |
61
104
  | --- | --- |
62
105
  | `detected` | Buildchain found a candidate public surface from package metadata, wheel metadata, CLI bins, binary artifacts, docs, or site bundle facts. |
63
- | `declared` | The product owner accepted that candidate into `buildchain.kfd3.json`. |
106
+ | `declared` | The product owner accepted that candidate into `.buildchain/kfd/kfd-3-surfaces.json`. |
64
107
  | `enforced` | The product has promoted a declared surface to a hard release boundary. Missing enforced surfaces fail release verification. |
65
108
 
66
109
  Detection does not silently become product intent. `register` is the boundary
@@ -68,31 +111,39 @@ decision. Existing consumers are unaffected until they opt in.
68
111
 
69
112
  ## CLI
70
113
 
114
+ Inspect KFD-owned schema facts:
115
+
116
+ ```bash
117
+ buildchain kfd schema list --json
118
+ buildchain kfd schema show kfd-1 --json
119
+ buildchain kfd 4 schema --json
120
+ ```
121
+
71
122
  Detect public surface candidates:
72
123
 
73
124
  ```bash
74
- buildchain kfd-3 detect --json
75
- buildchain kfd-3 detect --kind node-api --kind cli --json
125
+ buildchain kfd 3 detect --json
126
+ buildchain kfd 3 detect --kind node-api --kind cli --json
76
127
  ```
77
128
 
78
129
  Register standard surface classes:
79
130
 
80
131
  ```bash
81
- buildchain kfd-3 register node-api --product Buildchain
82
- buildchain kfd-3 register cli
83
- buildchain kfd-3 register python-api --artifact dist/wheel-unpacked
132
+ buildchain kfd 3 register node-api --product Buildchain
133
+ buildchain kfd 3 register cli
134
+ buildchain kfd 3 register python-api --artifact dist/wheel-unpacked
84
135
  ```
85
136
 
86
137
  Audit detected, declared, and enforced surfaces:
87
138
 
88
139
  ```bash
89
- buildchain kfd-3 audit --json
140
+ buildchain kfd 3 audit --json
90
141
  ```
91
142
 
92
143
  Generate a witness for release passport collection:
93
144
 
94
145
  ```bash
95
- buildchain kfd-3 witness \
146
+ buildchain kfd 3 witness \
96
147
  --kind prebuild \
97
148
  --output .buildchain/kfd-3/collaboration-interface.prebuild.json
98
149
  ```
@@ -100,8 +151,8 @@ buildchain kfd-3 witness \
100
151
  Query capability facts for agents or downstream sites:
101
152
 
102
153
  ```bash
103
- buildchain kfd-3 query buildchain --json
104
- buildchain kfd-3 query --passport buildchain.release.json --json
154
+ buildchain kfd 3 query buildchain --json
155
+ buildchain kfd 3 query --passport .buildchain/release-passport/buildchain.release.json --json
105
156
  ```
106
157
 
107
158
  ## Node API
@@ -110,16 +161,20 @@ The CLI is a thin wrapper over the public Node API:
110
161
 
111
162
  ```js
112
163
  import {
113
- auditKfd3Surfaces,
114
- createKfd3SurfaceWitness,
115
- detectKfd3Surfaces,
116
- queryKfd3Capabilities,
117
- registerKfd3Surfaces,
118
- } from "@kungfu-tech/buildchain/kfd-3-surfaces";
164
+ kfd1,
165
+ kfd2,
166
+ kfd3,
167
+ kfd4,
168
+ collectKfdStatus,
169
+ listKfdSchemas,
170
+ readKfdSchema,
171
+ } from "@kungfu-tech/buildchain/kfd";
119
172
  ```
120
173
 
121
- Agents should prefer `queryKfd3Capabilities()` when deciding whether a product
122
- capability is usable. The query result connects each capability to:
174
+ Agents should start with `collectKfdStatus()` to learn which standards are
175
+ implemented and where the repository-owned Buildchain files live. For capability
176
+ use decisions, prefer `kfd3.queryCapabilities()`. The query result connects each
177
+ capability to:
123
178
 
124
179
  - KFD-3 surface identity and state;
125
180
  - KFD-1 basis facts such as source and artifact paths or digests;
@@ -146,9 +201,13 @@ the registry over time, but the first boundary is metadata-based.
146
201
 
147
202
  Buildchain dogfoods this model in two ways:
148
203
 
204
+ - `buildchain kfd 1 witness --json` generates Buildchain's own KFD-1 contract
205
+ world witness;
206
+ - `buildchain kfd 2 claims --json` generates Buildchain's own KFD-2 public
207
+ claim evidence;
149
208
  - `dist/site/kfd-claims.json` declares Buildchain's own KFD-3 collaboration
150
- surface;
151
- - `buildchain kfd-3 query buildchain --json` resolves the packaged
209
+ interface;
210
+ - `buildchain kfd 3 query buildchain --json` resolves the packaged
152
211
  Buildchain capability map from that site fact source.
153
212
 
154
213
  This lets downstream agents discover Buildchain's supported CLI, Node API,
@@ -1,10 +1,15 @@
1
1
  # Lifecycle Protocol
2
2
 
3
- Buildchain uses `buildchain.toml` as the v2 repository configuration format.
3
+ Buildchain uses `.buildchain/buildchain.toml` as the v2 repository configuration format.
4
4
  The file is optional for simple JavaScript repositories, but it is the preferred
5
5
  way to describe release version state and lifecycle commands when a project is
6
6
  not a plain pnpm, npm, or yarn workspace.
7
7
 
8
+ For compatibility, Buildchain still reads a legacy root `buildchain.toml` when
9
+ `.buildchain/buildchain.toml` is absent. New repositories should use the
10
+ `.buildchain/` layout so all Buildchain-owned local state lives under one
11
+ directory.
12
+
8
13
  Only TOML is supported in v2. YAML, JSON, and JavaScript config files are not
9
14
  loaded.
10
15
 
@@ -278,7 +283,7 @@ it overrides `lifecycle.verify` for that invocation.
278
283
 
279
284
  Heavy repositories can validate their Buildchain declaration before they are
280
285
  ready to run the real build. `actions/validate-config` checks that
281
- `buildchain.toml` parses, configured version-state files exist, configured
286
+ `.buildchain/buildchain.toml` parses, configured version-state files exist, configured
282
287
  version keys are strings, and required lifecycle stage names are declared.
283
288
  For web-surface repositories it also validates `project`, `channels`, `deploy`,
284
289
  `retention`, and `security` declarations.
@@ -70,7 +70,7 @@ of reusing or overwriting that failed transaction slot.
70
70
 
71
71
  ## Lifecycle
72
72
 
73
- Repositories declare publish work in `buildchain.toml`:
73
+ Repositories declare publish work in `.buildchain/buildchain.toml`:
74
74
 
75
75
  ```toml
76
76
  [publish]
@@ -2,7 +2,7 @@
2
2
 
3
3
  Buildchain can generate a managed README badge block from repository-owned
4
4
  facts. The README keeps only a projection; the source facts remain in
5
- `buildchain.toml`, package metadata, workflow files, KFD standards metadata,
5
+ `.buildchain/buildchain.toml`, package metadata, workflow files, KFD standards metadata,
6
6
  and the repository's own release passport.
7
7
 
8
8
  The managed block is delimited by:
@@ -107,7 +107,7 @@ so badge drift is detected like any other generated release-facing surface.
107
107
 
108
108
  ## Configuration
109
109
 
110
- The optional `[badges]` table in `buildchain.toml` declares local facts that
110
+ The optional `[badges]` table in `.buildchain/buildchain.toml` declares local facts that
111
111
  cannot be inferred safely:
112
112
 
113
113
  ```toml
@@ -336,7 +336,7 @@ instead of trusting docs or release notes.
336
336
 
337
337
  KFD-1 protects release payload surfaces. Floating ref contract locks protect the
338
338
  consumer's relationship to Buildchain itself. A consumer can keep
339
- `buildchain.contract-lock.json` with the Buildchain floating ref it accepted,
339
+ `.buildchain/contract-lock.json` with the Buildchain floating ref it accepted,
340
340
  the resolved SHA, the contract digest, and the compatibility policy. Each
341
341
  Buildchain run reads the actual contract from the checked-out Buildchain ref
342
342
  and compares it before heavy build or publish work begins.
@@ -169,7 +169,7 @@ workflow path or a temporary explicit workflow ref.
169
169
  Stable consumers should use floating major refs such as `@v2`, but a floating
170
170
  ref is not blind trust. Each released Buildchain ref carries a package-owned
171
171
  runtime contract world in `dist/site/buildchain-contract.json`. Consumers may
172
- keep a small lock file, `buildchain.contract-lock.json`, recording the
172
+ keep a small lock file, `.buildchain/contract-lock.json`, recording the
173
173
  Buildchain ref, resolved SHA, contract digest, compatibility digest, accepted
174
174
  major line, and compatibility policy they reviewed.
175
175
 
@@ -178,7 +178,7 @@ The reusable build trust gate checks this lock before any heavy matrix job:
178
178
  1. resolve the Buildchain runtime ref, for example `v2`, to an immutable SHA;
179
179
  2. read `dist/site/buildchain-contract.json` from that checked-out Buildchain
180
180
  ref;
181
- 3. read the consumer's `buildchain.contract-lock.json`;
181
+ 3. read the consumer's `.buildchain/contract-lock.json`;
182
182
  4. compare the accepted contract with the current contract.
183
183
 
184
184
  SHA drift alone is not a failure. `v2` is expected to advance. Buildchain only
@@ -197,7 +197,7 @@ jobs:
197
197
  issues: write
198
198
  id-token: write
199
199
  with:
200
- buildchain-contract-lock-path: buildchain.contract-lock.json
200
+ buildchain-contract-lock-path: .buildchain/contract-lock.json
201
201
  buildchain-contract-compatibility-policy: major-compatible
202
202
  buildchain-contract-drift-issue-mode: compatible-and-breaking
203
203
  ```
@@ -252,7 +252,7 @@ repository or organization variables named
252
252
  private LAN topology out of repository YAML.
253
253
 
254
254
  Do not read cache URLs or reference paths from PR-controlled files such as
255
- `buildchain.toml`. These values are trusted workflow inputs or repo/org
255
+ `.buildchain/buildchain.toml`. These values are trusted workflow inputs or repo/org
256
256
  variables. Buildchain does not pass GitHub credentials to cache mirrors or
257
257
  reference repositories. If it must fall back to GitHub, the workflow token is
258
258
  used only for the GitHub fetch path.
@@ -598,7 +598,7 @@ jobs:
598
598
  publish-package-set-order: platforms-first-main-last
599
599
  publish-package-main: "@kungfu-tech/libnode"
600
600
  release-passport-product-name: Libnode
601
- buildchain-contract-lock-path: buildchain.contract-lock.json
601
+ buildchain-contract-lock-path: .buildchain/contract-lock.json
602
602
  buildchain-contract-drift-issue-mode: compatible-and-breaking
603
603
  ```
604
604
 
@@ -705,7 +705,7 @@ package before all platform artifacts for the same source SHA are available.
705
705
 
706
706
  ## Command Sources
707
707
 
708
- The workflow runs `buildchain.toml` lifecycle stages by default:
708
+ The workflow runs `.buildchain/buildchain.toml` lifecycle stages by default:
709
709
 
710
710
  ```toml
711
711
  [lifecycle.install]
@@ -870,7 +870,7 @@ the publish gate: pull requests remain non-publishing events.
870
870
  `fixtures/libnode-shaped` is the contract fixture. It has:
871
871
 
872
872
  - `package.json` version state;
873
- - `buildchain.toml` with `install`, `build`, `verify`, and `publish`;
873
+ - `.buildchain/buildchain.toml` with `install`, `build`, `verify`, and `publish`;
874
874
  - cross-platform Node scripts that create small `dist/` outputs;
875
875
  - `Build Surface Fixture` workflow coverage.
876
876
 
@@ -22,7 +22,7 @@ This keeps the evidence chain clear:
22
22
 
23
23
  ## Configuration
24
24
 
25
- `buildchain.toml` is the source of truth. Web-surface projects must declare
25
+ `.buildchain/buildchain.toml` is the source of truth. Web-surface projects must declare
26
26
  preview, staging, and production channels plus a deploy adapter for each.
27
27
 
28
28
  ```toml
@@ -165,14 +165,14 @@ jobs:
165
165
  web:
166
166
  uses: kungfu-systems/buildchain/.github/workflows/.web-surface.yml@v2
167
167
  with:
168
- buildchain-contract-lock-path: buildchain.contract-lock.json
168
+ buildchain-contract-lock-path: .buildchain/contract-lock.json
169
169
  buildchain-contract-compatibility-policy: major-compatible
170
170
  buildchain-contract-drift-issue-mode: compatible-and-breaking
171
171
  build-command: pnpm build
172
172
  artifact-path: dist
173
173
  ```
174
174
 
175
- The caller repository commits `buildchain.contract-lock.json` after reviewing an
175
+ The caller repository commits `.buildchain/contract-lock.json` after reviewing an
176
176
  accepted Buildchain runtime SHA and contract digest. The reusable workflow then
177
177
  resolves the floating runtime to an immutable SHA, checks the lock before the
178
178
  caller build command, and applies these rules:
@@ -657,6 +657,14 @@ When enabled, Buildchain owns the full release apply state machine:
657
657
  release-intent commit, carries `production-release-label`, and includes the
658
658
  staging URLs, source SHA, artifact hash, and staging release-passport artifact
659
659
  link in the PR body.
660
+ - Production release PR handoff is permission-aware. Staging apply and staging
661
+ health remain successful even when the repository or organization has
662
+ GitHub Actions workflow permissions set to read-only. In that case Buildchain
663
+ records `release-pr-status=permission-denied`, uploads the release PR handoff
664
+ summary/body plus staging release passport artifacts, and writes an exact
665
+ manual `gh pr create` command to the step summary. Set
666
+ `fail-on-release-pr-error=true` only when PR creation failure should fail the
667
+ whole workflow.
660
668
  - Release pull requests that match the configured production gate get a
661
669
  Buildchain review comment with the staging URL and production target, so the
662
670
  operator can verify staging from the PR page and use merge as the approval
@@ -702,10 +710,29 @@ jobs:
702
710
  production-release-label: buildchain-release
703
711
  production-release-head-prefix: release/
704
712
  production-release-branch-channel: production
713
+ production-release-pr-mode: auto
705
714
  production-aws-role-arn: arn:aws:iam::123456789012:role/site-production-github-actions
706
715
  production-environment: production
707
716
  ```
708
717
 
718
+ `production-release-pr-mode` controls the post-staging handoff:
719
+
720
+ | Mode | Behavior |
721
+ | --- | --- |
722
+ | `auto` | Generate release PR facts, create/update the empty release-intent branch and PR, and label it when token permissions allow. This is the default. |
723
+ | `summary-only` | Generate and upload release PR facts, body, passport evidence, and manual command, but do not call the GitHub PR API. |
724
+ | `disabled` | Record a disabled handoff and skip release PR API calls. |
725
+
726
+ Automatic release PR creation normally uses the workflow `github.token`. If the
727
+ consumer repository cannot enable "GitHub Actions can create and approve pull
728
+ requests" globally, pass a narrower GitHub App token or PAT through
729
+ `production-release-pr-token`:
730
+
731
+ ```yaml
732
+ with:
733
+ production-release-pr-token: ${{ secrets.BUILDCHAIN_RELEASE_PR_TOKEN }}
734
+ ```
735
+
709
736
  The merge button becomes the production approval only for a PR that carries the
710
737
  release label and comes from the configured source-branch prefix. Ordinary pull
711
738
  requests merged into `main` deploy staging and open a release-intent PR; merging
@@ -722,7 +749,9 @@ Callers must grant `id-token: write` for OIDC role assumption. Preview comments
722
749
  need `pull-requests: write`. Automatic release PR creation also needs
723
750
  `contents: write`, `pull-requests: write`, and `issues: write` so Buildchain can
724
751
  create the release branch, write the empty release-intent commit, open or update
725
- the PR, and apply the release label. The AWS roles remain caller-owned and
752
+ the PR, and apply the release label. If these permissions are unavailable,
753
+ Buildchain degrades the release handoff instead of marking a successful staging
754
+ deployment as failed, unless `fail-on-release-pr-error=true`. The AWS roles remain caller-owned and
726
755
  should be scoped by channel: preview can mutate only preview resources, staging
727
756
  can mutate only staging resources, and production can mutate only production
728
757
  resources.