@kungfu-tech/buildchain 3.0.4-alpha.2 → 3.0.4-alpha.3

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 (49) hide show
  1. package/bin/buildchain.mjs +126 -72
  2. package/bin/internal/trust-release-cli.mjs +15 -537
  3. package/bin/internal/trust-release-command-handlers.mjs +14 -0
  4. package/bin/internal/trust-release-inspection-handlers.mjs +175 -0
  5. package/bin/internal/trust-release-release-handlers.mjs +317 -0
  6. package/bin/internal/trust-release-verification-handlers.mjs +306 -0
  7. package/dist/site/buildchain-contract.json +35 -24
  8. package/dist/site/buildchain-site.json +22 -10
  9. package/dist/site/controller-registry.json +16 -3
  10. package/dist/site/kfd-claims.json +9 -7
  11. package/dist/site/kfd-upstream-aggregate.json +1 -1
  12. package/dist/site/manual-registry.json +2 -2
  13. package/dist/site/node-api-registry.json +7 -7
  14. package/dist/site/page-registry.json +9 -4
  15. package/dist/site/public-surface-audit.json +56 -8
  16. package/dist/site/publication-registry.json +4 -4
  17. package/dist/site/release-model.json +7 -0
  18. package/dist/site/site-manifest.json +6 -6
  19. package/dist/site/workflow-registry.json +13 -5
  20. package/docs/MAP.md +1 -1
  21. package/docs/release-propagation.md +166 -8
  22. package/package.json +1 -1
  23. package/packages/core/buildchain-kfd-claims.js +1 -1
  24. package/packages/core/controller-evidence.js +8 -1
  25. package/packages/core/index.js +1 -13
  26. package/packages/core/paper-npm-bootstrap.js +492 -0
  27. package/packages/core/paper.js +271 -669
  28. package/packages/core/public-surface-cli.js +12 -1
  29. package/packages/core/release-passport.js +67 -71
  30. package/packages/core/release-propagation-common.js +64 -0
  31. package/packages/core/release-propagation-execution-profile.js +59 -0
  32. package/packages/core/release-propagation-release.js +196 -0
  33. package/packages/core/release-propagation-stage-evidence.js +364 -0
  34. package/packages/core/release-propagation-work-capture.js +64 -0
  35. package/packages/core/release-propagation-work-constants.js +34 -0
  36. package/packages/core/release-propagation-work-control.js +203 -0
  37. package/packages/core/release-propagation-work-transitions.js +145 -0
  38. package/packages/core/release-propagation-work.js +517 -0
  39. package/packages/core/release-propagation.js +34 -158
  40. package/scripts/aws-windows-jit-controller-core.mjs +269 -0
  41. package/scripts/aws-windows-jit-controller.mjs +502 -0
  42. package/scripts/check-internal-architecture.mjs +178 -52
  43. package/scripts/check-maintainability.mjs +76 -17
  44. package/scripts/generate-site-bundle.mjs +16 -7
  45. package/scripts/maintainability-metrics.mjs +24 -4
  46. package/scripts/release-propagation.mjs +126 -0
  47. package/scripts/resolve-artifact-transfer-mode.mjs +117 -0
  48. package/scripts/web-surface-core.mjs +46 -207
  49. package/scripts/web-surface-routing.mjs +286 -0
@@ -102,10 +102,7 @@ import {
102
102
  TRUST_RELEASE_COMMANDS,
103
103
  dispatchTrustReleaseCommand,
104
104
  } from "./internal/trust-release-cli.mjs";
105
- import {
106
- BUILDCHAIN_COMMAND_REGISTRY,
107
- dispatchRegisteredCommand,
108
- } from "./internal/command-registry.mjs";
105
+ import { dispatchRegisteredCommand } from "./internal/command-registry.mjs";
109
106
 
110
107
  const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
111
108
  const embeddedPackageVersion = process.env.BUILDCHAIN_EMBEDDED_PACKAGE_VERSION || "";
