@kungfu-tech/buildchain 3.0.5-alpha.6 → 3.0.5-alpha.7
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/README.md +31 -0
- package/bin/buildchain.mjs +1 -1
- package/contracts/auditable-demo-media-profiles-v1.json +61 -0
- package/contracts/auditable-demo-scenario-v1.schema.json +153 -0
- package/contracts/evidence/auditable-demo-responsive-web-delivery-v1.json +3 -3
- package/contracts/evidence/auditable-demo-web-delivery-v1.json +3 -3
- package/dist/site/buildchain-contract.json +57 -6
- package/dist/site/buildchain-site.json +38 -22
- package/dist/site/capability-registry.json +1 -1
- package/dist/site/cli-registry.json +6 -2
- package/dist/site/kfd-claims.json +49 -9
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +3 -3
- package/dist/site/node-api-registry.json +203 -21
- package/dist/site/page-registry.json +28 -8
- package/dist/site/public-surface-audit.json +94 -6
- package/dist/site/publication-authority-registry.json +42 -1
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/site-manifest.json +7 -7
- package/dist/site/workflow-registry.json +63 -0
- package/docs/auditable-demo.md +74 -7
- package/docs/cli-reference.md +24 -2
- package/docs/node-api-reference.md +63 -45
- package/package.json +1 -1
- package/packages/core/buildchain-contract.js +36 -1
- package/packages/core/buildchain-publication-authority.js +2 -0
- package/packages/core/release-propagation-pickup.js +386 -0
- package/packages/core/release-propagation-release.js +61 -18
- package/packages/core/release-propagation.js +12 -2
- package/scripts/auditable-demo-platform.mjs +506 -0
- package/scripts/auditable-demo-renditions.mjs +6 -1
- package/scripts/auditable-demo.mjs +14 -4
- package/scripts/build-standalone-binary.mjs +4 -0
- package/scripts/buildchain-cli-help.mjs +2 -1
- package/scripts/check-inventory.mjs +5 -0
- package/scripts/generate-site-bundle.mjs +2 -0
- package/scripts/release-propagation.mjs +77 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { execFileSync } from "node:child_process";
|
|
4
5
|
import { pathToFileURL } from "node:url";
|
|
5
6
|
import {
|
|
6
7
|
claimReleasePropagationWork,
|
|
@@ -15,6 +16,10 @@ import {
|
|
|
15
16
|
resumeReleasePropagationWork,
|
|
16
17
|
verifyReleasePropagationWork,
|
|
17
18
|
writeReleasePropagationLock,
|
|
19
|
+
createManualUpstreamPickupCapture,
|
|
20
|
+
createManualUpstreamPickupPlan,
|
|
21
|
+
normalizeManualUpstreamPickupConfig,
|
|
22
|
+
resolveNpmRegistryRelease,
|
|
18
23
|
} from "../packages/core/release-propagation.js";
|
|
19
24
|
|
|
20
25
|
function usage() {
|
|
@@ -61,6 +66,15 @@ function usage() {
|
|
|
61
66
|
--completion-decision <json-or-path>
|
|
62
67
|
--expected-work-root <sha256:...>
|
|
63
68
|
[--output <file>] [--json]
|
|
69
|
+
buildchain release-propagation pickup plan --config <json-or-path>
|
|
70
|
+
--source-id <id> --channel <alpha|release>
|
|
71
|
+
--current-version <version>
|
|
72
|
+
[--output <file>] [--json]
|
|
73
|
+
buildchain release-propagation pickup create --config <json-or-path>
|
|
74
|
+
--source-id <id> --channel <alpha|release>
|
|
75
|
+
--current-version <version>
|
|
76
|
+
--expected-downstream-base-sha <git-sha>
|
|
77
|
+
[--output <file>] [--json]
|
|
64
78
|
`;
|
|
65
79
|
}
|
|
66
80
|
|
|
@@ -171,7 +185,61 @@ function runWorkCli(args) {
|
|
|
171
185
|
throw new Error(`unsupported release-propagation work command: ${mode}`);
|
|
172
186
|
}
|
|
173
187
|
|
|
174
|
-
|
|
188
|
+
async function resolvePickupPlan(args) {
|
|
189
|
+
const config = normalizeManualUpstreamPickupConfig(readJsonFlag(args, "config"));
|
|
190
|
+
const sourceId = readFlag(args, "source-id");
|
|
191
|
+
const channel = readFlag(args, "channel");
|
|
192
|
+
const source = config.sources.find((entry) => entry.id === sourceId);
|
|
193
|
+
if (!source) throw new Error(`manual pickup source is not configured: ${sourceId}`);
|
|
194
|
+
const distTag = source.distTags[channel];
|
|
195
|
+
if (!distTag) throw new Error("manual pickup channel must be alpha or release");
|
|
196
|
+
const packageMetadata = args.includes("--package-metadata")
|
|
197
|
+
? readJsonFlag(args, "package-metadata")
|
|
198
|
+
: JSON.parse(execFileSync("npm", ["view", `${source.package}@${distTag}`, "--json", "--registry=https://registry.npmjs.org/"], {
|
|
199
|
+
encoding: "utf8",
|
|
200
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
201
|
+
}));
|
|
202
|
+
const attestationUrl = packageMetadata.dist?.attestations?.url;
|
|
203
|
+
if (!attestationUrl) throw new Error("published npm package does not expose an attestation URL");
|
|
204
|
+
let attestations;
|
|
205
|
+
if (args.includes("--attestations")) {
|
|
206
|
+
attestations = readJsonFlag(args, "attestations");
|
|
207
|
+
} else {
|
|
208
|
+
const response = await fetch(attestationUrl, { headers: { accept: "application/json" } });
|
|
209
|
+
if (!response.ok) throw new Error(`npm attestation lookup failed: HTTP ${response.status}`);
|
|
210
|
+
attestations = await response.json();
|
|
211
|
+
}
|
|
212
|
+
const upstreamRelease = resolveNpmRegistryRelease({ source, channel, packageMetadata, attestations });
|
|
213
|
+
return createManualUpstreamPickupPlan({
|
|
214
|
+
config,
|
|
215
|
+
sourceId,
|
|
216
|
+
channel,
|
|
217
|
+
currentVersion: readFlag(args, "current-version"),
|
|
218
|
+
upstreamRelease,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
async function runPickupCli(args) {
|
|
223
|
+
const [mode = "", ...pickupArgs] = args;
|
|
224
|
+
if (!mode || mode === "--help" || mode === "-h") {
|
|
225
|
+
process.stdout.write(usage());
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (mode !== "plan" && mode !== "create") throw new Error(`unsupported release-propagation pickup command: ${mode}`);
|
|
229
|
+
const plan = await resolvePickupPlan(pickupArgs);
|
|
230
|
+
const result = mode === "create"
|
|
231
|
+
? createManualUpstreamPickupCapture({
|
|
232
|
+
plan,
|
|
233
|
+
expectedDownstreamBaseSha: readFlag(pickupArgs, "expected-downstream-base-sha"),
|
|
234
|
+
})
|
|
235
|
+
: plan;
|
|
236
|
+
writeOutput(readFlag(pickupArgs, "output", ""), result);
|
|
237
|
+
if (hasFlag(pickupArgs, "json")) printJson(result);
|
|
238
|
+
else if (mode === "plan") process.stdout.write(`manual upstream pickup: ${plan.source.id} ${plan.currentVersion} -> ${plan.resolvedVersion} (${plan.status})\n`);
|
|
239
|
+
else process.stdout.write(`manual upstream pickup next action: ${result.nextAction}\n`);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export async function runReleasePropagationCli(argv = process.argv.slice(2)) {
|
|
175
243
|
const [mode = "", ...args] = argv;
|
|
176
244
|
if (!mode || mode === "--help" || mode === "-h") {
|
|
177
245
|
process.stdout.write(usage());
|
|
@@ -206,6 +274,10 @@ export function runReleasePropagationCli(argv = process.argv.slice(2)) {
|
|
|
206
274
|
runWorkCli(args);
|
|
207
275
|
return;
|
|
208
276
|
}
|
|
277
|
+
if (mode === "pickup") {
|
|
278
|
+
await runPickupCli(args);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
209
281
|
if (mode === "write-lock") {
|
|
210
282
|
const plan = readReleasePropagationJson(readFlag(args, "plan"), {
|
|
211
283
|
label: "--plan",
|
|
@@ -259,5 +331,8 @@ export function runReleasePropagationCli(argv = process.argv.slice(2)) {
|
|
|
259
331
|
}
|
|
260
332
|
|
|
261
333
|
if (!process.env.BUILDCHAIN_EMBEDDED_ENTRYPOINT && process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
262
|
-
runReleasePropagationCli()
|
|
334
|
+
runReleasePropagationCli().catch((error) => {
|
|
335
|
+
console.error(`buildchain release-propagation: ${error.message}`);
|
|
336
|
+
process.exitCode = 1;
|
|
337
|
+
});
|
|
263
338
|
}
|