@kungfu-tech/buildchain 3.0.4-alpha.1 → 3.0.4-alpha.11

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 (71) hide show
  1. package/AGENTS.md +14 -5
  2. package/README.md +18 -0
  3. package/bin/buildchain.mjs +136 -73
  4. package/bin/internal/trust-release-cli.mjs +15 -537
  5. package/bin/internal/trust-release-command-handlers.mjs +14 -0
  6. package/bin/internal/trust-release-inspection-handlers.mjs +175 -0
  7. package/bin/internal/trust-release-release-handlers.mjs +317 -0
  8. package/bin/internal/trust-release-verification-handlers.mjs +306 -0
  9. package/dist/site/buildchain-contract.json +35 -24
  10. package/dist/site/buildchain-site.json +1474 -61
  11. package/dist/site/capability-registry.json +8 -5
  12. package/dist/site/cli-registry.json +1869 -0
  13. package/dist/site/controller-registry.json +16 -3
  14. package/dist/site/kfd-claims.json +84 -10
  15. package/dist/site/kfd-upstream-aggregate.json +1 -1
  16. package/dist/site/manual-registry.json +49 -6
  17. package/dist/site/node-api-registry.json +17802 -11
  18. package/dist/site/page-registry.json +1441 -59
  19. package/dist/site/public-surface-audit.json +2863 -358
  20. package/dist/site/publication-registry.json +4 -4
  21. package/dist/site/release-model.json +7 -0
  22. package/dist/site/site-manifest.json +34 -10
  23. package/dist/site/workflow-registry.json +13 -5
  24. package/docs/MAP.md +21 -6
  25. package/docs/cli-reference.md +1936 -0
  26. package/docs/cli.md +15 -1
  27. package/docs/getting-started.md +167 -0
  28. package/docs/install.md +7 -8
  29. package/docs/node-api-reference.md +1952 -0
  30. package/docs/release-propagation.md +166 -8
  31. package/docs/site-bundle-contract.md +10 -4
  32. package/docs/versioning.md +5 -4
  33. package/package.json +8 -5
  34. package/packages/core/buildchain-agent-manuals.js +37 -0
  35. package/packages/core/buildchain-kfd-claims.js +4 -37
  36. package/packages/core/controller-evidence.js +8 -1
  37. package/packages/core/index.js +1 -13
  38. package/packages/core/paper-agent-entry.js +14 -11
  39. package/packages/core/paper-fleet.js +34 -7
  40. package/packages/core/paper-npm-bootstrap.js +492 -0
  41. package/packages/core/paper-repository.js +1 -0
  42. package/packages/core/paper.js +346 -671
  43. package/packages/core/public-surface-cli.js +12 -1
  44. package/packages/core/publication-package.js +7 -0
  45. package/packages/core/release-passport.js +67 -71
  46. package/packages/core/release-propagation-common.js +64 -0
  47. package/packages/core/release-propagation-execution-profile.js +59 -0
  48. package/packages/core/release-propagation-release.js +196 -0
  49. package/packages/core/release-propagation-stage-evidence.js +364 -0
  50. package/packages/core/release-propagation-work-capture.js +64 -0
  51. package/packages/core/release-propagation-work-constants.js +34 -0
  52. package/packages/core/release-propagation-work-control.js +203 -0
  53. package/packages/core/release-propagation-work-transitions.js +145 -0
  54. package/packages/core/release-propagation-work.js +517 -0
  55. package/packages/core/release-propagation.js +34 -158
  56. package/scripts/aws-windows-jit-controller-core.mjs +269 -0
  57. package/scripts/aws-windows-jit-controller.mjs +502 -0
  58. package/scripts/check-internal-architecture.mjs +178 -52
  59. package/scripts/check-inventory.mjs +2 -2
  60. package/scripts/check-maintainability.mjs +76 -17
  61. package/scripts/generate-public-reference.mjs +68 -0
  62. package/scripts/generate-site-bundle.mjs +35 -41
  63. package/scripts/maintainability-metrics.mjs +24 -4
  64. package/scripts/paper-work-fleet-cli.mjs +22 -3
  65. package/scripts/public-reference.mjs +557 -0
  66. package/scripts/release-propagation.mjs +126 -0
  67. package/scripts/resolve-artifact-transfer-mode.mjs +117 -0
  68. package/scripts/site-reference-registry.mjs +174 -0
  69. package/scripts/verify-golden-path.mjs +169 -0
  70. package/scripts/web-surface-core.mjs +46 -207
  71. package/scripts/web-surface-routing.mjs +286 -0
