@kungfu-tech/buildchain 3.0.5-alpha.7 → 3.0.5

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 (62) hide show
  1. package/README.md +0 -31
  2. package/actions/macos-credential-island/README.md +0 -8
  3. package/bin/buildchain.mjs +1 -1
  4. package/contracts/auditable-demo-media-profiles-v1.json +0 -61
  5. package/contracts/evidence/auditable-demo-responsive-web-delivery-v1.json +3 -3
  6. package/contracts/evidence/auditable-demo-web-delivery-v1.json +3 -3
  7. package/dist/site/buildchain-contract.json +25 -86
  8. package/dist/site/buildchain-site.json +38 -64
  9. package/dist/site/capability-registry.json +1 -1
  10. package/dist/site/cli-registry.json +2 -6
  11. package/dist/site/controller-registry.json +3 -11
  12. package/dist/site/kfd-claims.json +11 -53
  13. package/dist/site/kfd-upstream-aggregate.json +1 -1
  14. package/dist/site/manual-registry.json +7 -7
  15. package/dist/site/node-api-registry.json +31 -213
  16. package/dist/site/page-registry.json +20 -50
  17. package/dist/site/public-surface-audit.json +8 -98
  18. package/dist/site/publication-authority-registry.json +1 -42
  19. package/dist/site/publication-registry.json +4 -4
  20. package/dist/site/site-manifest.json +11 -11
  21. package/dist/site/workflow-registry.json +2 -67
  22. package/docs/auditable-demo.md +7 -74
  23. package/docs/aws-us-elastic-runner-burst-plane.md +16 -151
  24. package/docs/cli-reference.md +2 -24
  25. package/docs/node-api-reference.md +72 -90
  26. package/docs/publish-transaction.md +5 -7
  27. package/docs/release-flow.md +0 -4
  28. package/docs/release-governance.md +0 -39
  29. package/docs/reusable-build-surface.md +0 -9
  30. package/package.json +1 -1
  31. package/packages/core/buildchain-contract.js +1 -36
  32. package/packages/core/buildchain-publication-authority.js +0 -2
  33. package/packages/core/public-surface-audit.js +35 -4
  34. package/packages/core/release-propagation-release.js +18 -61
  35. package/packages/core/release-propagation-work.js +3 -7
  36. package/packages/core/release-propagation.js +2 -12
  37. package/scripts/auditable-demo-renditions.mjs +2 -7
  38. package/scripts/auditable-demo.mjs +21 -27
  39. package/scripts/aws-windows-jit-controller-core.mjs +2 -20
  40. package/scripts/aws-windows-jit-controller.mjs +109 -184
  41. package/scripts/aws-windows-jit-core.mjs +3 -21
  42. package/scripts/aws-windows-jit.mjs +0 -2
  43. package/scripts/build-standalone-binary.mjs +0 -4
  44. package/scripts/buildchain-cli-help.mjs +1 -2
  45. package/scripts/capture-package-release-propagation.mjs +1 -24
  46. package/scripts/check-inventory.mjs +0 -5
  47. package/scripts/finalize-native-artifact-signing-result.mjs +15 -37
  48. package/scripts/generate-site-bundle.mjs +0 -2
  49. package/scripts/locked-source-checkout.mjs +3 -17
  50. package/scripts/release-propagation.mjs +2 -77
  51. package/contracts/auditable-demo-scenario-v1.schema.json +0 -153
  52. package/packages/core/release-propagation-pickup.js +0 -386
  53. package/packages/core/workflow-call-contract.js +0 -308
  54. package/packages/core/workflow-yaml-contract.js +0 -272
  55. package/scripts/auditable-demo-platform.mjs +0 -506
  56. package/scripts/aws-macos-jit-controller-core.mjs +0 -389
  57. package/scripts/aws-macos-jit-controller-runtime.mjs +0 -82
  58. package/scripts/aws-macos-jit-controller.mjs +0 -558
  59. package/scripts/aws-macos-jit-job-controller.mjs +0 -401
  60. package/scripts/aws-windows-jit-campaign-core.mjs +0 -296
  61. package/scripts/aws-windows-jit-campaign.mjs +0 -202
  62. package/scripts/workflow-call-contract.mjs +0 -133
