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

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.
@@ -36,6 +36,12 @@ import {
36
36
  readReadme,
37
37
  updateReadmeBadgeBlock,
38
38
  } from "../packages/core/readme-badges.js";
39
+ import {
40
+ checkHomebrewTap,
41
+ collectHomebrewTapFacts,
42
+ renderHomebrewFormula,
43
+ updateHomebrewTap,
44
+ } from "../packages/core/homebrew.js";
39
45
  import {
40
46
  BUILDCHAIN_PROCESS_SAMPLE_REPORT_CONTRACT,
41
47
  formatDiagnosticsSummaryTable,
@@ -122,6 +128,8 @@ function usage() {
122
128
  buildchain infra-contract ...
123
129
  buildchain release-propagation <plan|write-lock> ...
124
130
  buildchain badges readme [--cwd <dir>] [--readme <path>] [--check] [--write] [--json]
131
+ buildchain homebrew update-formula --package <name> --release-passport <file-or-url> [--write] [--json]
132
+ buildchain homebrew check [--cwd <dir>] [--package <name>] [--release-passport <file-or-url>] [--json]
125
133
  buildchain publish-source <lock|manifest|verify-lock|verify-channel-ref|validate-anchored-release> ...
126
134
  buildchain build-contract ...
127
135
 
@@ -337,6 +345,78 @@ async function runReadmeBadgesCli(args = []) {
337
345
  printJson(facts);
338
346
  }
339
347
 
348
+ async function runHomebrewCli(args = []) {
349
+ const [subcommand = "", ...homebrewArgs] = args;
350
+ const cwd = path.resolve(readFlag(homebrewArgs, "cwd", process.cwd()));
351
+ const packageName = readFlag(homebrewArgs, "package", "buildchain");
352
+ const releasePassport = readFlag(homebrewArgs, "release-passport", "");
353
+ const manifestPath = readFlag(homebrewArgs, "manifest", "tap-manifest.json");
354
+ const formulaPath = readFlag(homebrewArgs, "formula", "");
355
+ const json = readBooleanFlag(homebrewArgs, "json");
356
+ if (subcommand === "update-formula") {
357
+ if (!releasePassport) {
358
+ throw new Error("buildchain homebrew update-formula requires --release-passport <file-or-url>");
359
+ }
360
+ if (readBooleanFlag(homebrewArgs, "write")) {
361
+ const result = await updateHomebrewTap({
362
+ cwd,
363
+ packageName,
364
+ releasePassport,
365
+ manifestPath,
366
+ formulaPath,
367
+ write: true,
368
+ });
369
+ if (json) {
370
+ printJson(result);
371
+ } else {
372
+ process.stdout.write(`buildchain homebrew update-formula: wrote ${result.written.join(", ")}\n`);
373
+ }
374
+ return;
375
+ }
376
+ const facts = await collectHomebrewTapFacts({
377
+ cwd,
378
+ packageName,
379
+ releasePassport,
380
+ manifestPath,
381
+ formulaPath,
382
+ });
383
+ if (json) {
384
+ printJson({
385
+ schemaVersion: 1,
386
+ contract: "kungfu-buildchain-homebrew-formula-render",
387
+ facts,
388
+ formula: renderHomebrewFormula(facts),
389
+ manifest: facts.manifestProjection,
390
+ });
391
+ } else {
392
+ process.stdout.write(renderHomebrewFormula(facts));
393
+ }
394
+ return;
395
+ }
396
+ if (subcommand === "check") {
397
+ const report = await checkHomebrewTap({
398
+ cwd,
399
+ packageName,
400
+ releasePassport,
401
+ manifestPath,
402
+ formulaPath,
403
+ });
404
+ if (json) {
405
+ printJson(report);
406
+ } else {
407
+ process.stdout.write(`buildchain homebrew check: ${report.ok ? "ok" : "failed"}\n`);
408
+ for (const check of report.checks) {
409
+ process.stdout.write(`- ${check.status}: ${check.id}: ${check.message}\n`);
410
+ }
411
+ }
412
+ if (!report.ok) {
413
+ process.exitCode = 1;
414
+ }
415
+ return;
416
+ }
417
+ throw new Error("usage: buildchain homebrew <update-formula|check> ...");
418
+ }
419
+
340
420
  function appendJsonLine(filePath, value) {
341
421
  if (!filePath) {
342
422
  return "";
@@ -1016,6 +1096,11 @@ async function main(argv = process.argv.slice(2)) {
1016
1096
  return;
1017
1097
  }
1018
1098
 
1099
+ if (command === "homebrew") {
1100
+ await runHomebrewCli(args);
1101
+ return;
1102
+ }
1103
+
1019
1104
  if (command === "build-contract") {
1020
1105
  runScript("resolve-build-contract.mjs", args);
1021
1106
  return;
@@ -4,7 +4,7 @@
4
4
  "product": {
5
5
  "name": "Buildchain",
6
6
  "package": "@kungfu-tech/buildchain",
7
- "version": "2.8.16-alpha.1",
7
+ "version": "2.8.16-alpha.2",
8
8
  "repository": "https://github.com/kungfu-systems/buildchain"
9
9
  },
10
10
  "majorLine": "v2",
@@ -134,7 +134,7 @@
134
134
  "breaking contract drift fails closed before rendering, deployment, or release publication"
135
135
  ],
136
136
  "breakingDigest": "sha256:82ee63cb336e40d832dfff4a1c5e6cbfa221a4fc8b2359990033bc931bffc43a",
137
- "auditDigest": "sha256:5416c9f4112bf24e7cef556f792034842252f65dcf9e8adf338ddc85a5137ada"
137
+ "auditDigest": "sha256:8de5899084cd0eebc93f5ac549b73c5ff313ac43067875d08b4ca8607d81fbf8"
138
138
  },
139
139
  {
140
140
  "contractVersion": 1,
@@ -235,7 +235,7 @@
235
235
  "release-state SHA is recorded as a durable audit entrance"
236
236
  ],
237
237
  "breakingDigest": "sha256:b627e1b2ece9b6049517a942c5139e342e6077cdd3d8962d61cef8481b1f70ad",
238
- "auditDigest": "sha256:4d88ba7178753d2d1488f6393fee7c086dfb660f42e6507db718dccd38bf8a34"
238
+ "auditDigest": "sha256:e4a79237c0363b60fe084393068f6bc7da526bb9c5912b60d747b75364506b32"
239
239
  },
240
240
  {
241
241
  "contractVersion": 1,
@@ -284,7 +284,7 @@
284
284
  "prose-only public claims downgrade the release trust passport audit"
285
285
  ],
286
286
  "breakingDigest": "sha256:f0b636eb925ddbf45ff1a8872454ab7b4dd98857cac12bb75217830130e62a16",
287
- "auditDigest": "sha256:4d88ba7178753d2d1488f6393fee7c086dfb660f42e6507db718dccd38bf8a34"
287
+ "auditDigest": "sha256:e4a79237c0363b60fe084393068f6bc7da526bb9c5912b60d747b75364506b32"
288
288
  },
289
289
  {
290
290
  "contractVersion": 1,
@@ -332,6 +332,8 @@
332
332
  "validate",
333
333
  "lifecycle",
334
334
  "badges readme",
335
+ "homebrew update-formula",
336
+ "homebrew check",
335
337
  "collect github-release",
336
338
  "verify release-passport",
337
339
  "release-propagation",
@@ -342,7 +344,42 @@
342
344
  "README badge block checks and writes are generated from machine-readable repository facts"
343
345
  ],
344
346
  "breakingDigest": "sha256:90a73892b2d6c214048448d5f45df75639bdf7b7e8fefd9c596e04b087407bcc",
345
- "auditDigest": "sha256:af247c9ce9227e64e07344fee30d718646ed66ada69b6e1d6155a7f33ff1005e"
347
+ "auditDigest": "sha256:b7cd109f1c81166fb912eced4b6d9aaa838ac537242197efd221e209da638d79"
348
+ },
349
+ {
350
+ "contractVersion": 1,
351
+ "stability": "stable",
352
+ "additiveChanges": "optional inputs, optional outputs, diagnostics, and documentation may be added within the same major line",
353
+ "id": "homebrew-distribution-index",
354
+ "kind": "node-api",
355
+ "path": "packages/core/homebrew.js",
356
+ "requiredInputs": [
357
+ "upstream release passport"
358
+ ],
359
+ "requiredOutputs": [
360
+ "kungfu-buildchain-homebrew-tap-facts",
361
+ "kungfu-buildchain-homebrew-tap-manifest",
362
+ "Formula/*.rb"
363
+ ],
364
+ "breakingDefaults": {
365
+ "projectType": "distribution-index",
366
+ "tapManifest": "tap-manifest.json",
367
+ "kfdPassedSource": "verified upstream release passport"
368
+ },
369
+ "optionalInputs": [
370
+ "buildchain.toml [project] type=distribution-index",
371
+ "Formula path",
372
+ "manifest path",
373
+ "release passport URL or local path"
374
+ ],
375
+ "guarantees": [
376
+ "Formula metadata is a deterministic projection of upstream release passport evidence",
377
+ "tap-manifest.json is checked against upstream version, URLs, SHA-256 digests, and KFD status",
378
+ "KFD passed claims fail closed unless the upstream release passport verifies the corresponding section",
379
+ "CLI and JavaScript callers use the same Node API implementation"
380
+ ],
381
+ "breakingDigest": "sha256:148c0387ff4cea76433bbde80cd9d77c5aa67e1a29856ced33e4d819366f2213",
382
+ "auditDigest": "sha256:0e978219bd6fca754d80a616d538d5825b116eec78b65857bbe5063b8c84d933"
346
383
  },
