@kungfu-tech/buildchain 2.8.15 → 2.8.16-alpha.1

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.
@@ -14,6 +14,7 @@
14
14
  "./buildchain-contract": "./packages/core/buildchain-contract.js",
15
15
  "./diagnostics": "./packages/core/diagnostics.js",
16
16
  "./issue-reporting": "./packages/core/issue-reporting.js",
17
+ "./readme-badges": "./packages/core/readme-badges.js",
17
18
  "./logging": "./packages/core/logging.js",
18
19
  "./kfd-gate": "./packages/core/kfd-gate.js",
19
20
  "./release-candidate": "./packages/core/release-candidate.js",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "contract": "kungfu-buildchain-site-manifest",
4
- "generatedAt": "2026-07-07T13:50:19.556Z",
5
- "publishedAt": "2026-07-07T13:50:19.556Z",
4
+ "generatedAt": "2026-07-07T14:53:34.643Z",
5
+ "publishedAt": "2026-07-07T14:53:34.643Z",
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": "2c3127f2954960ad89f5658a090fb9fe19b442ce",
22
+ "sourceRevision": "3f3734348d6c4217a0aaea924b3537c519ab141a",
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.8.15",
40
+ "version": "2.8.16-alpha.1",
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:b5cfef531ba8ca655d8d66ffe0e530a0ca2c971daad5880943d2b824216ed043"
56
+ "digest": "sha256:46fa21a0fd496ba1b2afc4209e4e923aba3656e4fe83f757108f24ceef977741"
57
57
  },
58
58
  {
59
59
  "id": "install",
@@ -79,6 +79,14 @@
79
79
  "exists": true,
80
80
  "digest": "sha256:190e3537075f37cf8a7e52bf8254606e1d9450d87c5a81dc11df8b56a7d03065"
81
81
  },
82
+ {
83
+ "id": "readme-badges",
84
+ "title": "README badge blocks",
85
+ "path": "docs/readme-badges.md",
86
+ "plane": "use",
87
+ "exists": true,
88
+ "digest": "sha256:3f4a44ea7f3b70cadc78a343fe53ade74b78fa369c19630cc9b926c1e460f66f"
89
+ },
82
90
  {
83
91
  "id": "binary-distribution",
84
92
  "title": "Binary distribution contract",
@@ -149,7 +157,7 @@
149
157
  "path": "docs/cli.md",
150
158
  "plane": "use",
151
159
  "exists": true,
152
- "digest": "sha256:a8a348181d6419b746e863d1cacc9d6a91aa6ac5cc2b60819843d44487957c49"
160
+ "digest": "sha256:c7928797300772ed5240ef69529af99298c32dbb74c3be7fbcad5ae0786576ce"
153
161
  },