@@ -1,272 +0,0 @@
1
- function indentation(line) {
2
- return line.match(/^(\s*)/)?.[1].length || 0;
3
- }
4
-
5
- function stripComment(value) {
6
- let quote = "";
7
- for (let index = 0; index < value.length; index += 1) {
8
- const char = value[index];
9
- if ((char === '"' || char === "'") && value[index - 1] !== "\\") {
10
- quote = quote === char ? "" : quote || char;
11
- }
12
- if (
13
- char === "#" &&
14
- !quote &&
15
- (index === 0 || /\s/.test(value[index - 1]))
16
- ) {
17
- return value.slice(0, index).trimEnd();
18
- }
19
- }
20
- return value.trimEnd();
21
- }
22
-
23
- function unquote(value) {
24
- const trimmed = stripComment(String(value || "").trim());
25
- if (
26
- trimmed.length >= 2 &&
27
- trimmed[0] === trimmed.at(-1) &&
28
- ['"', "'"].includes(trimmed[0])
29
- ) {
30
- return trimmed.slice(1, -1);
31
- }
32
- return trimmed;
33
- }
34
-
35
- function blockValue(lines, entry) {
36
- if (!/^[>|][+-]?$/.test(entry.value)) return entry.value;
37
- const values = [];
38
- for (let index = entry.line + 1; index < lines.length; index += 1) {
39
- const line = lines[index];
40
- if (line.trim() && indentation(line) <= entry.indent) break;
41
- values.push(line);
42
- }
43
- const content = values.filter((line) => line.trim());
44
- const contentIndent = content.length
45
- ? Math.min(...content.map(indentation))
46
- : entry.indent + 2;
47
- return values
48
- .map((line) => line.slice(Math.min(contentIndent, line.length)))
49
- .join("\n")
50
- .trimEnd();
51
- }
52
-
53
- function directEntries(lines, parentLine) {
54
- const parentIndent = indentation(lines[parentLine]);
55
- let childIndent = null;
56
- for (let index = parentLine + 1; index < lines.length; index += 1) {
57
- const line = lines[index];
58
- if (!line.trim() || line.trim().startsWith("#")) continue;
59
- const indent = indentation(line);
60
- if (indent <= parentIndent) break;
61
- childIndent = childIndent === null ? indent : Math.min(childIndent, indent);
62
- }
63
- if (childIndent === null) return [];
64
- const entries = [];
65
- for (let index = parentLine + 1; index < lines.length; index += 1) {
66
- const line = lines[index];
67
- const trimmed = line.trim();
68
- const indent = indentation(line);
69
- if (trimmed && indent <= parentIndent) break;
70
- if (!trimmed || trimmed.startsWith("#") || indent !== childIndent)
71
- continue;
72
- const match = line.match(/^\s*([A-Za-z0-9_.-]+):(?:\s*(.*))?$/);
73
- if (match) {
74
- entries.push({
75
- key: match[1],
76
- value: stripComment(match[2] || ""),
77
- line: index,
78
- indent,
79
- });
80
- }
81
- }
82
- return entries;
83
- }
84
-
85
- function compareCodeUnits(left, right) {
86
- return left < right ? -1 : left > right ? 1 : 0;
87
- }
88
-
89
- function topLevelEntry(lines, key) {
90
- const pattern = new RegExp(
91
- `^${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}:(?:\\s*(.*))?$`,
92
- );
93
- for (let index = 0; index < lines.length; index += 1) {
94
- const match = lines[index].match(pattern);
95
- if (match)
96
- return {
97
- key,
98
- value: stripComment(match[1] || ""),
99
- line: index,
100
- indent: 0,
101
- };
102
- }
103
- return null;
104
- }
105
-
106
- function childEntry(lines, parent, key) {
107
- return (
108
- directEntries(lines, parent.line).find((entry) => entry.key === key) || null
109
- );
110
- }
111
-
112
- function scalar(value) {
113
- const raw = stripComment(String(value || "").trim());
114
- if (raw.length >= 2 && raw[0] === raw.at(-1) && ['"', "'"].includes(raw[0])) {
115
- return { kind: "string", value: raw.slice(1, -1) };
116
- }
117
- const text = unquote(raw);
118
- if (/^\$\{\{[\s\S]*\}\}$/.test(text))
119
- return { kind: "expression", value: text };
120
- if (/^(true|false)$/i.test(text))
121
- return { kind: "boolean", value: text.toLowerCase() === "true" };
122
- if (/^-?(?:0|[1-9]\d*)(?:\.\d+)?$/.test(text))
123
- return { kind: "number", value: Number(text) };
124
- if (/^(null|~)$/i.test(text)) return { kind: "null", value: null };
125
- return { kind: "string", value: text };
126
- }
127
-
128
- function parsePermissions(lines, entry) {
129
- if (!entry) return {};
130
- if (entry.value) return { "*": unquote(entry.value) };
131
- return Object.fromEntries(
132
- directEntries(lines, entry.line).map((item) => [
133
- item.key,
134
- unquote(item.value),
135
- ]),
136
- );
137
- }
138
-
139
- function parseTriggers(lines) {
140
- const on = topLevelEntry(lines, "on");
141
- if (!on) return [];
142
- if (on.value) {
143
- const inline = unquote(on.value);
144
- if (inline.startsWith("[") && inline.endsWith("]")) {
145
- return inline
146
- .slice(1, -1)
147
- .split(",")
148
- .map((value) => unquote(value.trim()))
149
- .filter(Boolean)
150
- .sort();
151
- }
152
- return inline ? [inline] : [];
153
- }
154
- const events = [];
155
- for (const event of directEntries(lines, on.line)) {
156
- const types = childEntry(lines, event, "types");
157
- const rawTypes = types ? unquote(types.value) : "";
158
- if (rawTypes.startsWith("[") && rawTypes.endsWith("]")) {
159
- for (const type of rawTypes
160
- .slice(1, -1)
161
- .split(",")
162
- .map((value) => unquote(value.trim()))
163
- .filter(Boolean)) {
164
- events.push(`${event.key}:${type}`);
165
- }
166
- } else {
167
- events.push(event.key);
168
- }
169
- }
170
- return [...new Set(events)].sort();
171
- }
172
-
173
- function definition(lines, entry) {
174
- const properties = Object.fromEntries(
175
- directEntries(lines, entry.line).map((item) => [
176
- item.key,
177
- blockValue(lines, item),
178
- ]),
179
- );
180
- return {
181
- name: entry.key,
182
- type: unquote(properties.type || "string"),
183
- required: scalar(properties.required || "false").value === true,
184
- default:
185
- properties.default === undefined ? null : scalar(properties.default),
186
- };
187
- }
188
-
189
- export function parseReusableWorkflowInterface(text) {
190
- const lines = String(text || "").split(/\r?\n/);
191
- const on = topLevelEntry(lines, "on");
192
- const workflowCall = on && childEntry(lines, on, "workflow_call");
193
- if (!workflowCall) {
194
- return {
195
- reusable: false,
196
- inputs: [],
197
- secrets: [],
198
- outputs: [],
199
- permissions: parsePermissions(lines, topLevelEntry(lines, "permissions")),
200
- };
201
- }
202
- const inputs = childEntry(lines, workflowCall, "inputs");
203
- const secrets = childEntry(lines, workflowCall, "secrets");
204
- const outputs = childEntry(lines, workflowCall, "outputs");
205
- return {
206
- reusable: true,
207
- inputs: inputs
208
- ? directEntries(lines, inputs.line)
209
- .map((entry) => definition(lines, entry))
210
- .sort((a, b) => compareCodeUnits(a.name, b.name))
211
- : [],
212
- secrets: secrets
213
- ? directEntries(lines, secrets.line)
214
- .map((entry) => definition(lines, entry))
215
- .sort((a, b) => compareCodeUnits(a.name, b.name))
216
- : [],
217
- outputs: outputs
218
- ? directEntries(lines, outputs.line)
219
- .map((entry) => entry.key)
220
- .sort()
221
- : [],
222
- permissions: parsePermissions(lines, topLevelEntry(lines, "permissions")),
223
- };
224
- }
225
-
226
- function parseJobMap(lines, entry) {
227
- if (!entry) return {};
228
- return Object.fromEntries(
229
- directEntries(lines, entry.line).map((item) => [
230
- item.key,
231
- scalar(blockValue(lines, item)),
232
- ]),
233
- );
234
- }
235
-
236
- export function parseWorkflowCallJobs(text) {
237
- const lines = String(text || "").split(/\r?\n/);
238
- const jobs = topLevelEntry(lines, "jobs");
239
- if (!jobs) return [];
240
- const topPermissions = parsePermissions(
241
- lines,
242
- topLevelEntry(lines, "permissions"),
243
- );
244
- return directEntries(lines, jobs.line)
245
- .map((job) => {
246
- const properties = directEntries(lines, job.line);
247
- const property = (name) =>
248
- properties.find((entry) => entry.key === name) || null;
249
- const secrets = property("secrets");
250
- return {
251
- id: job.key,
252
- uses: unquote(property("uses")?.value || ""),
253
- with: parseJobMap(lines, property("with")),
254
- secrets:
255
- secrets?.value === "inherit"
256
- ? "inherit"
257
- : parseJobMap(lines, secrets),
258
- permissions: property("permissions")
259
- ? parsePermissions(lines, property("permissions"))
260
- : topPermissions,
261
- };
262
- })
263
- .filter((job) => job.uses);
264
- }
265
-
266
- export function parseWorkflowDocument(text) {
267
- return {
268
- triggers: parseTriggers(String(text || "").split(/\r?\n/)),
269
- interface: parseReusableWorkflowInterface(text),
270
- callJobs: parseWorkflowCallJobs(text),
271
- };
272
- }