347
384
  {
348
385
  "contractVersion": 1,
@@ -397,7 +434,7 @@
397
434
  "manual entries carry source file digests so downstream sites and agents can detect stale hand-written documentation"
398
435
  ],
399
436
  "breakingDigest": "sha256:7d0d2819e3a3e72989d9c57b5efe9d0bc0a79bc0f2c82a0c7b9d6c5a211a91f2",
400
- "auditDigest": "sha256:99fd5e862e5a29eb10b0ec5a7a5e06d9ab7a594bd7b345bfcb8d45a0a099b9fc"
437
+ "auditDigest": "sha256:77b5234de4d1ac60b8291e63b21562cdf88c1ab33a369e1f0cccb1e75a62e492"
401
438
  },
402
439
  {
403
440
  "contractVersion": 1,
@@ -419,9 +456,9 @@
419
456
  "agents can discover supported Node APIs without importing internal file paths"
420
457
  ],
421
458
  "breakingDigest": "sha256:48f925608d3e2131d90936b07dc2a30341204cae3e6e785c0f77d61ad755c945",
422
- "auditDigest": "sha256:e1fae05f9ab0186e9423464b7e4bcb9bfefe4185fe0925a0b95368fb97f1cd41"
459
+ "auditDigest": "sha256:587d0f465af8e3f1d871e469601999f57ac4911f3a84973fc6910b2db7555667"
423
460
  }
424
461
  ],
425
- "compatibilityDigest": "sha256:217f7764849bf779cbc70aea9da59429a44c68f5f7131b26593bb18a6e7ffb18",
426
- "contractDigest": "sha256:242f4e40e1768fddb28264561efcfaf3a206b3907c35f08143d4b98a4e13b527"
462
+ "compatibilityDigest": "sha256:407d6d5ee6a96a34d2cc30db9ac64cf4b1819ab6d77bd7a57a07a124f22101ca",
463
+ "contractDigest": "sha256:df8e273c2225f1564d77e4089e5d0128746df3c121c9ccfa85082fff1a616ecb"
427
464
  }