@@ -1226,18 +1223,19 @@ async function runProcessTreeSample(sampleArgs = []) {
1226
1223
  return report;
1227
1224
  }
1228
1225
 
1229
- async function runRegisteredCommand(command, args) {
1230
- if (!command || command === "-h" || command === "--help" || command === "help") {
1226
+ async function handleHelpCommand(args) {
1231
1227
  process.stdout.write(BUILDCHAIN_USAGE);
1232
1228
  return;
1233
- }
1234
1229
 
1235
- if (command === "version" || command === "--version" || command === "-v") {
1230
+ }
1231
+
1232
+ async function handleVersionCommand(args) {
1236
1233
  process.stdout.write(`${packageVersion()}\n`);
1237
1234
  return;
1238
- }
1239
1235
 
1240
- if (command === "layout") {
1236
+ }
1237
+
1238
+ async function handleLayoutCommand(args) {
1241
1239
  const result = createBuildchainLayoutDiscovery({
1242
1240
  cwd: readFlag(args, "cwd", process.cwd()),
1243
1241
  buildchainVersion: packageVersion(),
@@ -1251,9 +1249,10 @@ async function runRegisteredCommand(command, args) {
1251
1249
  process.stdout.write(`- Shifu jurisdiction: ${result.shifu.jurisdiction.field}=${result.shifu.jurisdiction.value}\n`);
1252
1250
  }
1253
1251
  return;
1254
- }
1255
1252
 
1256
- if (command === "portable-cache") {
1253
+ }
1254
+
1255
+ async function handlePortableCacheCommand(args) {
1257
1256
  const [subcommand = "", ...cacheArgs] = args;
1258
1257
  if (subcommand === "plan") {
1259
1258
  const manifestValue = readFlag(cacheArgs, "manifest", "");
@@ -1296,9 +1295,10 @@ async function runRegisteredCommand(command, args) {
1296
1295
  return;
1297
1296
  }
1298
1297
  throw new Error("usage: buildchain portable-cache <plan|receipt> ...");
1299
- }
1300
1298
 
1301
- if (command === "candidate") {
1299
+ }
1300
+
1301
+ async function handleCandidateCommand(args) {
1302
1302
  const [subcommand = "", ...candidateArgs] = args;
1303
1303
  if (subcommand !== "timeline") {
1304
1304
  throw new Error("usage: buildchain candidate timeline --input <file-or-json>");
@@ -1318,9 +1318,10 @@ async function runRegisteredCommand(command, args) {
1318
1318
  process.stdout.write(`wrote: ${output}\n`);
1319
1319
  }
1320
1320
  return;
1321
- }
1322
1321
 
1323
- if (command === "init") {
1322
+ }
1323
+
1324
+ async function handleInitCommand(args) {
1324
1325
  const result = initBuildchainRepo({
1325
1326
  cwd: readFlag(args, "cwd", process.cwd()),
1326
1327
  type: readFlag(args, "type", "package"),
@@ -1331,9 +1332,10 @@ async function runRegisteredCommand(command, args) {
1331
1332
  });
1332
1333
  printJson(result);
1333
1334
  return;
1334
- }
1335
1335
 
1336
- if (command === "validate") {
1336
+ }
1337
+
1338
+ async function handleValidateCommand(args) {
1337
1339
  const lifecycleStages = readFlag(args, "require-lifecycle-stages", "")
1338
1340
  .split(",")
1339
1341
  .map((entry) => entry.trim())
@@ -1343,9 +1345,10 @@ async function runRegisteredCommand(command, args) {
1343
1345
  requireLifecycleStages: lifecycleStages,
1344
1346
  }));
1345
1347
  return;
1346
- }
1347
1348
 
1348
- if (command === "doctor") {
1349
+ }
1350
+
1351
+ async function handleDoctorCommand(args) {
1349
1352
  const result = runDoctor({
1350
1353
  cwd: readFlag(args, "cwd", process.cwd()),
1351
1354
  requirePublishSourceLock: readBooleanFlag(args, "require-publish-source-lock"),
@@ -1359,18 +1362,20 @@ async function runRegisteredCommand(command, args) {
1359
1362
  }
1360
1363
  }
1361
1364
  return;
1362
- }
1363
1365
 
1364
- if (command === "dev") {
1366
+ }
1367
+
1368
+ async function handleDevCommand(args) {
1365
1369
  const [subcommand = "", ...devArgs] = args;
1366
1370
  if (subcommand !== "merge-queue") {
1367
1371
  throw new Error("usage: buildchain dev merge-queue --repository <owner/repo> --branch <dev/vN/vN.M> [--from-config | --workflow <path>...]");
1368
1372
  }
1369
1373
  runScript("dev-merge-queue.mjs", devArgs);
1370
1374
  return;
1371
- }
1372
1375
 
1373
- if (command === "log") {
1376
+ }
1377
+
1378
+ async function handleLogCommand(args) {
1374
1379
  const [levelOrSubcommand = "info", ...logArgs] = args;
1375
1380
  if (levelOrSubcommand === "summary") {
1376
1381
  const logPath = defaultCliLogPath(logArgs);
@@ -1407,9 +1412,10 @@ async function runRegisteredCommand(command, args) {
1407
1412
  printJson(event);
1408
1413
  }
1409
1414
  return;
1410
- }
1411
1415
 
1412
- if (command === "diagnostics") {
1416
+ }
1417
+
1418
+ async function handleDiagnosticsCommand(args) {
1413
1419
  const [subcommand = "", ...diagnosticsArgs] = args;
1414
1420
  if (subcommand !== "summary") {
1415
1421
  throw new Error("usage: buildchain diagnostics summary <diagnostics.json>...");
@@ -1438,28 +1444,32 @@ async function runRegisteredCommand(command, args) {
1438
1444
  }
1439
1445
  }
1440
1446
  return;
1441
- }
1442
1447
 
1443
- if (command === "facts") {
1448
+ }
1449
+
1450
+ async function handleFactsCommand(args) {
1444
1451
  await runBuildFactsCli(args);
1445
1452
  return;
1446
- }
1447
1453
 
1448
- if (command === "kfd") {
1454
+ }
1455
+
1456
+ async function handleKfdCommand(args) {
1449
1457
  await runKfdCli(args);
1450
1458
  return;
1451
- }
1452
1459
 
1453
- if (command === "sample") {
1460
+ }
1461
+
1462
+ async function handleSampleCommand(args) {
1454
1463
  const [subcommand = "", ...sampleArgs] = args;
1455
1464
  if (subcommand !== "process-tree") {
1456
1465
  throw new Error("usage: buildchain sample process-tree -- <command> [args...]");
1457
1466
  }
1458
1467
  await runProcessTreeSample(sampleArgs);
1459
1468
  return;
1460
- }
1461
1469
 
1462
- if (command === "mark") {
1470
+ }
1471
+
1472
+ async function handleMarkCommand(args) {
1463
1473
  const eventName = readFlag(args, "event", "");
1464
1474
  if (!eventName) {
1465
1475
  throw new Error("buildchain mark requires --event <name>");
@@ -1473,9 +1483,10 @@ async function runRegisteredCommand(command, args) {
1473
1483
  printJson(event);
1474
1484
  }
1475
1485
  return;
1476
- }
1477
1486
 
1478
- if (command === "span") {
1487
+ }
1488
+
1489
+ async function handleSpanCommand(args) {
1479
1490
  const separator = args.indexOf("--");
1480
1491
  const spanArgs = separator === -1 ? args : args.slice(0, separator);
1481
1492
  const commandArgs = separator === -1 ? [] : args.slice(separator + 1);
@@ -1517,9 +1528,10 @@ async function runRegisteredCommand(command, args) {
1517
1528
  attributes: readAttributes(spanArgs),
1518
1529
  });
1519
1530
  return;
1520
- }
1521
1531
 
1522
- if (command === "lifecycle") {
1532
+ }
1533
+
1534
+ async function handleLifecycleCommand(args) {
1523
1535
  const [subcommand, stageName = "", ...lifecycleArgs] = args;
1524
1536
  if (subcommand !== "run" || !stageName) {
1525
1537
  throw new Error("usage: buildchain lifecycle run <stage>");
@@ -1540,9 +1552,10 @@ async function runRegisteredCommand(command, args) {
1540
1552
  });
1541
1553
  printJson(manifest);
1542
1554
  return;
1543
- }
1544
1555
 
1545
- if (command === "npm") {
1556
+ }
1557
+
1558
+ async function handleNpmCommand(args) {
1546
1559
  const [subcommand = "", ...npmArgs] = args;
1547
1560
  if (subcommand !== "dry-run") {
1548
1561
  throw new Error("usage: buildchain npm dry-run");
@@ -1561,24 +1574,28 @@ async function runRegisteredCommand(command, args) {
1561
1574
  process.stdout.write(`pack entries: ${result.pack.entryCount}\n`);
1562
1575
  }
1563
1576
  return;
1564
- }
1565
1577
 
1566
- if (TRUST_RELEASE_COMMANDS.has(command)) {
1578
+ }
1579
+
1580
+ async function handleTrustReleaseCommand(args, { command }) {
1567
1581
  await dispatchTrustReleaseCommand({ command, args, runScript, packageVersion });
1568
1582
  return;
1569
- }
1570
1583
 
1571
- if (command === "web-surface") {
1584
+ }
1585
+
1586
+ async function handleWebSurfaceCommand(args) {
1572
1587
  runScript("web-surface.mjs", args);
1573
1588
  return;
1574
- }
1575
1589
 
1576
- if (command === "infra-contract") {
1590
+ }
1591
+
1592
+ async function handleInfraContractCommand(args) {
1577
1593
  runScript("infra-contract.mjs", args);
1578
1594
  return;
1579
- }
1580
1595
 
1581
- if (command === "publication-artifact" || command === "publication") {
1596
+ }
1597
+
1598
+ async function handlePublicationArtifactCommand(args) {
1582
1599
  if (args[0] === "npm-package" || args[0] === "package") {
1583
1600
  runPublicationPackageCli(args.slice(1));
1584
1601
  return;
@@ -1589,9 +1606,10 @@ async function runRegisteredCommand(command, args) {
1589
1606
  }
1590
1607
  runPublicationArtifactCli(args);
1591
1608
  return;
1592
- }
1593
1609
 
1594
- if (command === "paper") {
1610
+ }
1611
+
1612
+ async function handlePaperCommand(args) {
1595
1613
  await runPaperCli(args, {
1596
1614
  buildchainRoot: root,
1597
1615
  buildchainVersion: packageVersion(),
@@ -1600,39 +1618,46 @@ async function runRegisteredCommand(command, args) {
1600
1618
  process.env.BUILDCHAIN_RUNTIME_SHA || embeddedSourceSha || "",
1601
1619
  });
1602
1620
  return;
1603
- }
1604
1621
 
1605
- if (command === "release-propagation") {
1622
+ }
1623
+
1624
+ async function handleReleasePropagationCommand(args) {
1606
1625
  runReleasePropagationCli(args);
1607
1626
  return;
1608
- }
1609
1627
 
1610
- if (command === "release-governance") {
1628
+ }
1629
+
1630
+ async function handleReleaseGovernanceCommand(args) {
1611
1631
  await runReleaseGovernanceCli(args);
1612
1632
  return;
1613
- }
1614
1633
 
1615
- if (command === "github-governance") {
1634
+ }
1635
+
1636
+ async function handleGitHubGovernanceCommand(args) {
1616
1637
  runScript("reconcile-github-governance.mjs", args);
1617
1638
  return;
1618
- }
1619
1639
 
1620
- if (command === "badges") {
1640
+ }
1641
+
1642
+ async function handleBadgesCommand(args) {
1621
1643
  await runReadmeBadgesCli(args);
1622
1644
  return;
1623
- }
1624
1645
 
1625
- if (command === "homebrew") {
1646
+ }
1647
+
1648
+ async function handleHomebrewCommand(args) {
1626
1649
  await runHomebrewCli(args);
1627
1650
  return;
1628
- }
1629
1651
 
1630
- if (command === "build-contract") {
1652
+ }
1653
+
1654
+ async function handleBuildContractCommand(args) {
1631
1655
  runScript("resolve-build-contract.mjs", args);
1632
1656
  return;
1633
- }
1634
1657
 
1635
- if (command === "publish-source") {
1658
+ }
1659
+
1660
+ async function handlePublishSourceCommand(args) {
1636
1661
  const [mode = "lock", ...publishArgs] = args;
1637
1662
  if (mode === "lock" || mode === "manifest") {
1638
1663
  runScript("resolve-publish-source.mjs", ["--mode", mode, ...publishArgs]);
@@ -1665,17 +1690,46 @@ async function runRegisteredCommand(command, args) {
1665
1690
  return;
1666
1691
  }
1667
1692
  throw new Error(`unsupported publish-source command: ${mode}`);
1668
- }
1669
1693
 
1670
- throw new Error(`unsupported buildchain command: ${command}`);
1671
1694
  }
1672
1695
 
1673
- const BUILDCHAIN_COMMAND_HANDLERS = Object.freeze(Object.fromEntries(
1674
- BUILDCHAIN_COMMAND_REGISTRY.map((entry) => [
1675
- entry.id,
1676
- (args) => runRegisteredCommand(entry.id, args),
1677
- ]),
1678
- ));
1696
+ const BUILDCHAIN_COMMAND_HANDLERS = Object.freeze({
1697
+ "help": handleHelpCommand,
1698
+ "version": handleVersionCommand,
1699
+ "layout": handleLayoutCommand,
1700
+ "portable-cache": handlePortableCacheCommand,
1701
+ "candidate": handleCandidateCommand,
1702
+ "init": handleInitCommand,
1703
+ "validate": handleValidateCommand,
1704
+ "doctor": handleDoctorCommand,
1705
+ "dev": handleDevCommand,
1706
+ "log": handleLogCommand,
1707
+ "diagnostics": handleDiagnosticsCommand,
1708
+ "facts": handleFactsCommand,
1709
+ "kfd": handleKfdCommand,
1710
+ "sample": handleSampleCommand,
1711
+ "mark": handleMarkCommand,
1712
+ "span": handleSpanCommand,
1713
+ "lifecycle": handleLifecycleCommand,
1714
+ "npm": handleNpmCommand,
1715
+ ...Object.fromEntries(
1716
+ [...TRUST_RELEASE_COMMANDS].map((command) => [
1717
+ command,
1718
+ (args) => handleTrustReleaseCommand(args, { command }),
1719
+ ]),
1720
+ ),
1721
+ "web-surface": handleWebSurfaceCommand,
1722
+ "infra-contract": handleInfraContractCommand,
1723
+ "publication-artifact": handlePublicationArtifactCommand,
1724
+ "paper": handlePaperCommand,
1725
+ "release-propagation": handleReleasePropagationCommand,
1726
+ "release-governance": handleReleaseGovernanceCommand,
1727
+ "github-governance": handleGitHubGovernanceCommand,
1728
+ "badges": handleBadgesCommand,
1729
+ "homebrew": handleHomebrewCommand,
1730
+ "build-contract": handleBuildContractCommand,
1731
+ "publish-source": handlePublishSourceCommand,
1732
+ });
1679
1733
 
1680
1734
  async function main(argv = process.argv.slice(2)) {
1681
1735
  const [command = "help", ...args] = argv;