154
162
  {
155
163
  "id": "lifecycle-protocol",
package/docs/MAP.md CHANGED
@@ -25,6 +25,7 @@ manuals explain those facts and give operator examples.
25
25
  | npm publish transactions, evidence, dist-tags, and recovery | `dist/site/release-model.json`, `dist/site/artifact-schemas.json` | [`publish-transaction.md`](publish-transaction.md) |
26
26
  | GitHub Release passport/evidence publication | `dist/site/release-model.json`, `dist/site/artifact-schemas.json` | [`release-governance.md`](release-governance.md), [`release-candidate.md`](release-candidate.md) |
27
27
  | release propagation for package/site chains | `dist/site/release-model.json` | [`release-propagation.md`](release-propagation.md) |
28
+ | Generated README badge blocks and badge facts | `dist/site/node-api-registry.json`, `dist/site/manual-registry.json`, `kungfu-buildchain-readme-badge-facts` | [`readme-badges.md`](readme-badges.md) |
28
29
  | Buildchain CLI manual | `dist/site/cli-registry.json`, `dist/site/manual-registry.json` | [`cli.md`](cli.md) |
29
30
  | Node API / package exports | `dist/site/node-api-registry.json`, `dist/site/release-provenance.json` | [`cli.md`](cli.md#node-api-and-package-exports) |
30
31
 
@@ -59,6 +60,7 @@ replace them.
59
60
  | How do I gate KFD-3 collaboration-interface releases? | [`release-passport.md`](release-passport.md#kfd-3-collaboration-interface-release-gate) + [`cli.md`](cli.md) | verify/use | stable |
60
61
  | How do I keep `@v2` floating refs while detecting Buildchain contract drift? | [`reusable-build-surface.md`](reusable-build-surface.md#floating-ref-contract-lock) | verify/use | stable |
61
62
  | How do I propagate finalized upstream releases to downstream package/site PRs? | [`release-propagation.md`](release-propagation.md) | use | preview |
63
+ | How do I generate README status badges without hand-maintaining Markdown? | [`readme-badges.md`](readme-badges.md) + [`cli.md`](cli.md) | use | stable |
62
64
  | How do I prove a PR-stage reusable build is the artifact source promoted later? | [`release-candidate.md`](release-candidate.md) + [`reusable-build-surface.md`](reusable-build-surface.md) | verify | stable |
63
65
  | Why are binary release assets archived by platform, and where is the single bundle? | [`binary-distribution.md`](binary-distribution.md) | verify | stable |
64
66
  | How do I add timestamped logs inside build scripts? | [`toolkit-observability.md`](toolkit-observability.md) | use | stable |
@@ -115,6 +117,8 @@ replace them.
115
117
  [`cli.md`](cli.md) and [`publish-transaction.md`](publish-transaction.md).
116
118
  - **release chains / upstream package as source of truth / site synchronization** ->
117
119
  [`release-propagation.md`](release-propagation.md).
120
+ - **README status badges / KFD badge blocks / badge facts JSON** ->
121
+ [`readme-badges.md`](readme-badges.md) and [`cli.md`](cli.md).
118
122
  - **KFD-1 contract worlds / byte-for-byte release gates** ->
119
123
  [`release-passport.md`](release-passport.md#kfd-1-contract-world-release-gate).
120
124
  - **KFD-2 public release trust claim audit** ->
package/docs/cli.md CHANGED
@@ -65,6 +65,7 @@ Current public import families include:
65
65
  import * as buildchain from "@kungfu-tech/buildchain";
66
66
  import { createBuildchainLogger } from "@kungfu-tech/buildchain/logging";
67
67
  import { verifyKfd1ReleaseGate } from "@kungfu-tech/buildchain/kfd-gate";
68
+ import { collectReadmeBadgeFacts } from "@kungfu-tech/buildchain/readme-badges";
68
69
  import { verifyReleasePassport } from "@kungfu-tech/buildchain/release-passport";
69
70
  import { createReleasePropagationPlan } from "@kungfu-tech/buildchain/release-propagation";
70
71
  import contractWorld from "@kungfu-tech/buildchain/site/buildchain-contract.json" with { type: "json" };
@@ -244,9 +245,26 @@ version against configured version files and the anchor manifest. The JSON
244
245
  result is shaped for future `buildchain.libkungfu.dev` fact ingestion.
245
246
 
246
247
  `buildchain release`, `buildchain web-surface`, `buildchain infra-contract`,
247
- `buildchain publish-source`, and `buildchain build-contract` route to the same scripts used by Buildchain's
248
- GitHub Actions workflows. This keeps local inspection and CI behavior on the
249
- same implementation path.
248
+ `buildchain publish-source`, `buildchain badges`, and `buildchain build-contract`
249
+ route to the same implementation used by Buildchain's package APIs or GitHub
250
+ Actions workflows. This keeps local inspection and CI behavior on the same
251
+ implementation path.
252
+
253
+ Generate, check, or update the managed README badge block:
254
+
255
+ ```bash
256
+ buildchain badges readme --json
257
+ buildchain badges readme --check
258
+ buildchain badges readme --write
259
+ ```
260
+
261
+ The `--json` form emits the `kungfu-buildchain-readme-badge-facts` object.
262
+ `--check` fails closed when the README marker block is missing or stale.
263
+ `--write` inserts or replaces only the marked block. KFD passed badges come
264
+ from the repository's own verified release passport; unreleased repositories
265
+ downgrade to explicit local declarations such as `declared`, `aligned`, or
266
+ `planned`. See [`readme-badges.md`](readme-badges.md) for the marker contract
267
+ and `[badges]` configuration.
250
268
 
251
269
  `buildchain collect github-release` creates a release passport bundle from
252
270
  GitHub Release assets or a local asset directory:
@@ -0,0 +1,124 @@
1
+ # README Badge Blocks
2
+
3
+ Buildchain can generate a managed README badge block from repository-owned
4
+ facts. The README keeps only a projection; the source facts remain in
5
+ `buildchain.toml`, package metadata, workflow files, and the repository's own
6
+ release passport.
7
+
8
+ The managed block is delimited by:
9
+
10
+ ```markdown
11
+ <!-- buildchain:badges:start -->
12
+ ...
13
+ <!-- buildchain:badges:end -->
14
+ ```
15
+
16
+ Buildchain owns only that block. Everything outside the markers remains normal
17
+ README content.
18
+
19
+ ## Node API
20
+
21
+ Use the public package export:
22
+
23
+ ```js
24
+ import {
25
+ collectReadmeBadgeFacts,
26
+ renderReadmeBadgeBlock,
27
+ checkReadmeBadgeBlock,
28
+ updateReadmeBadgeBlock,
29
+ } from "@kungfu-tech/buildchain/readme-badges";
30
+ ```
31
+
32
+ `collectReadmeBadgeFacts({ cwd })` returns a machine-readable object with
33
+ contract `kungfu-buildchain-readme-badge-facts`. It collects repository
34
+ identity, package name/version/license, configured platforms, configured
35
+ workflow status badges, release passport location and verification result, and
36
+ KFD badge state. When present, it also summarizes local KFD claim registry and
37
+ product-mechanism facts from the package-owned site bundle, so downstream
38
+ agents can connect README badges back to Buildchain's KFD/source-of-truth
39
+ surfaces.
40
+
41
+ `renderReadmeBadgeBlock(facts)` renders deterministic Markdown from that facts
42
+ object. `checkReadmeBadgeBlock({ readmeText, facts })` compares the current
43
+ README marker block against the expected block and reports missing or stale
44
+ drift. `updateReadmeBadgeBlock({ readmeText, facts })` inserts or replaces the
45
+ managed block.
46
+
47
+ The Node API is the implementation source. The CLI delegates to it.
48
+
49
+ ## CLI
50
+
51
+ Generate facts as JSON:
52
+
53
+ ```bash
54
+ buildchain badges readme --json
55
+ ```
56
+
57
+ Fail closed when the README block is missing or stale:
58
+
59
+ ```bash
60
+ buildchain badges readme --check
61
+ ```
62
+
63
+ Insert or replace the block:
64
+
65
+ ```bash
66
+ buildchain badges readme --write
67
+ ```
68
+
69
+ All commands accept `--cwd <dir>` and `--readme <path>`. Repositories can add
70
+ `buildchain badges readme --check` to CI so badge drift is detected like any
71
+ other generated release-facing surface.
72
+
73
+ ## Configuration
74
+
75
+ The optional `[badges]` table in `buildchain.toml` declares local facts that
76
+ cannot be inferred safely:
77
+
78
+ ```toml
79
+ [badges]
80
+ release_passport = "https://github.com/example/project/releases/latest/download/buildchain.release.json"
81
+ kfd_1 = "declared"
82
+ kfd_2 = "planned"
83
+ kfd_3 = "aligned"
84
+ platforms = ["macOS", "Linux", "Windows"]
85
+ workflows = ["verify.yml", "build.yml"]
86
+ ```
87
+
88
+ `release_passport` may be a local path or URL. If omitted, Buildchain tries
89
+ `buildchain.release.json`, then `.buildchain/release-passport/buildchain.release.json`,
90
+ then the repository's latest GitHub Release asset when the GitHub repository
91
+ can be discovered.
92
+
93
+ ## KFD Badge Rules
94
+
95
+ KFD passed is evidence-backed. A repository may display `KFD-1 passed`,
96
+ `KFD-2 passed`, or `KFD-3 passed` only when its own release passport verifies
97
+ successfully and the corresponding passport section has `status: "passed"`.
98
+
99
+ When no release passport exists yet, or when the passport cannot be verified,
100
+ Buildchain downgrades each KFD badge to the explicit local declaration such as
101
+ `declared`, `aligned`, or `planned`. A local `passed` declaration is treated as
102
+ `declared`; unknown local states are normalized to a non-passed fallback.
103
+
104
+ Buildchain's own README may link to Buildchain's own release passport. Other
105
+ repositories must not claim Buildchain's KFD status as their own; their badge
106
+ links must point to their own release passport or evidence page.
107
+
108
+ ## CI Contract
109
+
110
+ Recommended CI gate:
111
+
112
+ ```bash
113
+ buildchain badges readme --check
114
+ ```
115
+
116
+ The check fails when:
117
+
118
+ - the marker block is missing;
119
+ - generated Markdown differs from repository facts;
120
+ - a previously hand-written KFD passed claim is not backed by the repository's
121
+ verified release passport facts.
122
+
123
+ The machine-readable facts object should be used by downstream site renderers
124
+ or audit tools when Markdown badges are not enough.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungfu-tech/buildchain",
3
- "version": "2.8.15",
3
+ "version": "2.8.16-alpha.1",
4
4
  "private": false,
5
5
  "description": "Buildchain Release Passport, release governance, CLI toolkit, and site facts.",
6
6
  "repository": "https://github.com/kungfu-systems/buildchain",
@@ -17,6 +17,7 @@
17
17
  "./buildchain-contract": "./packages/core/buildchain-contract.js",
18
18
  "./diagnostics": "./packages/core/diagnostics.js",
19
19
  "./issue-reporting": "./packages/core/issue-reporting.js",
20
+ "./readme-badges": "./packages/core/readme-badges.js",
20
21
  "./logging": "./packages/core/logging.js",
21
22
  "./kfd-gate": "./packages/core/kfd-gate.js",
22
23
  "./release-candidate": "./packages/core/release-candidate.js",
@@ -14,6 +14,8 @@ Current shared surfaces:
14
14
  `@kungfu-tech/buildchain/diagnostics`;
15
15
  - release passport creation and verification through
16
16
  `@kungfu-tech/buildchain/release-passport`.
17
+ - managed README badge facts and marker blocks through
18
+ `@kungfu-tech/buildchain/readme-badges`.
17
19
 
18
20
  ## Toolkit Imports
19
21
 
@@ -53,3 +55,13 @@ const { collectRunnerDiagnostics } = await import("@kungfu-tech/buildchain/diagn
53
55
  Web-surface validation stays in core because both local scripts and GitHub
54
56
  Actions need the same fail-closed interpretation of project, channel, deploy,
55
57
  retention, and staging security declarations.
58
+
59
+ README badge consumers should import the public subpath and treat Markdown as a
60
+ projection of the returned facts:
61
+
62
+ ```js
63
+ import { collectReadmeBadgeFacts, renderReadmeBadgeBlock } from "@kungfu-tech/buildchain/readme-badges";
64
+
65
+ const facts = await collectReadmeBadgeFacts({ cwd: process.cwd() });
66
+ const markdown = renderReadmeBadgeBlock(facts);
67
+ ```
@@ -309,6 +309,7 @@ export function createBuildchainContractWorld({ root = process.cwd(), packageJso
309
309
  optionalInputs: [
310
310
  "validate",
311
311
  "lifecycle",
312
+ "badges readme",
312
313
  "collect github-release",
313
314
  "verify release-passport",
314
315
  "release-propagation",
@@ -316,6 +317,31 @@ export function createBuildchainContractWorld({ root = process.cwd(), packageJso
316
317
  ],
317
318
  guarantees: [
318
319
  "CLI commands are stable within the major line unless the contract major changes",
320
+ "README badge block checks and writes are generated from machine-readable repository facts",
321
+ ],
322
+ }),
323
+ surface(root, {
324
+ id: "readme-badge-facts",
325
+ kind: "node-api",
326
+ path: "packages/core/readme-badges.js",
327
+ requiredInputs: ["repository checkout"],
328
+ requiredOutputs: ["kungfu-buildchain-readme-badge-facts"],
329
+ breakingDefaults: {
330
+ markerStart: "<!-- buildchain:badges:start -->",
331
+ markerEnd: "<!-- buildchain:badges:end -->",
332
+ kfdPassedSource: "verified repository-owned release passport",
333
+ },
334
+ optionalInputs: [
335
+ "buildchain.toml [badges]",
336
+ "release passport URL or local path",
337
+ "workflow file list",
338
+ "platform declarations",
339
+ ],
340
+ guarantees: [
341
+ "README badge Markdown is a deterministic projection of badge facts",
342
+ "KFD passed badges require the repository's own verified release passport section",
343
+ "unreleased repositories downgrade KFD status to explicit non-passed declarations",
344
+ "CLI and JavaScript callers use the same Node API implementation",
319
345
  ],
320
346
  }),
321
347
  surface(root, {
@@ -11,6 +11,7 @@ export const BUILDCHAIN_AGENT_MANUALS = Object.freeze([
11
11
  { id: "install", title: "Install and verify Buildchain", path: "docs/install.md", plane: "use" },
12
12
  { id: "release-passport", title: "Release Passport protocol", path: "docs/release-passport.md", plane: "verify" },
13
13
  { id: "release-propagation", title: "Release propagation", path: "docs/release-propagation.md", plane: "use" },
14
+ { id: "readme-badges", title: "README badge blocks", path: "docs/readme-badges.md", plane: "use" },
14
15
  { id: "binary-distribution", title: "Binary distribution contract", path: "docs/binary-distribution.md", plane: "verify" },
15
16
  { id: "consumer-issue-reporting", title: "Consumer issue reporting", path: "docs/consumer-issue-reporting.md", plane: "use" },
16
17
  { id: "infra-contract", title: "Infra Contract", path: "docs/infra-contract.md", plane: "use" },
@@ -195,9 +196,11 @@ export function createBuildchainPublicClaimDefinitions() {
195
196
  sourcePaths: [
196
197
  "scripts/generate-site-bundle.mjs",
197
198
  "packages/core/buildchain-kfd-claims.js",
199
+ "packages/core/readme-badges.js",
198
200
  "docs/MAP.md",
199
201
  "docs/site-bundle-contract.md",
200
202
  "docs/cli.md",
203
+ "docs/readme-badges.md",
201
204
  ],
202
205
  artifactPaths: [
203
206
  "dist/site/manual-registry.json",
@@ -207,6 +210,22 @@ export function createBuildchainPublicClaimDefinitions() {
207
210
  "dist/site/site-manifest.json",
208
211
  ],
209
212
  },
213
+ {
214
+ id: "claim:buildchain-readme-badge-facts",
215
+ claim: "Buildchain README status badges are generated from repository-owned facts and verified release-passport evidence, not hand-maintained README prose.",
216
+ sourcePaths: [
217
+ "packages/core/readme-badges.js",
218
+ "bin/buildchain.mjs",
219
+ "docs/readme-badges.md",
220
+ "docs/cli.md",
221
+ "buildchain.toml",
222
+ ],
223
+ artifactPaths: [
224
+ "dist/site/node-api-registry.json",
225
+ "dist/site/manual-registry.json",
226
+ "dist/site/buildchain-contract.json",
227
+ ],
228
+ },
210
229
  {
211
230
  id: "claim:buildchain-floating-contract-lock",
212
231
  claim: "Consumers using floating Buildchain refs can lock the observed runtime contract and receive drift checks before expensive build or publish work proceeds.",
@@ -192,6 +192,17 @@ export {
192
192
  workflowFrictionMarker,
193
193
  } from "./issue-reporting.js";
194
194
 
195
+ export {
196
+ README_BADGE_BLOCK_END,
197
+ README_BADGE_BLOCK_START,
198
+ README_BADGE_FACTS_CONTRACT,
199
+ checkReadmeBadgeBlock,
200
+ collectReadmeBadgeFacts,
201
+ readReadme,
202
+ renderReadmeBadgeBlock,
203
+ updateReadmeBadgeBlock,
204
+ } from "./readme-badges.js";
205
+
195
206
  export {
196
207
  RELEASE_PROPAGATION_GRAPH_CONTRACT,
197
208
  RELEASE_PROPAGATION_LOCK_CONTRACT,