@@ -35,6 +35,12 @@ import {
35
35
  import { createSurfaceTimestampPolicy } from "../packages/core/surface-manifest.js";
36
36
  import { cliCommandMeta, nodeApiMeta } from "./site-capability-metadata.mjs";
37
37
  import { projectHomepageIntro } from "./site-bundle-homepage.mjs";
38
+ import { BUILDCHAIN_USAGE } from "./buildchain-cli-help.mjs";
39
+ import {
40
+ cliReferenceById,
41
+ createCliReference,
42
+ } from "./public-reference.mjs";
43
+ import { createSiteNodeApiRegistry } from "./site-reference-registry.mjs";
38
44
  import {
39
45
  BUILDCHAIN_COMMAND_REGISTRY,
40
46
  resolveBuildchainCommand,
@@ -341,9 +347,12 @@ function publicSurfaceLifecycle({ owner, maturity, nonDuplicationRationale }) {
341
347
 
342
348
  const manualMetaById = new Map(Object.entries({
343
349
  map: { capabilityGroup: "getting-started", audience: ["agent", "consumer"], maturity: "stable", order: 10 },
350
+ "getting-started": { capabilityGroup: "getting-started", audience: ["consumer", "agent"], maturity: "stable", order: 15 },
344
351
  install: { capabilityGroup: "getting-started", audience: ["consumer"], maturity: "stable", order: 20 },
345
352
  "product-mechanism": { capabilityGroup: "getting-started", audience: ["agent", "maintainer"], maturity: "stable", order: 30 },
346
353
  cli: { capabilityGroup: "api-cli-reference", audience: ["agent", "developer"], maturity: "stable", order: 40 },
354
+ "cli-reference": { capabilityGroup: "api-cli-reference", audience: ["agent", "developer", "operator"], maturity: "stable", order: 42 },
355
+ "node-api-reference": { capabilityGroup: "api-cli-reference", audience: ["agent", "developer"], maturity: "stable", order: 44 },
347
356
  "release-passport": { capabilityGroup: "release-passport-trust", audience: ["release-operator", "agent"], maturity: "stable", order: 100 },
348
357
  "github-artifact-attestation": { capabilityGroup: "release-passport-trust", audience: ["release-operator", "agent"], maturity: "preview", order: 108 },
349
358
  "publication-authority": { capabilityGroup: "release-passport-trust", audience: ["release-operator", "agent"], maturity: "preview", order: 105 },
@@ -409,6 +418,8 @@ function pageCapabilityMeta(relPath, category) {
409
418
 
410
419
  function createCliRegistry(packageJson) {
411
420
  const commands = enumerateCliCommandsFromBin({ root });
421
+ const reference = createCliReference(BUILDCHAIN_USAGE);
422
+ const referenceById = cliReferenceById(reference);
412
423
  const documentedTopLevelCommands = new Set();
413
424
  for (const entry of commands) {
414
425
  const command = entry.usage.split(/\s+/)[1] || "";
@@ -433,6 +444,13 @@ function createCliRegistry(packageJson) {
433
444
  const meta = cliCommandMeta(entry.id);
434
445
  return {
435
446
  ...entry,
447
+ ...(referenceById.get(entry.id) || {
448
+ paths: [],
449
+ syntaxes: [],
450
+ options: [],
451
+ aliases: [],
452
+ helpCommands: [],
453
+ }),
436
454
  purpose: meta.purpose,
437
455
  capabilityGroup: meta.capabilityGroup,
438
456
  audience: meta.audience,
@@ -621,6 +639,21 @@ function createPublicationReleaseRegistry({ packageJson, timestampPolicy }) {
621
639
  };
622
640
  }
623
641
 
642
+ const RELEASE_PROPAGATION_MODEL = {
643
+ graphContract: "kungfu-buildchain-release-propagation-graph",
644
+ planContract: "kungfu-buildchain-release-propagation-plan",
645
+ lockContract: "kungfu-buildchain-release-propagation-lock",
646
+ workContract: "kungfu-buildchain-release-propagation-work",
647
+ stageReceiptContract: "kungfu-buildchain-release-propagation-stage-receipt",
648
+ workControlBindings: [
649
+ "kungfu.assignment-graph.work-ref/v1",
650
+ "kungfu.work-control.initiative-family-state/v2",
651
+ ],
652
+ completionBoundary: "production-online-readback-plus-accepted-work-control-decision",
653
+ defaultChannelPolicy: "preserve",
654
+ defaultChannelMap: { alpha: "alpha", release: "release" },
655
+ };
656
+
624
657
  function buildSiteBundle() {
625
658
  const packageJson = readJson("package.json");
626
659
  const inventory = readJson("tests/buildchain-inventory.json");
@@ -723,40 +756,7 @@ function buildSiteBundle() {
723
756
  pages,
724
757
  };
725
758
 
726
- const nodeApiRegistry = {
727
- schemaVersion: 1,
728
- contract: "kungfu-buildchain-node-api-registry",
729
- package: packageJson.name,
730
- moduleSystem: packageJson.type || "module",
731
- exports: Object.entries(packageJson.exports || {})
732
- .filter(([specifier]) => !specifier.startsWith("./site/") && specifier !== "./package.json")
733
- .map(([specifier, target]) => {
734
- const meta = nodeApiMeta(specifier);
735
- return {
736
- specifier: specifier === "." ? packageJson.name : `${packageJson.name}/${specifier.replace(/^\.\//, "")}`,
737
- export: specifier,
738
- target,
739
- digest: typeof target === "string" ? sha256File(target.replace(/^\.\//, "")) : "",
740
- summary: meta.summary,
741
- capabilityGroup: meta.capabilityGroup,
742
- audience: meta.audience,
743
- ...publicSurfaceLifecycle({
744
- owner: "buildchain-core",
745
- maturity: meta.maturity,
746
- nonDuplicationRationale: "Existing package subpath retained as the canonical API boundary for this capability.",
747
- }),
748
- };
749
- }),
750
- docs: [
751
- { id: "cli-and-node-package", path: "docs/cli.md", digest: sha256File("docs/cli.md") },
752
- { id: "build-facts", path: "docs/build-facts.md", digest: sha256File("docs/build-facts.md") },
753
- { id: "kfd-support", path: "docs/kfd-support.md", digest: sha256File("docs/kfd-support.md") },
754
- { id: "readme-badges", path: "docs/readme-badges.md", digest: sha256File("docs/readme-badges.md") },
755
- { id: "homebrew", path: "docs/homebrew.md", digest: sha256File("docs/homebrew.md") },
756
- { id: "site-bundle-contract", path: "docs/site-bundle-contract.md", digest: sha256File("docs/site-bundle-contract.md") },
757
- ],
758
- guidance: "These are the public Node import surfaces shipped by the npm package. Agents should prefer these exports over internal file paths.",
759
- };
759
+ const nodeApiRegistry = createSiteNodeApiRegistry({ root, packageJson, nodeApiMeta, sha256File, publicSurfaceLifecycle });
760
760
 
761
761
  const workflowRegistry = {
762
762
  schemaVersion: 1,
@@ -857,13 +857,7 @@ function buildSiteBundle() {
857
857
  schema: "schemas/release-passport-v1.schema.json",
858
858
  checkManifest: "release-passport-check-manifest.json",
859
859
  },
860
- releasePropagation: {
861
- graphContract: "kungfu-buildchain-release-propagation-graph",
862
- planContract: "kungfu-buildchain-release-propagation-plan",
863
- lockContract: "kungfu-buildchain-release-propagation-lock",
864
- defaultChannelPolicy: "preserve",
865
- defaultChannelMap: { alpha: "alpha", release: "release" },
866
- },
860
+ releasePropagation: RELEASE_PROPAGATION_MODEL,
867
861
  npm: {
868
862
  package: packageJson.name,
869
863
  command: packageJson.bin?.buildchain || "",
@@ -174,10 +174,12 @@ function architectureSummary(root, revision = "") {
174
174
  const implementationPaths = new Set(
175
175
  index.capabilities.flatMap((entry) => entry.implementation || []),
176
176
  );
177
- const graph = new Map(
178
- [...implementationPaths].map((file) => [file, new Set()]),
177
+ const repositorySources = trackedFiles(root, revision).filter(
178
+ isHandMaintainedSource,
179
179
  );
180
- for (const file of implementationPaths) {
180
+ const repositorySourceSet = new Set(repositorySources);
181
+ const graph = new Map(repositorySources.map((file) => [file, new Set()]));
182
+ for (const file of repositorySources) {
181
183
  if (!JS_EXTENSIONS.has(path.extname(file))) continue;
182
184
  for (const specifier of relativeImports(
183
185
  readTrackedFile(root, file, revision),
@@ -192,10 +194,20 @@ function architectureSummary(root, revision = "") {
192
194
  `${base}.cjs`,
193
195
  `${base}/index.js`,
194
196
  `${base}/index.mjs`,
195
- ].find((candidate) => implementationPaths.has(candidate));
197
+ ].find((candidate) => repositorySourceSet.has(candidate));
196
198
  if (target) graph.get(file).add(target);
197
199
  }
198
200
  }
201
+ const exclusions = new Set(
202
+ (index.ownershipExclusions || []).map((entry) => entry.path),
203
+ );
204
+ const ownedSources = repositorySources.filter((file) =>
205
+ index.ownershipRules?.some((rule) =>
206
+ (rule.paths || []).some(
207
+ (prefix) => file === prefix || file.startsWith(`${prefix}/`),
208
+ ),
209
+ ),
210
+ ).length;
199
211
  return {
200
212
  capabilities: index.capabilities.length,
201
213
  implementationMappings: index.capabilities.reduce(
@@ -207,6 +219,14 @@ function architectureSummary(root, revision = "") {
207
219
  0,
208
220
  ),
209
221
  dependencyRules: index.dependencyRules.length,
222
+ repositorySources: repositorySources.length,
223
+ ownedSources,
224
+ excludedSources: repositorySources.filter((file) => exclusions.has(file))
225
+ .length,
226
+ dependencyEdges: [...graph.values()].reduce(
227
+ (total, targets) => total + targets.size,
228
+ 0,
229
+ ),
210
230
  dependencyCycles: dependencyCycles(graph).length,
211
231
  };
212
232
  }
@@ -1,4 +1,5 @@
1
1
  import { spawnSync } from "node:child_process";
2
+ import fs from "node:fs";
2
3
  import path from "node:path";
3
4
  import {
4
5
  PAPER_FLEET_AUDIT_CONTRACT,
@@ -17,6 +18,7 @@ import {
17
18
  planPaperMigration,
18
19
  planPaperScaffold,
19
20
  planPaperFleetUpdate,
21
+ paperFleetTransitionWorkspace,
20
22
  writePaperFleetUpdate,
21
23
  writePaperMigration,
22
24
  writePaperScaffold,
@@ -467,9 +469,26 @@ function runFleetAudit(options) {
467
469
  function refreshFleetLocks(result) {
468
470
  for (const entry of result.results || []) {
469
471
  if (!entry.ok) continue;
470
- const lock = commandResult("pnpm", ["install", "--lockfile-only"], {
471
- cwd: entry.cwd,
472
- });
472
+ const workspacePath = path.resolve(entry.cwd, "pnpm-workspace.yaml");
473
+ const lockPath = path.resolve(entry.cwd, "pnpm-lock.yaml");
474
+ const finalWorkspace = fs.readFileSync(workspacePath, "utf8");
475
+ const transitionWorkspace = paperFleetTransitionWorkspace(
476
+ finalWorkspace,
477
+ fs.existsSync(lockPath) ? fs.readFileSync(lockPath, "utf8") : "",
478
+ );
479
+ let lock;
480
+ try {
481
+ if (transitionWorkspace !== finalWorkspace) {
482
+ fs.writeFileSync(workspacePath, transitionWorkspace);
483
+ }
484
+ lock = commandResult("pnpm", ["install", "--lockfile-only"], {
485
+ cwd: entry.cwd,
486
+ });
487
+ } finally {
488
+ if (fs.readFileSync(workspacePath, "utf8") !== finalWorkspace) {
489
+ fs.writeFileSync(workspacePath, finalWorkspace);
490
+ }
491
+ }
473
492
  if (lock.ok) continue;
474
493
  return {
475
494
  ...result,