@kungfu-tech/buildchain 4.1.3 → 4.1.4
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.
- package/AGENTS.md +11 -13
- package/CONTRIBUTING.md +32 -9
- package/README.md +56 -140
- package/actions/release/promotion/ref/README.md +1 -1
- package/architecture/action-taxonomy.json +1 -1
- package/architecture/agent-change-map.md +32 -45
- package/architecture/build-orchestration.json +1 -1
- package/architecture/capability-state-machine-manifest.json +5 -5
- package/architecture/ci-lane-change-budget.json +92 -92
- package/architecture/code-layout.json +2 -12
- package/architecture/core-mechanisms.json +38 -39
- package/architecture/cross-platform-adopter-qualification.json +1 -1
- package/architecture/dev-delivery-orchestration.json +2 -2
- package/architecture/floating-consumer-policy.json +3 -3
- package/architecture/internal-capabilities.json +27 -28
- package/architecture/maintainability-debt.json +60 -94
- package/architecture/maintainability-policy.json +7 -13
- package/architecture/minimal-consumer-migration.json +43 -5014
- package/architecture/platform-stage-checkpoints.json +1 -1
- package/architecture/release-tail-contract.json +2 -2
- package/architecture/release-topology.json +31 -25
- package/architecture/stage-capsule-qualification.json +1 -1
- package/architecture/universal-workflow-bootstrap.json +60 -60
- package/architecture/universal-workflow-capability-policy.json +3 -3
- package/architecture/universal-workflow-fault-campaign.json +7 -7
- package/architecture/workflow-taxonomy.json +59 -60
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
- package/dist/site/buildchain-contract.json +138 -66
- package/dist/site/buildchain-site.json +257 -331
- package/dist/site/capability-registry.json +4 -4
- package/dist/site/cli-registry.json +6 -142
- package/dist/site/controller-registry.json +19 -19
- package/dist/site/kfd-claims.json +481 -529
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +22 -22
- package/dist/site/node-api-registry.json +82 -339
- package/dist/site/page-registry.json +229 -304
- package/dist/site/public-surface-audit.json +544 -754
- package/dist/site/publication-authority-registry.json +316 -316
- package/dist/site/publication-registry.json +1 -1
- package/dist/site/site-manifest.json +23 -23
- package/dist/site/workflow-registry.json +1071 -1027
- package/docs/MAP.md +28 -20
- package/docs/auditable-demo.md +17 -49
- package/docs/bootstrap-recovery.md +46 -37
- package/docs/cli-reference.md +2 -46
- package/docs/cli.md +97 -186
- package/docs/code-organization.md +7 -5
- package/docs/dev-alpha-candidate-patrol.md +19 -42
- package/docs/dev-delivery-orchestration.md +15 -11
- package/docs/dev-delivery-qualification-landing-adr.md +10 -9
- package/docs/dev-delivery-warrant.md +17 -16
- package/docs/dev-qualification-patrol.md +25 -20
- package/docs/getting-started.md +80 -139
- package/docs/github-artifact-attestation.md +31 -81
- package/docs/install.md +66 -30
- package/docs/lifecycle-protocol.md +19 -57
- package/docs/migration-inventory.md +17 -45
- package/docs/next-development-transition.md +13 -13
- package/docs/node-api-reference.md +122 -138
- package/docs/oci-publication.md +13 -10
- package/docs/publication-artifacts.md +128 -486
- package/docs/publication-authority.md +15 -45
- package/docs/publish-transaction.md +13 -11
- package/docs/release-candidate.md +126 -355
- package/docs/release-discussions.md +36 -67
- package/docs/release-flow.md +80 -339
- package/docs/release-governance.md +114 -962
- package/docs/release-promotion-request.md +45 -43
- package/docs/release-propagation.md +13 -27
- package/docs/release-tail-provider-plane.md +38 -65
- package/docs/reusable-build-surface.md +78 -196
- package/docs/runtime-train-validation.md +8 -6
- package/docs/stable-candidate-patrol.md +13 -66
- package/docs/v4-adopter-delivery.md +15 -15
- package/docs/v4-declarative-release-tail-migration.md +19 -17
- package/docs/v4-production-release.md +11 -6
- package/docs/v4-publication-rehearsal.md +12 -27
- package/docs/v4-stage-capsule.md +14 -20
- package/docs/v4-tail-reseal.md +34 -20
- package/docs/web-surface-deployments.md +26 -264
- package/docs/workflow-catalog.md +31 -31
- package/docs/workflow-path-migration.md +10 -4
- package/package.json +5 -4
- package/packages/core/adoption/buildchain-kfd-claims.js +7 -7
- package/packages/core/adoption/cli/output.mjs +1 -9
- package/packages/core/adoption/cli/product-gate.mjs +1 -15
- package/packages/core/adoption/cli/project.mjs +9 -10
- package/packages/core/adoption/cli/standards.mjs +1 -14
- package/packages/core/adoption/cli/support.mjs +0 -2
- package/packages/core/adoption/cli/surface-register.mjs +0 -2
- package/packages/core/adoption/commands/init-repo.mjs +77 -485
- package/packages/core/adoption/consumer-init.js +279 -0
- package/packages/core/adoption/qualification/admission.js +1 -1
- package/packages/core/build/cli/cache.mjs +0 -2
- package/packages/core/build/cli/facts.mjs +0 -3
- package/packages/core/build/cli/homebrew.mjs +0 -4
- package/packages/core/build/cli/lifecycle.mjs +0 -3
- package/packages/core/build/github-artifact-attestation.js +2 -2
- package/packages/core/build/platform-stage-checkpoints.js +1 -1
- package/packages/core/build/signing/dispatch.js +1 -1
- package/packages/core/consumer/buildchain-config.js +9 -0
- package/packages/core/consumer/contract/inspection.js +351 -9
- package/packages/core/consumer/contract/javascript-syntax.js +439 -0
- package/packages/core/consumer/contract/javascript-values.js +61 -0
- package/packages/core/consumer/contract/javascript.js +555 -0
- package/packages/core/consumer/contract/local-validation.js +84 -0
- package/packages/core/contracts/buildchain-contract.js +39 -8
- package/packages/core/contracts/cli/introspection.mjs +1 -9
- package/packages/core/contracts/public-surface-cli.js +0 -1
- package/packages/core/dev-delivery/dev-delivery-contract-surface.js +2 -2
- package/packages/core/governance/buildchain-publication-authority.js +24 -24
- package/packages/core/governance/cli/doctor.mjs +58 -42
- package/packages/core/governance/commands/architecture.mjs +6 -1
- package/packages/core/governance/commands/audit-publication-control-plane.mjs +1 -1
- package/packages/core/governance/commands/workflow-friction-report.mjs +1 -1
- package/packages/core/governance/github-governance-authority.js +2 -2
- package/packages/core/governance/publication/collection.js +1 -1
- package/packages/core/index.js +1 -3
- package/packages/core/observability/cli/candidate.mjs +0 -2
- package/packages/core/observability/cli/context.mjs +0 -5
- package/packages/core/observability/cli/diagnostics.mjs +0 -7
- package/packages/core/observability/cli/events.mjs +2 -10
- package/packages/core/paper/commands/paper-work-fleet-cli.mjs +1 -1
- package/packages/core/paper/commands/paper.mjs +33 -422
- package/packages/core/paper/consumer-status.js +72 -0
- package/packages/core/paper/operations/identity.js +0 -3
- package/packages/core/paper/operations/migration.js +460 -0
- package/packages/core/paper/operations/preflight-checks.js +8 -68
- package/packages/core/paper/operations/scaffold.js +16 -326
- package/packages/core/paper/operations/status.js +27 -53
- package/packages/core/paper/paper-agent-entry.js +36 -147
- package/packages/core/paper/paper-fleet.js +24 -39
- package/packages/core/paper/paper-repository.js +16 -0
- package/packages/core/paper/paper-runtime-channels.js +1 -1
- package/packages/core/paper/paper-scaffold-content.js +153 -162
- package/packages/core/paper/paper-work.js +3 -10
- package/packages/core/paper/paper.js +43 -5
- package/packages/core/providers/github/artifact-attestation.js +1 -1
- package/packages/core/providers/github/pipeline-context-artifacts.js +172 -0
- package/packages/core/publication/authority/control-plane.js +2 -2
- package/packages/core/publication/authority/seal.js +1 -1
- package/packages/core/publication/cli/dispatch.mjs +1 -12
- package/packages/core/publication/pipeline/actions.js +16 -9
- package/packages/core/publication/pipeline/apply.js +17 -9
- package/packages/core/publication/pipeline/context.js +29 -0
- package/packages/core/publication/pipeline/prepare.js +15 -6
- package/packages/core/publication/pipeline/recovery-materials.js +63 -1
- package/packages/core/publication/pipeline/recovery-prepare.js +21 -9
- package/packages/core/publication/pipeline/stable-entry.js +12 -7
- package/packages/core/publication/pipeline/stable-products.js +21 -19
- package/packages/core/publication/pipeline/version-actions.js +15 -6
- package/packages/core/publication/publication-rehearsal-projection.js +0 -9
- package/packages/core/release/cli/dispatch.mjs +1 -4
- package/packages/core/release/cli/inspection-handlers.mjs +1 -33
- package/packages/core/release/cli/release-handlers.mjs +2 -19
- package/packages/core/release/cli/verification-handlers.mjs +4 -25
- package/packages/core/release/next-development-projection.js +13 -13
- package/packages/core/release/passport/locations.js +13 -8
- package/packages/core/release/release-passport.js +70 -5
- package/packages/core/web/cli/badges.mjs +0 -4
- package/packages/core/web/publication-admission.js +1 -1
- package/packages/core/web/publication-capability.js +1 -1
- package/packages/core/web/readme-badges.js +1 -1
- package/packages/core/workflow/cli/main.mjs +1 -4
- package/packages/core/workflow/cli/process.mjs +1 -1
- package/packages/core/workflow/commands/buildchain-cli-help.mjs +2 -8
- package/packages/core/workflow/engine/conformance.js +1 -1
- package/packages/core/workflow/pipeline/build.js +21 -1
- package/packages/core/workflow/pipeline/delivery-observation.js +6 -2
- package/packages/core/workflow/workflow-taxonomy.mjs +61 -17
- package/scripts/check-code-layout.mjs +2 -0
- package/scripts/check-core-mechanism-inventory.mjs +29 -13
- package/scripts/check-floating-consumer-policy-contract.mjs +3 -3
- package/scripts/check-inventory.mjs +27 -27
- package/scripts/check-maintainability.mjs +28 -5
- package/scripts/check-public-dogfood-contract.mjs +3 -3
- package/scripts/check-release-topology.mjs +1 -1
- package/scripts/check-self-consumer-contract.mjs +7 -7
- package/scripts/check-universal-workflow-bootstrap.mjs +1 -1
- package/scripts/generate-channel-promotion-workflow.mjs +1 -1
- package/scripts/generate-minimal-consumer-contract.mjs +21 -1
- package/scripts/generate-site-bundle.mjs +2 -1
- package/scripts/generate-tail-reseal-fixture.mjs +3 -3
- package/scripts/inventory/promotion.mjs +1 -1
- package/scripts/next-development-self-dogfood-harness.mjs +1 -1
- package/scripts/next-development-self-dogfood.mjs +4 -4
- package/scripts/site-capability-metadata.mjs +2 -6
- package/scripts/source-metric-lineage.mjs +62 -7
- package/scripts/verify-golden-path.mjs +31 -35
- package/templates/native-dev-delivery.yml +1 -1
- package/templates/universal-buildchain-bootstrap.yml +1 -1
- package/packages/core/paper/operations/bootstrap.js +0 -75
- package/packages/core/paper/operations/plans.js +0 -213
- package/packages/core/paper/operations/provisioning.js +0 -113
- package/packages/core/paper/operations/scaffold-config.js +0 -77
- package/packages/core/paper/operations/scaffold-workflows.js +0 -116
- package/packages/core/paper/operations/workspace.js +0 -60
- package/packages/core/paper/paper-npm-bootstrap.js +0 -492
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
PAPER_MIGRATION_CONTRACT,
|
|
8
|
+
PAPER_PREFLIGHT_CONTRACT,
|
|
9
|
+
PAPER_SCAFFOLD_CONTRACT,
|
|
10
|
+
PAPER_STATUS_CONTRACT,
|
|
11
|
+
} from "../operations/identity.js";
|
|
7
12
|
import { collectPaperPreflight } from "../paper.js";
|
|
8
13
|
import { resolvePaperBuildchainSha } from "../paper-agent-entry.js";
|
|
9
14
|
import { collectPaperStatus } from "../operations/status.js";
|
|
10
|
-
|
|
11
|
-
import { executePaperNpmBootstrap } from "../operations/bootstrap.js";
|
|
12
|
-
import { verifyPublicationReproducibility } from "../../publication/publication-reproducibility.js";
|
|
15
|
+
|
|
13
16
|
import {
|
|
14
17
|
printPaperWorkFleetSummary,
|
|
15
18
|
runPaperWorkFleetCli,
|
|
@@ -18,10 +21,10 @@ import { runPaperAgentCli } from "./paper-agent-cli.mjs";
|
|
|
18
21
|
|
|
19
22
|
function usage() {
|
|
20
23
|
return `Usage:
|
|
21
|
-
buildchain paper scaffold --
|
|
24
|
+
buildchain paper scaffold --repository <owner/repo> [--package <name>]
|
|
22
25
|
[--cwd <dir>] [--name <name>] [--title <title>]
|
|
23
26
|
[--version <semver>] [--site-base-url <url>]
|
|
24
|
-
[--
|
|
27
|
+
[--write] [--json]
|
|
25
28
|
buildchain paper migrate [--cwd <dir>] [--write] [--json]
|
|
26
29
|
buildchain paper work start <topic> [--cwd <dir>] [--branch <branch>]
|
|
27
30
|
[--execute] [--json]
|
|
@@ -31,29 +34,16 @@ function usage() {
|
|
|
31
34
|
buildchain paper fleet update [--root <dir>] [--write] [--json]
|
|
32
35
|
buildchain paper agent verify [--cwd <dir>] [--offline] [--json]
|
|
33
36
|
buildchain paper preflight [--cwd <dir>] [--offline] [--json]
|
|
34
|
-
buildchain paper bootstrap npm [--cwd <dir>] [--package <name>]
|
|
35
|
-
[--repository <owner/repo>] [--workflow <filename>]
|
|
36
|
-
[--bootstrap-version <version>] [--userconfig <path>]
|
|
37
|
-
[--offline] [--execute]
|
|
38
|
-
[--confirm-public-package <name>] [--json]
|
|
39
|
-
buildchain paper build [--cwd <dir>] [--source-sha <sha>]
|
|
40
|
-
[--no-toolchain-pull] [--keep-workspaces]
|
|
41
|
-
[--execute] [--json]
|
|
42
|
-
buildchain paper alpha [--cwd <dir>] [--source-ref <ref>] [--target-ref <ref>]
|
|
43
|
-
[--execute] [--json]
|
|
44
37
|
buildchain paper status [--cwd <dir>] [--json]
|
|
45
|
-
buildchain paper resume [--cwd <dir>] [--runtime-ref <ref>]
|
|
46
|
-
[--execute] [--json]
|
|
47
38
|
|
|
48
39
|
Safety:
|
|
49
40
|
scaffold is a no-overwrite dry-run unless --write is present. migrate only
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
converts Paper product configuration to schema 2 and retires verified legacy
|
|
42
|
+
controls while preserving source files, runtime locks and historical receipts. work start/submit refuse dirty, stale, forked, ambiguous,
|
|
52
43
|
protected, or non-fast-forward sources. fleet update requires isolated work
|
|
53
44
|
branches and is a dry-run unless --write is present.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
exact --confirm-public-package value.
|
|
45
|
+
Product build and verification commands belong in TOML. A legal channel PR
|
|
46
|
+
requests publication; the generated recovery caller accepts an exact attempt.
|
|
57
47
|
`;
|
|
58
48
|
}
|
|
59
49
|
|
|
@@ -71,23 +61,6 @@ function printJson(value) {
|
|
|
71
61
|
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
72
62
|
}
|
|
73
63
|
|
|
74
|
-
function commandResult(command, args, { cwd, timeout = 60000 } = {}) {
|
|
75
|
-
const result = spawnSync(command, args, {
|
|
76
|
-
cwd,
|
|
77
|
-
env: process.env,
|
|
78
|
-
encoding: "utf8",
|
|
79
|
-
timeout,
|
|
80
|
-
maxBuffer: 2 * 1024 * 1024,
|
|
81
|
-
});
|
|
82
|
-
return {
|
|
83
|
-
ok: result.status === 0,
|
|
84
|
-
status: result.status ?? 1,
|
|
85
|
-
stdout: String(result.stdout || "").trim(),
|
|
86
|
-
stderr: String(result.stderr || "").trim(),
|
|
87
|
-
error: result.error?.message || "",
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
64
|
function humanSummary(result) {
|
|
92
65
|
if (result.contract === PAPER_SCAFFOLD_CONTRACT) {
|
|
93
66
|
process.stdout.write(
|
|
@@ -106,7 +79,7 @@ function humanSummary(result) {
|
|
|
106
79
|
`paper migrate: ${result.ok ? "ok" : "blocked"} (${result.dryRun ? "dry-run" : "write"})\n`,
|
|
107
80
|
);
|
|
108
81
|
process.stdout.write(
|
|
109
|
-
`create=${result.summary.create} update=${result.summary.update} unchanged=${result.summary.unchanged} conflict=${result.summary.conflict}\n`,
|
|
82
|
+
`create=${result.summary.create} update=${result.summary.update} remove=${result.summary.remove} unchanged=${result.summary.unchanged} conflict=${result.summary.conflict}\n`,
|
|
110
83
|
);
|
|
111
84
|
for (const entry of result.changes) {
|
|
112
85
|
process.stdout.write(`- ${entry.action}: ${entry.path}\n`);
|
|
@@ -131,41 +104,7 @@ function humanSummary(result) {
|
|
|
131
104
|
}
|
|
132
105
|
return;
|
|
133
106
|
}
|
|
134
|
-
|
|
135
|
-
process.stdout.write(
|
|
136
|
-
`paper bootstrap npm: ${result.ok ? result.publish.status : result.errorCode || "blocked"}\n`,
|
|
137
|
-
);
|
|
138
|
-
process.stdout.write(`package: ${result.package.name}\n`);
|
|
139
|
-
process.stdout.write(`trust: ${result.trust.status}\n`);
|
|
140
|
-
for (const url of result.trust.urls || []) {
|
|
141
|
-
process.stdout.write(`url: ${url}\n`);
|
|
142
|
-
}
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
if (result.contract === PAPER_BUILD_PLAN_CONTRACT) {
|
|
146
|
-
process.stdout.write(
|
|
147
|
-
`paper build: ${result.dryRun ? "dry-run" : result.receipt?.status || "complete"}\n`,
|
|
148
|
-
);
|
|
149
|
-
process.stdout.write(`source: ${result.sourceSha}\n`);
|
|
150
|
-
if (result.receipt?.receiptDigest) {
|
|
151
|
-
process.stdout.write(`receipt: ${result.receipt.receiptDigest}\n`);
|
|
152
|
-
}
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (result.contract === PAPER_ALPHA_PLAN_CONTRACT) {
|
|
156
|
-
process.stdout.write(
|
|
157
|
-
`paper alpha: ${result.dryRun ? "dry-run" : result.pr?.url || "submitted"}\n`,
|
|
158
|
-
);
|
|
159
|
-
process.stdout.write(`${result.source.ref} -> ${result.target.ref}\n`);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (result.contract === PAPER_RESUME_PLAN_CONTRACT) {
|
|
163
|
-
process.stdout.write(`paper resume: ${result.reason}\n`);
|
|
164
|
-
if (result.mutation?.command) {
|
|
165
|
-
process.stdout.write(`${result.mutation.command}\n`);
|
|
166
|
-
}
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
107
|
+
|
|
169
108
|
printPaperWorkFleetSummary(result, printJson);
|
|
170
109
|
}
|
|
171
110
|
|
|
@@ -174,267 +113,6 @@ function printResult(result, json) {
|
|
|
174
113
|
else humanSummary(result);
|
|
175
114
|
}
|
|
176
115
|
|
|
177
|
-
function githubPrRows({ cwd, repository, sourceRef, targetRef = "" }) {
|
|
178
|
-
const targetArgs = targetRef ? ["--base", targetRef] : [];
|
|
179
|
-
const query = commandResult(
|
|
180
|
-
"gh",
|
|
181
|
-
[
|
|
182
|
-
"pr",
|
|
183
|
-
"list",
|
|
184
|
-
"--repo",
|
|
185
|
-
repository,
|
|
186
|
-
"--head",
|
|
187
|
-
sourceRef,
|
|
188
|
-
...targetArgs,
|
|
189
|
-
"--state",
|
|
190
|
-
"open",
|
|
191
|
-
"--json",
|
|
192
|
-
"number,url,headRefName,baseRefName",
|
|
193
|
-
"--limit",
|
|
194
|
-
"10",
|
|
195
|
-
],
|
|
196
|
-
{ cwd },
|
|
197
|
-
);
|
|
198
|
-
if (!query.ok) {
|
|
199
|
-
return {
|
|
200
|
-
ok: false,
|
|
201
|
-
rows: [],
|
|
202
|
-
errorCode: query.error ? "gh-unavailable" : "github-pr-query-failed",
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
try {
|
|
206
|
-
const rows = JSON.parse(query.stdout || "[]");
|
|
207
|
-
return { ok: true, rows: Array.isArray(rows) ? rows : [], errorCode: "" };
|
|
208
|
-
} catch {
|
|
209
|
-
return { ok: false, rows: [], errorCode: "github-pr-response-invalid" };
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function githubBranchObservation({ cwd, repository, ref }) {
|
|
214
|
-
const query = commandResult(
|
|
215
|
-
"gh",
|
|
216
|
-
[
|
|
217
|
-
"api",
|
|
218
|
-
`repos/${repository}/git/ref/heads/${encodeURIComponent(ref)}`,
|
|
219
|
-
"--jq",
|
|
220
|
-
".object.sha",
|
|
221
|
-
],
|
|
222
|
-
{ cwd },
|
|
223
|
-
);
|
|
224
|
-
const sha = query.stdout.trim();
|
|
225
|
-
return {
|
|
226
|
-
ok: query.ok && /^[0-9a-f]{40}$/.test(sha),
|
|
227
|
-
ref,
|
|
228
|
-
sha: /^[0-9a-f]{40}$/.test(sha) ? sha : "",
|
|
229
|
-
observedRef: `refs/heads/${ref}`,
|
|
230
|
-
observation: "github-api",
|
|
231
|
-
errorCode: query.ok
|
|
232
|
-
? "github-ref-response-invalid"
|
|
233
|
-
: query.error
|
|
234
|
-
? "gh-unavailable"
|
|
235
|
-
: "github-ref-query-failed",
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function executeAlphaPlan(plan) {
|
|
240
|
-
if (!plan.ok) {
|
|
241
|
-
return {
|
|
242
|
-
...plan,
|
|
243
|
-
ok: false,
|
|
244
|
-
dryRun: false,
|
|
245
|
-
errorCode: "paper-alpha-plan-invalid",
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
const source = githubBranchObservation({
|
|
249
|
-
cwd: plan.cwd,
|
|
250
|
-
repository: plan.repository,
|
|
251
|
-
ref: plan.source.ref,
|
|
252
|
-
});
|
|
253
|
-
if (!source.ok) {
|
|
254
|
-
return {
|
|
255
|
-
...plan,
|
|
256
|
-
ok: false,
|
|
257
|
-
dryRun: false,
|
|
258
|
-
errorCode: source.errorCode,
|
|
259
|
-
nextActions: [
|
|
260
|
-
{
|
|
261
|
-
id: "resolve-source-ref",
|
|
262
|
-
command: "",
|
|
263
|
-
description:
|
|
264
|
-
"Resolve the exact protected dev source ref from GitHub before opening an Alpha PR.",
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
const target = githubBranchObservation({
|
|
270
|
-
cwd: plan.cwd,
|
|
271
|
-
repository: plan.repository,
|
|
272
|
-
ref: plan.target.ref,
|
|
273
|
-
});
|
|
274
|
-
if (!target.ok) {
|
|
275
|
-
return {
|
|
276
|
-
...plan,
|
|
277
|
-
source,
|
|
278
|
-
ok: false,
|
|
279
|
-
dryRun: false,
|
|
280
|
-
errorCode: target.errorCode,
|
|
281
|
-
nextActions: [
|
|
282
|
-
{
|
|
283
|
-
id: "resolve-target-ref",
|
|
284
|
-
command: "",
|
|
285
|
-
description:
|
|
286
|
-
"Resolve the exact protected Alpha target ref from GitHub before opening an Alpha PR.",
|
|
287
|
-
},
|
|
288
|
-
],
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
plan = {
|
|
292
|
-
...plan,
|
|
293
|
-
source,
|
|
294
|
-
target,
|
|
295
|
-
};
|
|
296
|
-
const existing = githubPrRows({
|
|
297
|
-
cwd: plan.cwd,
|
|
298
|
-
repository: plan.repository,
|
|
299
|
-
sourceRef: plan.source.ref,
|
|
300
|
-
targetRef: plan.target.ref,
|
|
301
|
-
});
|
|
302
|
-
if (!existing.ok) {
|
|
303
|
-
return {
|
|
304
|
-
...plan,
|
|
305
|
-
ok: false,
|
|
306
|
-
dryRun: false,
|
|
307
|
-
errorCode: existing.errorCode,
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
if (existing.rows.length > 0) {
|
|
311
|
-
return {
|
|
312
|
-
...plan,
|
|
313
|
-
ok: true,
|
|
314
|
-
dryRun: false,
|
|
315
|
-
reused: true,
|
|
316
|
-
pr: existing.rows[0],
|
|
317
|
-
nextActions: [
|
|
318
|
-
{
|
|
319
|
-
id: "review-alpha-pr",
|
|
320
|
-
command: "",
|
|
321
|
-
description:
|
|
322
|
-
"Complete the repository's independent protected PR review and merge gate.",
|
|
323
|
-
url: existing.rows[0].url,
|
|
324
|
-
},
|
|
325
|
-
],
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
const title = `release(paper): publish ${plan.publicationVersion} alpha`;
|
|
329
|
-
const body = [
|
|
330
|
-
"## Summary",
|
|
331
|
-
"",
|
|
332
|
-
`Promote \`${plan.source.ref}\` to \`${plan.target.ref}\` through the protected Buildchain paper release flow.`,
|
|
333
|
-
"",
|
|
334
|
-
"## Safety",
|
|
335
|
-
"",
|
|
336
|
-
"- Build and verification remain credential-free.",
|
|
337
|
-
"- Exact artifact bytes are sealed before npm OIDC is available.",
|
|
338
|
-
"- This PR does not bypass review or publish directly.",
|
|
339
|
-
].join("\n");
|
|
340
|
-
const created = commandResult(
|
|
341
|
-
"gh",
|
|
342
|
-
[
|
|
343
|
-
"pr",
|
|
344
|
-
"create",
|
|
345
|
-
"--repo",
|
|
346
|
-
plan.repository,
|
|
347
|
-
"--base",
|
|
348
|
-
plan.target.ref,
|
|
349
|
-
"--head",
|
|
350
|
-
plan.source.ref,
|
|
351
|
-
"--title",
|
|
352
|
-
title,
|
|
353
|
-
"--body",
|
|
354
|
-
body,
|
|
355
|
-
],
|
|
356
|
-
{ cwd: plan.cwd },
|
|
357
|
-
);
|
|
358
|
-
if (!created.ok) {
|
|
359
|
-
return {
|
|
360
|
-
...plan,
|
|
361
|
-
ok: false,
|
|
362
|
-
dryRun: false,
|
|
363
|
-
errorCode: created.error ? "gh-unavailable" : "github-pr-create-failed",
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
const url =
|
|
367
|
-
created.stdout
|
|
368
|
-
.split(/\s+/)
|
|
369
|
-
.find((entry) => /^https:\/\/github\.com\//.test(entry)) || "";
|
|
370
|
-
return {
|
|
371
|
-
...plan,
|
|
372
|
-
ok: true,
|
|
373
|
-
dryRun: false,
|
|
374
|
-
reused: false,
|
|
375
|
-
pr: {
|
|
376
|
-
url,
|
|
377
|
-
headRefName: plan.source.ref,
|
|
378
|
-
baseRefName: plan.target.ref,
|
|
379
|
-
},
|
|
380
|
-
nextActions: [
|
|
381
|
-
{
|
|
382
|
-
id: "review-alpha-pr",
|
|
383
|
-
command: "",
|
|
384
|
-
description:
|
|
385
|
-
"Complete the repository's independent protected PR review and merge gate.",
|
|
386
|
-
url,
|
|
387
|
-
},
|
|
388
|
-
],
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
function executeResumePlan(plan, runtimeRef) {
|
|
393
|
-
if (!plan.resumable || !plan.transaction?.targetRef) {
|
|
394
|
-
return {
|
|
395
|
-
...plan,
|
|
396
|
-
dryRun: false,
|
|
397
|
-
dispatched: false,
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
const args = [
|
|
401
|
-
"workflow",
|
|
402
|
-
"run",
|
|
403
|
-
".github/workflows/public-release-paper.yml",
|
|
404
|
-
"--ref",
|
|
405
|
-
plan.transaction.targetRef,
|
|
406
|
-
];
|
|
407
|
-
if (runtimeRef) {
|
|
408
|
-
args.push("-f", `runtime-ref=${runtimeRef}`);
|
|
409
|
-
}
|
|
410
|
-
const dispatched = commandResult("gh", args, { cwd: plan.cwd });
|
|
411
|
-
if (!dispatched.ok) {
|
|
412
|
-
return {
|
|
413
|
-
...plan,
|
|
414
|
-
ok: false,
|
|
415
|
-
dryRun: false,
|
|
416
|
-
dispatched: false,
|
|
417
|
-
errorCode: dispatched.error
|
|
418
|
-
? "gh-unavailable"
|
|
419
|
-
: "github-workflow-dispatch-failed",
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
return {
|
|
423
|
-
...plan,
|
|
424
|
-
ok: true,
|
|
425
|
-
dryRun: false,
|
|
426
|
-
dispatched: true,
|
|
427
|
-
nextActions: [
|
|
428
|
-
{
|
|
429
|
-
id: "inspect-resumed-transaction",
|
|
430
|
-
command: "buildchain paper status --json",
|
|
431
|
-
description:
|
|
432
|
-
"Wait for the protected workflow, then inspect the same transaction coordinates.",
|
|
433
|
-
},
|
|
434
|
-
],
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
|
|
438
116
|
export async function runPaperCli(
|
|
439
117
|
args = [],
|
|
440
118
|
{
|
|
@@ -447,7 +125,6 @@ export async function runPaperCli(
|
|
|
447
125
|
buildchainSha = "",
|
|
448
126
|
} = {},
|
|
449
127
|
) {
|
|
450
|
-
buildchainSha = resolvePaperBuildchainSha(buildchainRoot, buildchainSha);
|
|
451
128
|
const [command = "", maybeSubcommand = "", ...rest] = args;
|
|
452
129
|
const json = hasFlag(args, "json");
|
|
453
130
|
try {
|
|
@@ -455,10 +132,26 @@ export async function runPaperCli(
|
|
|
455
132
|
process.stdout.write(usage());
|
|
456
133
|
return;
|
|
457
134
|
}
|
|
135
|
+
if (
|
|
136
|
+
![
|
|
137
|
+
"scaffold",
|
|
138
|
+
"migrate",
|
|
139
|
+
"work",
|
|
140
|
+
"fleet",
|
|
141
|
+
"agent",
|
|
142
|
+
"preflight",
|
|
143
|
+
"status",
|
|
144
|
+
].includes(command)
|
|
145
|
+
)
|
|
146
|
+
throw new Error(
|
|
147
|
+
"Unknown Paper command. Use product commands from TOML, a channel PR for publication, or the generated attempt recovery entry.",
|
|
148
|
+
);
|
|
458
149
|
const effectiveArgs = maybeSubcommand.startsWith("--")
|
|
459
150
|
? [maybeSubcommand, ...rest]
|
|
460
151
|
: rest;
|
|
461
152
|
const cwd = path.resolve(readFlag(effectiveArgs, "cwd", process.cwd()));
|
|
153
|
+
if (!["scaffold", "preflight", "status"].includes(command))
|
|
154
|
+
buildchainSha = resolvePaperBuildchainSha(buildchainRoot, buildchainSha);
|
|
462
155
|
const workFleet = runPaperWorkFleetCli({
|
|
463
156
|
command,
|
|
464
157
|
subcommand: maybeSubcommand,
|
|
@@ -495,91 +188,9 @@ export async function runPaperCli(
|
|
|
495
188
|
? "local"
|
|
496
189
|
: "contract",
|
|
497
190
|
});
|
|
498
|
-
} else if (command === "bootstrap" && maybeSubcommand === "npm") {
|
|
499
|
-
result = executePaperNpmBootstrap({
|
|
500
|
-
cwd,
|
|
501
|
-
packageName: readFlag(effectiveArgs, "package", ""),
|
|
502
|
-
bootstrapVersion: readFlag(
|
|
503
|
-
effectiveArgs,
|
|
504
|
-
"bootstrap-version",
|
|
505
|
-
"0.0.0-bootstrap.0",
|
|
506
|
-
),
|
|
507
|
-
registry: readFlag(
|
|
508
|
-
effectiveArgs,
|
|
509
|
-
"registry",
|
|
510
|
-
"https://registry.npmjs.org/",
|
|
511
|
-
),
|
|
512
|
-
repository: readFlag(effectiveArgs, "repository", ""),
|
|
513
|
-
workflow: readFlag(effectiveArgs, "workflow", "public-release-paper.yml"),
|
|
514
|
-
environment: readFlag(effectiveArgs, "environment", ""),
|
|
515
|
-
execute: hasFlag(effectiveArgs, "execute"),
|
|
516
|
-
confirmedPackage: readFlag(effectiveArgs, "confirm-public-package", ""),
|
|
517
|
-
userconfig: readFlag(effectiveArgs, "userconfig", ""),
|
|
518
|
-
offline: hasFlag(effectiveArgs, "offline"),
|
|
519
|
-
});
|
|
520
|
-
} else if (command === "build") {
|
|
521
|
-
const plan = createPaperBuildPlan({
|
|
522
|
-
cwd,
|
|
523
|
-
sourceSha: readFlag(effectiveArgs, "source-sha", ""),
|
|
524
|
-
pullToolchain: !hasFlag(effectiveArgs, "no-toolchain-pull"),
|
|
525
|
-
});
|
|
526
|
-
if (!hasFlag(effectiveArgs, "execute")) {
|
|
527
|
-
result = plan;
|
|
528
|
-
} else {
|
|
529
|
-
const receipt = verifyPublicationReproducibility({
|
|
530
|
-
cwd,
|
|
531
|
-
sourceSha: plan.sourceSha,
|
|
532
|
-
promote: true,
|
|
533
|
-
keepWorkspaces: hasFlag(effectiveArgs, "keep-workspaces"),
|
|
534
|
-
pullToolchain: plan.pullToolchain,
|
|
535
|
-
packageName: readFlag(effectiveArgs, "package", ""),
|
|
536
|
-
});
|
|
537
|
-
result = {
|
|
538
|
-
...plan,
|
|
539
|
-
ok: receipt.qualifying === true,
|
|
540
|
-
dryRun: false,
|
|
541
|
-
receipt,
|
|
542
|
-
nextActions: receipt.qualifying
|
|
543
|
-
? [
|
|
544
|
-
{
|
|
545
|
-
id: "paper-status",
|
|
546
|
-
command: "buildchain paper status --json",
|
|
547
|
-
description:
|
|
548
|
-
"Inspect the qualifying reproducibility evidence and remaining publication gates.",
|
|
549
|
-
},
|
|
550
|
-
]
|
|
551
|
-
: [
|
|
552
|
-
{
|
|
553
|
-
id: "repair-reproducibility",
|
|
554
|
-
command:
|
|
555
|
-
"buildchain paper build --execute --keep-workspaces --json",
|
|
556
|
-
description:
|
|
557
|
-
"Retain both clean workspaces and inspect the first byte difference.",
|
|
558
|
-
},
|
|
559
|
-
],
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
} else if (command === "alpha") {
|
|
563
|
-
const plan = createPaperAlphaPlan({
|
|
564
|
-
cwd,
|
|
565
|
-
sourceRef: readFlag(effectiveArgs, "source-ref", ""),
|
|
566
|
-
targetRef: readFlag(effectiveArgs, "target-ref", ""),
|
|
567
|
-
});
|
|
568
|
-
result = hasFlag(effectiveArgs, "execute")
|
|
569
|
-
? executeAlphaPlan(plan)
|
|
570
|
-
: plan;
|
|
571
|
-
} else if (command === "resume") {
|
|
572
|
-
const runtimeRef = readFlag(effectiveArgs, "runtime-ref", "");
|
|
573
|
-
const plan = createPaperResumePlan({
|
|
574
|
-
cwd,
|
|
575
|
-
runtimeRef,
|
|
576
|
-
});
|
|
577
|
-
result = hasFlag(effectiveArgs, "execute")
|
|
578
|
-
? executeResumePlan(plan, runtimeRef)
|
|
579
|
-
: plan;
|
|
580
191
|
} else {
|
|
581
192
|
throw new Error(
|
|
582
|
-
"usage: buildchain paper <scaffold|migrate|work start|work submit|fleet audit|fleet update|agent verify|preflight|
|
|
193
|
+
"usage: buildchain paper <scaffold|migrate|work start|work submit|fleet audit|fleet update|agent verify|preflight|status> ...",
|
|
583
194
|
);
|
|
584
195
|
}
|
|
585
196
|
printResult(result, json);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import {
|
|
3
|
+
loadBuildchainConfig,
|
|
4
|
+
validateBuildchainConfig,
|
|
5
|
+
} from "../consumer/buildchain-config.js";
|
|
6
|
+
import { validateConsumerWiring } from "../consumer/contract/local-validation.js";
|
|
7
|
+
import {
|
|
8
|
+
gitValue,
|
|
9
|
+
readJson,
|
|
10
|
+
resolvePaperRepository,
|
|
11
|
+
} from "./paper-repository.js";
|
|
12
|
+
|
|
13
|
+
// Local product/configuration facts only. Hosted attempt state is owned by the pipeline.
|
|
14
|
+
export function paperConsumerStatus(cwd) {
|
|
15
|
+
const loaded = loadBuildchainConfig(cwd);
|
|
16
|
+
if (loaded?.config.schema !== 2) return null;
|
|
17
|
+
const checks = [];
|
|
18
|
+
let configuration;
|
|
19
|
+
let wiring;
|
|
20
|
+
try {
|
|
21
|
+
configuration = validateBuildchainConfig(cwd, {
|
|
22
|
+
requireLifecycleStages: ["build", "verify"],
|
|
23
|
+
});
|
|
24
|
+
if (!configuration.products.some((product) => product.type === "paper"))
|
|
25
|
+
throw new Error("The consumer policy has no Paper product");
|
|
26
|
+
checks.push({
|
|
27
|
+
id: "config.paper",
|
|
28
|
+
status: "pass",
|
|
29
|
+
message: "Schema-2 Paper product commands and artifacts are valid",
|
|
30
|
+
});
|
|
31
|
+
} catch (error) {
|
|
32
|
+
checks.push({ id: "config.paper", status: "fail", message: error.message });
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
wiring = validateConsumerWiring(cwd, loaded.path);
|
|
36
|
+
checks.push({
|
|
37
|
+
id: "workflow.consumer-pair",
|
|
38
|
+
status: "pass",
|
|
39
|
+
message: "The shared normal and recovery callers match",
|
|
40
|
+
});
|
|
41
|
+
} catch (error) {
|
|
42
|
+
checks.push({
|
|
43
|
+
id: "workflow.consumer-pair",
|
|
44
|
+
status: "fail",
|
|
45
|
+
message: error.message,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const head = gitValue(cwd, ["rev-parse", "HEAD"]);
|
|
49
|
+
const sourcePackage = readJson(path.join(cwd, "package.json")).value;
|
|
50
|
+
return {
|
|
51
|
+
schemaVersion: 2,
|
|
52
|
+
ok: checks.every((check) => check.status === "pass"),
|
|
53
|
+
cwd: path.resolve(cwd),
|
|
54
|
+
checks,
|
|
55
|
+
configuration,
|
|
56
|
+
wiring,
|
|
57
|
+
source: { head, repository: resolvePaperRepository(cwd) },
|
|
58
|
+
identity: {
|
|
59
|
+
project: sourcePackage?.name || "",
|
|
60
|
+
title: sourcePackage?.description || "",
|
|
61
|
+
repository: resolvePaperRepository(cwd),
|
|
62
|
+
},
|
|
63
|
+
localOnly: true,
|
|
64
|
+
publication: {
|
|
65
|
+
status: "not-observed",
|
|
66
|
+
authority: "published-pipeline-attempt",
|
|
67
|
+
},
|
|
68
|
+
nonClaims: [
|
|
69
|
+
"Local configuration checks do not prove hosted admission, successful builds, publication, or recovery",
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -7,9 +7,6 @@ export const PAPER_NPM_BOOTSTRAP_CONTRACT =
|
|
|
7
7
|
"kungfu-buildchain-paper-npm-bootstrap";
|
|
8
8
|
export const PAPER_PROVISIONING_CONTRACT =
|
|
9
9
|
"kungfu-buildchain-paper-provisioning-authority";
|
|
10
|
-
export const PAPER_BUILD_PLAN_CONTRACT = "kungfu-buildchain-paper-build-plan";
|
|
11
|
-
export const PAPER_ALPHA_PLAN_CONTRACT = "kungfu-buildchain-paper-alpha-plan";
|
|
12
|
-
export const PAPER_RESUME_PLAN_CONTRACT = "kungfu-buildchain-paper-resume-plan";
|
|
13
10
|
export const PAPER_VISIBILITY_CONTRACT = "kungfu-buildchain-paper-visibility";
|
|
14
11
|
export const PAPER_STATE_ORDER = Object.freeze([
|
|
15
12
|
"scaffolded",
|