@design-ai/cli 4.55.0 → 4.56.0

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 (52) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +39 -0
  3. package/README.ko.md +7 -7
  4. package/README.md +9 -9
  5. package/cli/lib/mcp-server.mjs +208 -10
  6. package/cli/lib/site-analysis.mjs +297 -0
  7. package/cli/lib/site-args.mjs +433 -0
  8. package/cli/lib/site-bundle-build.mjs +127 -0
  9. package/cli/lib/site-bundle-check.mjs +454 -0
  10. package/cli/lib/site-bundle-commands.mjs +95 -0
  11. package/cli/lib/site-bundle-compare.mjs +157 -0
  12. package/cli/lib/site-bundle-contract.mjs +79 -0
  13. package/cli/lib/site-bundle-files.mjs +87 -0
  14. package/cli/lib/site-bundle-handoff-runbook-actions.mjs +113 -0
  15. package/cli/lib/site-bundle-handoff-runbook-evidence-fields.mjs +164 -0
  16. package/cli/lib/site-bundle-handoff-runbook-evidence.mjs +334 -0
  17. package/cli/lib/site-bundle-handoff-runbook-format.mjs +31 -0
  18. package/cli/lib/site-bundle-handoff-runbook-stage-metadata.mjs +84 -0
  19. package/cli/lib/site-bundle-handoff-runbook.mjs +1331 -0
  20. package/cli/lib/site-bundle-handoff-summary.mjs +183 -0
  21. package/cli/lib/site-bundle-handoff.mjs +271 -0
  22. package/cli/lib/site-bundle-readme.mjs +98 -0
  23. package/cli/lib/site-bundle-repair-report.mjs +143 -0
  24. package/cli/lib/site-bundle-repair.mjs +68 -0
  25. package/cli/lib/site-content.mjs +399 -0
  26. package/cli/lib/site-evidence.mjs +35 -0
  27. package/cli/lib/site-mcp-commands.mjs +28 -0
  28. package/cli/lib/site-mcp-probes.mjs +159 -0
  29. package/cli/lib/site-mcp-readiness.mjs +157 -0
  30. package/cli/lib/site-mcp-report.mjs +324 -0
  31. package/cli/lib/site-next-actions.mjs +333 -0
  32. package/cli/lib/site-options.mjs +104 -0
  33. package/cli/lib/site-prompts.mjs +332 -0
  34. package/cli/lib/site-starter.mjs +153 -0
  35. package/cli/lib/site-strings.mjs +23 -0
  36. package/cli/lib/site-tasks.mjs +93 -0
  37. package/cli/lib/site-workflow-graph.mjs +309 -0
  38. package/cli/lib/site-workspace.mjs +492 -0
  39. package/cli/lib/site.mjs +108 -6617
  40. package/docs/DISTRIBUTION.ko.md +35 -6
  41. package/docs/DISTRIBUTION.md +35 -8
  42. package/docs/RELEASE-CHECKLIST.md +20 -3
  43. package/docs/ROADMAP.md +2179 -0
  44. package/docs/external-status.md +22 -7
  45. package/docs/integrations/design-ai-mcp-server.md +32 -0
  46. package/docs/integrations/vscode-walkthrough.ko.md +3 -3
  47. package/docs/integrations/vscode-walkthrough.md +3 -3
  48. package/docs/site-overrides/main.html +1 -1
  49. package/package.json +1 -1
  50. package/tools/audit/package-smoke.py +106 -0
  51. package/tools/audit/registry-smoke.py +378 -10
  52. package/tools/audit/smoke_assertions.py +83 -22
@@ -0,0 +1,1331 @@
1
+ import {
2
+ getStageActionAffordance,
3
+ getStageActionButtonLabel,
4
+ getStageActionDisabledReason,
5
+ getStageActionDisabledReasonCode,
6
+ getStageActionEnabled,
7
+ getStageActionEvidenceTarget,
8
+ getStageActionEvidenceTargetLabel,
9
+ getStageActionInstruction,
10
+ getStageActionLabel,
11
+ getStageActionStatus,
12
+ getStageActionStatusLabel,
13
+ getStageActionStatusTone,
14
+ getStageActionType,
15
+ } from "./site-bundle-handoff-runbook-actions.mjs";
16
+ import {
17
+ buildEvidenceCaptureInitialValidationChecklist,
18
+ buildEvidenceCaptureInitialValidationChecklistSummary,
19
+ buildEvidenceCaptureInitialValidationDisplayMetadata,
20
+ buildEvidenceCaptureInitialValidationStates,
21
+ buildEvidenceCaptureInitialValidationSummary,
22
+ buildEvidenceCapturePayloadBindings,
23
+ buildEvidenceCapturePayloadFlatTemplate,
24
+ buildEvidenceCapturePayloadTemplate,
25
+ buildEvidenceCaptureValidationSpecs,
26
+ uniqueValues,
27
+ } from "./site-bundle-handoff-runbook-evidence.mjs";
28
+ import {
29
+ getStageActionEvidenceCaptureFields,
30
+ } from "./site-bundle-handoff-runbook-evidence-fields.mjs";
31
+ import {
32
+ formatBundleHandoffOperatorRunbookStageLine,
33
+ } from "./site-bundle-handoff-runbook-format.mjs";
34
+ import {
35
+ getStageActionBlockedStageKeys,
36
+ getStageActionCompletionCriteria,
37
+ getStageActionDependencyReason,
38
+ getStageActionDependencyReasonCode,
39
+ getStageActionEvidenceRequirements,
40
+ getStageActionPrerequisiteKeys,
41
+ getStageActionPrerequisiteLabels,
42
+ getStageLabel,
43
+ } from "./site-bundle-handoff-runbook-stage-metadata.mjs";
44
+
45
+ export function buildBundleHandoffCommandManifest({
46
+ sourceBundle,
47
+ taskCatalog,
48
+ defaultTask = null,
49
+ selectedTask = null,
50
+ effectiveTask = null,
51
+ } = {}) {
52
+ const commands = [];
53
+ const pushCommand = (entry) => {
54
+ if (!entry || !entry.command || !Array.isArray(entry.commandArgs) || entry.commandArgs.length === 0) return;
55
+ commands.push(entry);
56
+ };
57
+ const sourceValue = (field, fallback = "") => sourceBundle?.[field] || fallback;
58
+ const pushSourceCommand = (key, label, commandKey, argsKey, policyKey, safetyKey) => {
59
+ const safety = sourceValue(safetyKey, null);
60
+ pushCommand({
61
+ key,
62
+ scope: "source-bundle",
63
+ label,
64
+ command: sourceValue(commandKey),
65
+ commandArgs: sourceValue(argsKey, []),
66
+ runPolicy: sourceValue(policyKey),
67
+ safety,
68
+ strict: Boolean(safety?.strict),
69
+ taskId: "",
70
+ outputFile: "",
71
+ defaultTask: false,
72
+ selectedTask: false,
73
+ effectiveTask: false,
74
+ });
75
+ };
76
+ const pushTaskCommand = (task, { strict = false } = {}) => {
77
+ if (!task?.id) return;
78
+ const commandKey = strict ? "strictHandoffCommand" : "handoffCommand";
79
+ const argsKey = strict ? "strictHandoffCommandArgs" : "handoffCommandArgs";
80
+ const policyKey = strict ? "strictHandoffCommandRunPolicy" : "handoffCommandRunPolicy";
81
+ const safetyKey = strict ? "strictHandoffCommandSafety" : "handoffCommandSafety";
82
+ const taskValue = (field, fallback = "") => task[field] || fallback;
83
+ const safety = taskValue(safetyKey, null);
84
+ pushCommand({
85
+ key: `task.${task.id}.handoff.${strict ? "strict" : "default"}`,
86
+ scope: "task-handoff",
87
+ label: `${strict ? "Strict " : ""}Task handoff: ${task.id}`,
88
+ command: taskValue(commandKey),
89
+ commandArgs: taskValue(argsKey, []),
90
+ runPolicy: taskValue(policyKey),
91
+ safety,
92
+ strict,
93
+ taskId: task.id,
94
+ taskNumber: Number.isInteger(task.number) ? task.number : null,
95
+ outputFile: task.handoffOutFile || safety?.outputFile || "",
96
+ defaultTask: task.id === defaultTask?.id,
97
+ selectedTask: task.id === selectedTask?.id,
98
+ effectiveTask: task.id === effectiveTask?.id,
99
+ });
100
+ };
101
+
102
+ pushSourceCommand("source.bundleCheck", "Bundle check JSON", "checkCommand", "checkCommandArgs", "checkCommandRunPolicy", "checkCommandSafety");
103
+ pushSourceCommand("source.bundleCheck.strict", "Strict bundle check JSON", "strictCheckCommand", "strictCheckCommandArgs", "strictCheckCommandRunPolicy", "strictCheckCommandSafety");
104
+ pushSourceCommand("source.bundleHandoff", "Bundle handoff JSON", "handoffCommand", "handoffCommandArgs", "handoffCommandRunPolicy", "handoffCommandSafety");
105
+ pushSourceCommand("source.bundleHandoff.strict", "Strict bundle handoff JSON", "strictHandoffCommand", "strictHandoffCommandArgs", "strictHandoffCommandRunPolicy", "strictHandoffCommandSafety");
106
+ for (const task of taskCatalog?.items || []) {
107
+ pushTaskCommand(task);
108
+ pushTaskCommand(task, { strict: true });
109
+ }
110
+
111
+ const countBy = (predicate) => commands.filter(predicate).length;
112
+ const isSourceBundleCommand = (command) => command.scope === "source-bundle";
113
+ const isTaskHandoffCommand = (command) => command.scope === "task-handoff";
114
+ const usesReadOnlyRunPolicy = (command) => command.runPolicy === "read-only";
115
+ const usesLocalOutputRunPolicy = (command) => command.runPolicy === "writes-local-file";
116
+ const hasExternalCallSafety = (command) => command.safety?.externalCalls === true;
117
+ const hasTargetRepoMutationSafety = (command) => command.safety?.targetRepoMutation === true;
118
+ const requiresCleanWorkspaceSafety = (command) => command.safety?.requiresCleanWorkspace === true;
119
+ const requiresReviewBeforeMutationSafety = (command) => command.safety?.requiresReviewBeforeMutation === true;
120
+ const effectiveTaskId = effectiveTask?.id || "";
121
+ const selectedTaskId = selectedTask?.id || "";
122
+ const defaultTaskId = defaultTask?.id || "";
123
+ const manifestCountSummary = {
124
+ commandCount: commands.length,
125
+ sourceCommandCount: countBy(isSourceBundleCommand),
126
+ taskCommandCount: countBy(isTaskHandoffCommand),
127
+ readOnlyCount: countBy(usesReadOnlyRunPolicy),
128
+ localOutputFileCount: countBy(usesLocalOutputRunPolicy),
129
+ externalCallCount: countBy(hasExternalCallSafety),
130
+ targetRepoMutationCount: countBy(hasTargetRepoMutationSafety),
131
+ requiresCleanWorkspaceCount: countBy(requiresCleanWorkspaceSafety),
132
+ requiresReviewBeforeMutationCount: countBy(requiresReviewBeforeMutationSafety),
133
+ };
134
+ const manifestTaskSelection = {
135
+ defaultTaskId,
136
+ selectedTaskId,
137
+ effectiveTaskId,
138
+ };
139
+ const manifestStrictCommandKeys = {
140
+ defaultStrictTaskCommandKey: defaultTaskId ? `task.${defaultTaskId}.handoff.strict` : "",
141
+ selectedStrictTaskCommandKey: selectedTaskId ? `task.${selectedTaskId}.handoff.strict` : "",
142
+ effectiveStrictTaskCommandKey: effectiveTaskId ? `task.${effectiveTaskId}.handoff.strict` : "",
143
+ };
144
+ return {
145
+ version: 1,
146
+ source: "bundle-handoff",
147
+ ...manifestCountSummary,
148
+ ...manifestTaskSelection,
149
+ ...manifestStrictCommandKeys,
150
+ commands,
151
+ };
152
+ }
153
+
154
+ export function buildBundleHandoffOperatorRunbook(commandManifest) {
155
+ const commands = Array.isArray(commandManifest?.commands) ? commandManifest.commands : [];
156
+ const commandByKey = new Map(commands.map((command) => [command.key, command]));
157
+ const buildStage = ({
158
+ step,
159
+ key,
160
+ label,
161
+ kind,
162
+ required,
163
+ commandKeys = [],
164
+ reason,
165
+ manual = false,
166
+ }) => {
167
+ const stageCommands = commandKeys
168
+ .map((commandKey) => commandByKey.get(commandKey))
169
+ .filter(Boolean);
170
+ const firstCommand = stageCommands[0] || null;
171
+ const firstCommandSafety = firstCommand?.safety || null;
172
+ const commandHasSafetyFlag = (command, field) => command.safety?.[field] === true;
173
+ const commandCount = stageCommands.length;
174
+ const stageIdentity = {
175
+ step,
176
+ key,
177
+ label,
178
+ kind,
179
+ required,
180
+ };
181
+ const stageCommandSummary = {
182
+ commandKeys,
183
+ commands: stageCommands,
184
+ commandCount,
185
+ runPolicy: manual ? "manual-target-repo" : (firstCommand?.runPolicy || ""),
186
+ safetyLevel: manual ? "operator-controlled-target-repo" : (firstCommandSafety?.safetyLevel || ""),
187
+ };
188
+ const stageSafetySummary = {
189
+ writesLocalFile: stageCommands.some((command) => commandHasSafetyFlag(command, "writesLocalFile")),
190
+ outputFiles: stageCommands.map((command) => command.outputFile).filter(Boolean),
191
+ externalCalls: stageCommands.some((command) => commandHasSafetyFlag(command, "externalCalls")),
192
+ targetRepoMutation: stageCommands.some((command) => commandHasSafetyFlag(command, "targetRepoMutation")),
193
+ };
194
+ return {
195
+ ...stageIdentity,
196
+ ...stageCommandSummary,
197
+ ...stageSafetySummary,
198
+ reason,
199
+ };
200
+ };
201
+ const effectiveStrictTaskCommandKey = commandManifest?.effectiveStrictTaskCommandKey || "";
202
+ const stages = [
203
+ buildStage({
204
+ step: 1,
205
+ key: "verifySourceBundle",
206
+ label: "Verify source bundle integrity",
207
+ kind: "read-only-gate",
208
+ required: true,
209
+ commandKeys: ["source.bundleCheck.strict"],
210
+ reason: "Confirm the bundle still matches its checksum and generated-file contract before handoff execution.",
211
+ }),
212
+ buildStage({
213
+ step: 2,
214
+ key: "refreshHandoffSnapshot",
215
+ label: "Refresh strict handoff JSON snapshot",
216
+ kind: "read-only-preview",
217
+ required: false,
218
+ commandKeys: ["source.bundleHandoff.strict"],
219
+ reason: "Regenerate the machine-readable handoff snapshot when a wrapper or GUI needs the latest JSON contract.",
220
+ }),
221
+ buildStage({
222
+ step: 3,
223
+ key: "writeEffectiveTaskPrompt",
224
+ label: "Write effective task handoff prompt",
225
+ kind: "local-output",
226
+ required: true,
227
+ commandKeys: effectiveStrictTaskCommandKey ? [effectiveStrictTaskCommandKey] : [],
228
+ reason: "Create the selected task prompt as a local file before moving into the target website repository.",
229
+ }),
230
+ buildStage({
231
+ step: 4,
232
+ key: "executeInTargetRepo",
233
+ label: "Execute the task in the target website repo",
234
+ kind: "manual-target-repo",
235
+ required: true,
236
+ manual: true,
237
+ reason: "Open the generated task prompt in the target repo, inspect architecture first, then implement and verify there.",
238
+ }),
239
+ buildStage({
240
+ step: 5,
241
+ key: "recordEvidence",
242
+ label: "Record implementation evidence",
243
+ kind: "manual-reporting",
244
+ required: true,
245
+ manual: true,
246
+ reason: "Return changed files, verification commands, browser/viewport checks, remaining risks, and the bundle digest.",
247
+ }),
248
+ ];
249
+ const hasCommands = (stage) => stage.commandCount > 0;
250
+ const isManualStage = (stage) => !hasCommands(stage);
251
+ const isRequiredStage = (stage) => stage.required;
252
+ const isOptionalStage = (stage) => !stage.required;
253
+ const usesReadOnlyRunPolicy = (stage) => stage.runPolicy === "read-only";
254
+ const usesLocalOutputRunPolicy = (stage) => stage.runPolicy === "writes-local-file";
255
+ const hasOutputFile = (stage) => stage.outputFiles.length > 0;
256
+ const callsExternalSystem = (stage) => stage.externalCalls;
257
+ const mutatesTargetRepo = (stage) => stage.targetRepoMutation;
258
+ const commandStages = stages.filter(hasCommands);
259
+ const stageActionRows = stages.map((stage) => {
260
+ const prerequisiteKeys = getStageActionPrerequisiteKeys(stage);
261
+ const blockedStageKeys = getStageActionBlockedStageKeys(stage, stages);
262
+ const completionCriteria = getStageActionCompletionCriteria(stage);
263
+ const evidenceRequirements = getStageActionEvidenceRequirements(stage);
264
+ const evidenceCaptureFields = getStageActionEvidenceCaptureFields(stage);
265
+ const evidenceFieldValues = (field) => evidenceCaptureFields.map((evidenceField) => evidenceField[field]);
266
+ const evidenceCaptureSectionKeys = uniqueValues(evidenceFieldValues("sectionKey"));
267
+ const evidenceCaptureSectionLabels = uniqueValues(evidenceFieldValues("sectionLabel"));
268
+ const evidenceCapturePayloadNamespaces = uniqueValues(evidenceFieldValues("payloadNamespace"));
269
+ const requiredEvidenceCaptureFields = evidenceCaptureFields.filter((field) => field.required);
270
+ const optionalEvidenceCaptureFields = evidenceCaptureFields.filter((field) => !field.required);
271
+ const actionEvidenceSummary = {
272
+ actionEvidenceRequirements: evidenceRequirements,
273
+ actionEvidenceRequirementCount: evidenceRequirements.length,
274
+ actionRequiresEvidence: evidenceRequirements.length > 0,
275
+ actionEvidenceTarget: getStageActionEvidenceTarget(stage),
276
+ actionEvidenceTargetLabel: getStageActionEvidenceTargetLabel(stage),
277
+ };
278
+ const actionIdentity = {
279
+ step: stage.step,
280
+ key: stage.key,
281
+ label: stage.label,
282
+ };
283
+ const actionStatusSummary = {
284
+ actionType: getStageActionType(stage),
285
+ actionLabel: getStageActionLabel(stage),
286
+ actionInstruction: getStageActionInstruction(stage),
287
+ actionButtonLabel: getStageActionButtonLabel(stage),
288
+ actionAffordance: getStageActionAffordance(stage),
289
+ actionEnabled: getStageActionEnabled(stage),
290
+ actionStatus: getStageActionStatus(stage),
291
+ actionStatusLabel: getStageActionStatusLabel(stage),
292
+ actionStatusTone: getStageActionStatusTone(stage),
293
+ actionDisabledReasonCode: getStageActionDisabledReasonCode(stage),
294
+ actionDisabledReason: getStageActionDisabledReason(stage),
295
+ };
296
+ const actionDependencySummary = {
297
+ actionPrerequisiteKeys: prerequisiteKeys,
298
+ actionPrerequisiteLabels: getStageActionPrerequisiteLabels(stage, stages),
299
+ actionPrerequisiteCount: prerequisiteKeys.length,
300
+ actionHasPrerequisites: prerequisiteKeys.length > 0,
301
+ actionDependencyReasonCode: getStageActionDependencyReasonCode(stage),
302
+ actionDependencyReason: getStageActionDependencyReason(stage),
303
+ actionBlockedStageKeys: blockedStageKeys,
304
+ actionBlockedStageLabels: blockedStageKeys.map((stageKey) => getStageLabel(stages, stageKey)),
305
+ actionBlockedStageCount: blockedStageKeys.length,
306
+ actionBlocksStages: blockedStageKeys.length > 0,
307
+ actionCompletionCriteria: completionCriteria,
308
+ actionCompletionCriteriaCount: completionCriteria.length,
309
+ actionHasCompletionCriteria: completionCriteria.length > 0,
310
+ };
311
+ const actionEvidenceCaptureSummary = {
312
+ actionEvidenceCaptureFields: evidenceCaptureFields,
313
+ actionEvidenceCaptureFieldKeys: evidenceFieldValues("key"),
314
+ actionEvidenceCaptureFieldLabels: evidenceFieldValues("label"),
315
+ actionEvidenceCaptureFieldPlaceholders: evidenceFieldValues("placeholder"),
316
+ actionEvidenceCaptureFieldRequirementLabels: evidenceFieldValues("requirementLabel"),
317
+ actionEvidenceCaptureFieldAriaLabels: evidenceFieldValues("ariaLabel"),
318
+ actionEvidenceCaptureFieldHelpTexts: evidenceFieldValues("helpText"),
319
+ actionEvidenceCaptureFieldSectionKeys: evidenceFieldValues("sectionKey"),
320
+ actionEvidenceCaptureFieldSectionLabels: evidenceFieldValues("sectionLabel"),
321
+ actionEvidenceCaptureSectionKeys: evidenceCaptureSectionKeys,
322
+ actionEvidenceCaptureSectionLabels: evidenceCaptureSectionLabels,
323
+ actionEvidenceCaptureSectionCount: evidenceCaptureSectionKeys.length,
324
+ actionEvidenceCaptureFieldPayloadNamespaces: evidenceFieldValues("payloadNamespace"),
325
+ actionEvidenceCaptureFieldPayloadPaths: evidenceFieldValues("payloadPath"),
326
+ actionEvidenceCapturePayloadNamespaces: evidenceCapturePayloadNamespaces,
327
+ actionEvidenceCapturePayloadNamespaceCount: evidenceCapturePayloadNamespaces.length,
328
+ actionEvidenceCapturePayloadTemplate: buildEvidenceCapturePayloadTemplate(evidenceCaptureFields),
329
+ actionEvidenceCapturePayloadFlatTemplate: buildEvidenceCapturePayloadFlatTemplate(evidenceCaptureFields),
330
+ actionEvidenceCapturePayloadBindings: buildEvidenceCapturePayloadBindings(evidenceCaptureFields),
331
+ actionEvidenceCaptureValidationSpecs: buildEvidenceCaptureValidationSpecs(evidenceCaptureFields),
332
+ actionEvidenceCaptureInitialValidationStates: buildEvidenceCaptureInitialValidationStates(evidenceCaptureFields),
333
+ actionEvidenceCaptureInitialValidationDisplayMetadata: buildEvidenceCaptureInitialValidationDisplayMetadata(evidenceCaptureFields),
334
+ actionEvidenceCaptureInitialValidationChecklist: buildEvidenceCaptureInitialValidationChecklist(evidenceCaptureFields),
335
+ actionEvidenceCaptureInitialValidationChecklistSummary: buildEvidenceCaptureInitialValidationChecklistSummary(evidenceCaptureFields),
336
+ actionEvidenceCaptureInitialValidationSummary: buildEvidenceCaptureInitialValidationSummary(evidenceCaptureFields),
337
+ actionEvidenceCaptureFieldInputTypes: evidenceFieldValues("inputType"),
338
+ actionEvidenceCaptureFieldValueShapes: evidenceFieldValues("valueShape"),
339
+ actionEvidenceCaptureFieldAcceptsMultiple: evidenceFieldValues("acceptsMultiple"),
340
+ actionEvidenceCaptureFieldDefaultValues: evidenceFieldValues("defaultValue"),
341
+ actionEvidenceCaptureFieldEmptyValues: evidenceFieldValues("emptyValue"),
342
+ actionEvidenceCaptureFieldValidationRules: evidenceFieldValues("validationRule"),
343
+ actionEvidenceCaptureFieldMinLengths: evidenceFieldValues("minLength"),
344
+ actionEvidenceCaptureFieldExamples: evidenceFieldValues("example"),
345
+ actionEvidenceCaptureFieldValidationHints: evidenceFieldValues("validationHint"),
346
+ actionRequiredEvidenceCaptureFieldKeys: requiredEvidenceCaptureFields.map((field) => field.key),
347
+ actionOptionalEvidenceCaptureFieldKeys: optionalEvidenceCaptureFields.map((field) => field.key),
348
+ actionEvidenceCaptureFieldCount: evidenceCaptureFields.length,
349
+ actionRequiredEvidenceCaptureFieldCount: requiredEvidenceCaptureFields.length,
350
+ actionOptionalEvidenceCaptureFieldCount: optionalEvidenceCaptureFields.length,
351
+ actionHasEvidenceCaptureFields: evidenceCaptureFields.length > 0,
352
+ };
353
+ const actionExecutionSummary = {
354
+ required: stage.required,
355
+ runPolicy: stage.runPolicy,
356
+ safetyLevel: stage.safetyLevel,
357
+ commandKeys: stage.commandKeys,
358
+ commandCount: stage.commandCount,
359
+ outputFiles: stage.outputFiles,
360
+ manual: isManualStage(stage),
361
+ writesLocalFile: stage.writesLocalFile,
362
+ externalCalls: stage.externalCalls,
363
+ targetRepoMutation: stage.targetRepoMutation,
364
+ };
365
+
366
+ return {
367
+ ...actionIdentity,
368
+ ...actionStatusSummary,
369
+ ...actionDependencySummary,
370
+ ...actionEvidenceSummary,
371
+ ...actionEvidenceCaptureSummary,
372
+ ...actionExecutionSummary,
373
+ };
374
+ });
375
+ const byKey = (rows, getValue) => Object.fromEntries(
376
+ rows.map((row, index) => [row.key, getValue(row, index)]),
377
+ );
378
+ const fieldByKey = (rows, field) => byKey(rows, (row) => row[field]);
379
+ const stageFieldByKey = (field) => fieldByKey(stages, field);
380
+ const actionFieldByKey = (field) => fieldByKey(stageActionRows, field);
381
+ const commandListByKey = (getValue) => byKey(stages, (stage) => stage.commands.map(getValue));
382
+ const stageKeys = stages.map((stage) => stage.key);
383
+ const stageByKey = byKey(stages, (stage) => stage);
384
+ const stageLabelByKey = stageFieldByKey("label");
385
+ const stageSummaryByKey = stageFieldByKey("reason");
386
+ const stageActionTypeByKey = actionFieldByKey("actionType");
387
+ const stageActionLabelByKey = actionFieldByKey("actionLabel");
388
+ const stageActionInstructionsByKey = actionFieldByKey("actionInstruction");
389
+ const stageActionButtonLabelsByKey = actionFieldByKey("actionButtonLabel");
390
+ const stageActionAffordanceByKey = actionFieldByKey("actionAffordance");
391
+ const stageActionEnabledByKey = actionFieldByKey("actionEnabled");
392
+ const stageActionStatusByKey = actionFieldByKey("actionStatus");
393
+ const stageActionStatusLabelsByKey = actionFieldByKey("actionStatusLabel");
394
+ const stageActionStatusToneByKey = actionFieldByKey("actionStatusTone");
395
+ const stageActionDisabledReasonCodeByKey = actionFieldByKey("actionDisabledReasonCode");
396
+ const stageActionDisabledReasonByKey = actionFieldByKey("actionDisabledReason");
397
+ const stageActionPrerequisiteKeysByKey = actionFieldByKey("actionPrerequisiteKeys");
398
+ const stageActionPrerequisiteLabelsByKey = actionFieldByKey("actionPrerequisiteLabels");
399
+ const stageActionPrerequisiteCountByKey = actionFieldByKey("actionPrerequisiteCount");
400
+ const stageActionHasPrerequisitesByKey = actionFieldByKey("actionHasPrerequisites");
401
+ const stageActionDependencyReasonCodeByKey = actionFieldByKey("actionDependencyReasonCode");
402
+ const stageActionDependencyReasonByKey = actionFieldByKey("actionDependencyReason");
403
+ const stageActionBlockedStageKeysByKey = actionFieldByKey("actionBlockedStageKeys");
404
+ const stageActionBlockedStageLabelsByKey = actionFieldByKey("actionBlockedStageLabels");
405
+ const stageActionBlockedStageCountByKey = actionFieldByKey("actionBlockedStageCount");
406
+ const stageActionBlocksStagesByKey = actionFieldByKey("actionBlocksStages");
407
+ const stageActionCompletionCriteriaByKey = actionFieldByKey("actionCompletionCriteria");
408
+ const stageActionCompletionCriteriaCountByKey = actionFieldByKey("actionCompletionCriteriaCount");
409
+ const stageActionHasCompletionCriteriaByKey = actionFieldByKey("actionHasCompletionCriteria");
410
+ const stageActionEvidenceRequirementsByKey = actionFieldByKey("actionEvidenceRequirements");
411
+ const stageActionEvidenceRequirementCountByKey = actionFieldByKey("actionEvidenceRequirementCount");
412
+ const stageActionRequiresEvidenceByKey = actionFieldByKey("actionRequiresEvidence");
413
+ const stageActionEvidenceTargetByKey = actionFieldByKey("actionEvidenceTarget");
414
+ const stageActionEvidenceTargetLabelByKey = actionFieldByKey("actionEvidenceTargetLabel");
415
+ const stageActionEvidenceCaptureFieldsByKey = actionFieldByKey("actionEvidenceCaptureFields");
416
+ const stageActionEvidenceCaptureFieldKeysByKey = actionFieldByKey("actionEvidenceCaptureFieldKeys");
417
+ const stageActionEvidenceCaptureFieldLabelsByKey = actionFieldByKey("actionEvidenceCaptureFieldLabels");
418
+ const stageActionEvidenceCaptureFieldPlaceholdersByKey = actionFieldByKey("actionEvidenceCaptureFieldPlaceholders");
419
+ const stageActionEvidenceCaptureFieldRequirementLabelsByKey = actionFieldByKey("actionEvidenceCaptureFieldRequirementLabels");
420
+ const stageActionEvidenceCaptureFieldAriaLabelsByKey = actionFieldByKey("actionEvidenceCaptureFieldAriaLabels");
421
+ const stageActionEvidenceCaptureFieldHelpTextsByKey = actionFieldByKey("actionEvidenceCaptureFieldHelpTexts");
422
+ const stageActionEvidenceCaptureFieldSectionKeysByKey = actionFieldByKey("actionEvidenceCaptureFieldSectionKeys");
423
+ const stageActionEvidenceCaptureFieldSectionLabelsByKey = actionFieldByKey("actionEvidenceCaptureFieldSectionLabels");
424
+ const stageActionEvidenceCaptureSectionKeysByKey = actionFieldByKey("actionEvidenceCaptureSectionKeys");
425
+ const stageActionEvidenceCaptureSectionLabelsByKey = actionFieldByKey("actionEvidenceCaptureSectionLabels");
426
+ const stageActionEvidenceCaptureSectionCountByKey = actionFieldByKey("actionEvidenceCaptureSectionCount");
427
+ const stageActionEvidenceCaptureFieldPayloadNamespacesByKey = actionFieldByKey("actionEvidenceCaptureFieldPayloadNamespaces");
428
+ const stageActionEvidenceCaptureFieldPayloadPathsByKey = actionFieldByKey("actionEvidenceCaptureFieldPayloadPaths");
429
+ const stageActionEvidenceCapturePayloadNamespacesByKey = actionFieldByKey("actionEvidenceCapturePayloadNamespaces");
430
+ const stageActionEvidenceCapturePayloadNamespaceCountByKey = actionFieldByKey("actionEvidenceCapturePayloadNamespaceCount");
431
+ const stageActionEvidenceCapturePayloadTemplateByKey = actionFieldByKey("actionEvidenceCapturePayloadTemplate");
432
+ const stageActionEvidenceCapturePayloadFlatTemplateByKey = actionFieldByKey("actionEvidenceCapturePayloadFlatTemplate");
433
+ const stageActionEvidenceCapturePayloadBindingsByKey = actionFieldByKey("actionEvidenceCapturePayloadBindings");
434
+ const stageActionEvidenceCaptureValidationSpecsByKey = actionFieldByKey("actionEvidenceCaptureValidationSpecs");
435
+ const stageActionEvidenceCaptureInitialValidationStatesByKey = actionFieldByKey("actionEvidenceCaptureInitialValidationStates");
436
+ const stageActionEvidenceCaptureInitialValidationDisplayMetadataByKey = actionFieldByKey("actionEvidenceCaptureInitialValidationDisplayMetadata");
437
+ const stageActionEvidenceCaptureInitialValidationChecklistByKey = actionFieldByKey("actionEvidenceCaptureInitialValidationChecklist");
438
+ const stageActionEvidenceCaptureInitialValidationChecklistSummaryByKey = actionFieldByKey("actionEvidenceCaptureInitialValidationChecklistSummary");
439
+ const stageActionEvidenceCaptureInitialValidationSummaryByKey = actionFieldByKey("actionEvidenceCaptureInitialValidationSummary");
440
+ const stageHumanLines = stages.map((stage) => formatBundleHandoffOperatorRunbookStageLine(
441
+ stage,
442
+ stageActionEvidenceCaptureInitialValidationChecklistSummaryByKey[stage.key],
443
+ ));
444
+ const stageHumanLineByKey = byKey(stages, (_stage, index) => stageHumanLines[index]);
445
+ const stageHumanLineDisplayRows = stages.map((stage, index) => {
446
+ const actionRow = stageActionRows[index];
447
+ const evidenceProgress = actionRow.actionEvidenceCaptureInitialValidationChecklistSummary;
448
+ const displayRowIdentity = {
449
+ step: stage.step,
450
+ key: stage.key,
451
+ label: stage.label,
452
+ line: stageHumanLines[index],
453
+ };
454
+ const displayRowExecutionContext = {
455
+ required: stage.required,
456
+ manual: isManualStage(stage),
457
+ commandCount: stage.commandCount,
458
+ };
459
+ const displayRowActionStatus = {
460
+ actionType: actionRow.actionType,
461
+ actionLabel: actionRow.actionLabel,
462
+ actionStatus: actionRow.actionStatus,
463
+ actionStatusLabel: actionRow.actionStatusLabel,
464
+ actionStatusTone: actionRow.actionStatusTone,
465
+ };
466
+ const displayRowEvidenceProgress = {
467
+ hasEvidenceProgress: evidenceProgress.itemCount > 0,
468
+ evidenceProgressStatus: evidenceProgress.status || "",
469
+ evidenceProgressStatusLabel: evidenceProgress.statusLabel || "",
470
+ evidenceProgressStatusTone: evidenceProgress.statusTone || "",
471
+ evidenceProgressIconName: evidenceProgress.iconName || "",
472
+ evidenceProgressLabel: evidenceProgress.progressLabel || "",
473
+ evidenceCompletionPercent: evidenceProgress.completionPercent ?? 0,
474
+ firstUncheckedEvidenceItemLabel: evidenceProgress.firstUncheckedItemLabel || "",
475
+ };
476
+ return {
477
+ ...displayRowIdentity,
478
+ ...displayRowExecutionContext,
479
+ ...displayRowActionStatus,
480
+ ...displayRowEvidenceProgress,
481
+ };
482
+ });
483
+ const stageHumanLineDisplayRowByKey = byKey(stageHumanLineDisplayRows, (row) => row);
484
+ const countBy = (predicate) => stages.filter(predicate).length;
485
+ const stageKeysBy = (predicate) => stages.filter(predicate).map((stage) => stage.key);
486
+ const countActions = (predicate) => stageActionRows.filter(predicate).length;
487
+ const firstActionKey = (predicate) => stageActionRows.find(predicate)?.key || "";
488
+ const displayRowKeysBy = (predicate) => stageHumanLineDisplayRows.filter(predicate).map((row) => row.key);
489
+ const countDisplayRows = (predicate) => stageHumanLineDisplayRows.filter(predicate).length;
490
+ const firstDisplayRowKey = (predicate) => stageHumanLineDisplayRows.find(predicate)?.key || "";
491
+ const isRequiredDisplayRow = (row) => row.required;
492
+ const isOptionalDisplayRow = (row) => !row.required;
493
+ const hasCommandDisplayRow = (row) => row.commandCount > 0;
494
+ const isManualDisplayRow = (row) => row.manual;
495
+ const hasReadyActionStatus = (row) => row.actionStatus === "ready";
496
+ const hasOptionalActionStatus = (row) => row.actionStatus === "optional";
497
+ const hasManualActionStatus = (row) => row.actionStatus === "manual";
498
+ const hasBlockedActionStatus = (row) => row.actionStatus === "blocked";
499
+ const hasDisplayRowEvidenceProgress = (row) => row.hasEvidenceProgress;
500
+ const hasBlockedDisplayRowEvidenceProgress = (row) => row.evidenceProgressStatus === "blocked";
501
+ const hasReadyDisplayRowEvidenceProgress = (row) => row.evidenceProgressStatus === "ready";
502
+ const hasEvidenceProgress = (stage) => (
503
+ stage.actionEvidenceCaptureInitialValidationChecklistSummary.itemCount > 0
504
+ );
505
+ const hasBlockedEvidenceProgress = (stage) => (
506
+ stage.actionEvidenceCaptureInitialValidationChecklistSummary.status === "blocked"
507
+ );
508
+ const hasReadyEvidenceProgress = (stage) => (
509
+ stage.actionEvidenceCaptureInitialValidationChecklistSummary.status === "ready"
510
+ );
511
+ const stageHumanLineDisplayRowKeysByActionStatus = {
512
+ ready: displayRowKeysBy(hasReadyActionStatus),
513
+ optional: displayRowKeysBy(hasOptionalActionStatus),
514
+ manual: displayRowKeysBy(hasManualActionStatus),
515
+ blocked: displayRowKeysBy(hasBlockedActionStatus),
516
+ };
517
+ const stageHumanLineDisplayRowKeysByEvidenceProgressStatus = {
518
+ blocked: displayRowKeysBy(hasBlockedDisplayRowEvidenceProgress),
519
+ ready: displayRowKeysBy(hasReadyDisplayRowEvidenceProgress),
520
+ };
521
+ const stageHumanLineDisplayRowCountSummary = {
522
+ count: stageHumanLineDisplayRows.length,
523
+ byKeyCount: Object.keys(stageHumanLineDisplayRowByKey).length,
524
+ requiredCount: countDisplayRows(isRequiredDisplayRow),
525
+ optionalCount: countDisplayRows(isOptionalDisplayRow),
526
+ commandCount: countDisplayRows(hasCommandDisplayRow),
527
+ manualCount: countDisplayRows(isManualDisplayRow),
528
+ };
529
+ const stageHumanLineDisplayRowActionStatusSummary = {
530
+ readyActionStatusCount: countDisplayRows(hasReadyActionStatus),
531
+ optionalActionStatusCount: countDisplayRows(hasOptionalActionStatus),
532
+ manualActionStatusCount: countDisplayRows(hasManualActionStatus),
533
+ blockedActionStatusCount: countDisplayRows(hasBlockedActionStatus),
534
+ };
535
+ const stageHumanLineDisplayRowEvidenceProgressSummary = {
536
+ evidenceProgressCount: countDisplayRows(hasDisplayRowEvidenceProgress),
537
+ blockedEvidenceProgressCount: countDisplayRows(hasBlockedDisplayRowEvidenceProgress),
538
+ readyEvidenceProgressCount: countDisplayRows(hasReadyDisplayRowEvidenceProgress),
539
+ };
540
+ const stageHumanLineDisplayRowFirstKeySummary = {
541
+ firstRowKey: stageHumanLineDisplayRows[0]?.key || "",
542
+ firstReadyActionRowKey: firstDisplayRowKey(hasReadyActionStatus),
543
+ firstOptionalActionRowKey: firstDisplayRowKey(hasOptionalActionStatus),
544
+ firstManualActionRowKey: firstDisplayRowKey(hasManualActionStatus),
545
+ firstBlockedEvidenceProgressRowKey: firstDisplayRowKey(hasBlockedDisplayRowEvidenceProgress),
546
+ firstReadyEvidenceProgressRowKey: firstDisplayRowKey(hasReadyDisplayRowEvidenceProgress),
547
+ };
548
+ const stageHumanLineDisplayRowSummary = {
549
+ ...stageHumanLineDisplayRowCountSummary,
550
+ ...stageHumanLineDisplayRowActionStatusSummary,
551
+ ...stageHumanLineDisplayRowEvidenceProgressSummary,
552
+ ...stageHumanLineDisplayRowFirstKeySummary,
553
+ };
554
+ const stageHumanLineCountSummary = {
555
+ count: stageHumanLines.length,
556
+ byKeyCount: Object.keys(stageHumanLineByKey).length,
557
+ requiredCount: countBy(isRequiredStage),
558
+ optionalCount: countBy(isOptionalStage),
559
+ commandCount: countBy(hasCommands),
560
+ manualCount: countBy(isManualStage),
561
+ };
562
+ const stageHumanLineEvidenceProgressSummary = {
563
+ evidenceProgressCount: countActions(hasEvidenceProgress),
564
+ blockedEvidenceProgressCount: countActions(hasBlockedEvidenceProgress),
565
+ readyEvidenceProgressCount: countActions(hasReadyEvidenceProgress),
566
+ };
567
+ const stageHumanLineFirstValueSummary = {
568
+ firstStageKey: stages[0]?.key || "",
569
+ firstLine: stageHumanLines[0] || "",
570
+ firstEvidenceProgressStageKey: firstActionKey(hasEvidenceProgress),
571
+ firstBlockedEvidenceProgressStageKey: firstActionKey(hasBlockedEvidenceProgress),
572
+ };
573
+ const stageHumanLineSummary = {
574
+ ...stageHumanLineCountSummary,
575
+ ...stageHumanLineEvidenceProgressSummary,
576
+ ...stageHumanLineFirstValueSummary,
577
+ };
578
+ const stageActionEvidenceCaptureFieldInputTypesByKey = actionFieldByKey("actionEvidenceCaptureFieldInputTypes");
579
+ const stageActionEvidenceCaptureFieldValueShapesByKey = actionFieldByKey("actionEvidenceCaptureFieldValueShapes");
580
+ const stageActionEvidenceCaptureFieldAcceptsMultipleByKey = actionFieldByKey("actionEvidenceCaptureFieldAcceptsMultiple");
581
+ const stageActionEvidenceCaptureFieldDefaultValuesByKey = actionFieldByKey("actionEvidenceCaptureFieldDefaultValues");
582
+ const stageActionEvidenceCaptureFieldEmptyValuesByKey = actionFieldByKey("actionEvidenceCaptureFieldEmptyValues");
583
+ const stageActionEvidenceCaptureFieldValidationRulesByKey = actionFieldByKey("actionEvidenceCaptureFieldValidationRules");
584
+ const stageActionEvidenceCaptureFieldMinLengthsByKey = actionFieldByKey("actionEvidenceCaptureFieldMinLengths");
585
+ const stageActionEvidenceCaptureFieldExamplesByKey = actionFieldByKey("actionEvidenceCaptureFieldExamples");
586
+ const stageActionEvidenceCaptureFieldValidationHintsByKey = actionFieldByKey("actionEvidenceCaptureFieldValidationHints");
587
+ const stageActionRequiredEvidenceCaptureFieldKeysByKey = actionFieldByKey("actionRequiredEvidenceCaptureFieldKeys");
588
+ const stageActionOptionalEvidenceCaptureFieldKeysByKey = actionFieldByKey("actionOptionalEvidenceCaptureFieldKeys");
589
+ const stageActionEvidenceCaptureFieldCountByKey = actionFieldByKey("actionEvidenceCaptureFieldCount");
590
+ const stageActionRequiredEvidenceCaptureFieldCountByKey = actionFieldByKey("actionRequiredEvidenceCaptureFieldCount");
591
+ const stageActionOptionalEvidenceCaptureFieldCountByKey = actionFieldByKey("actionOptionalEvidenceCaptureFieldCount");
592
+ const stageActionHasEvidenceCaptureFieldsByKey = actionFieldByKey("actionHasEvidenceCaptureFields");
593
+ const stageKindByKey = stageFieldByKey("kind");
594
+ const stageRequiredByKey = stageFieldByKey("required");
595
+ const stageRunPolicyByKey = stageFieldByKey("runPolicy");
596
+ const stageSafetyLevelByKey = stageFieldByKey("safetyLevel");
597
+ const stageCommandCountByKey = stageFieldByKey("commandCount");
598
+ const stageCommandKeysByKey = stageFieldByKey("commandKeys");
599
+ const stageCommandLabelsByKey = commandListByKey((command) => command.label);
600
+ const stageCommandStringsByKey = commandListByKey((command) => command.command);
601
+ const stageCommandArgsByKey = commandListByKey((command) => command.commandArgs);
602
+ const stageCommandRunPoliciesByKey = commandListByKey((command) => command.runPolicy);
603
+ const stageCommandSafetyLevelsByKey = commandListByKey((command) => command.safety?.safetyLevel || "");
604
+ const stageOutputFilesByKey = stageFieldByKey("outputFiles");
605
+ const stageHasCommandsByKey = byKey(stages, hasCommands);
606
+ const stageManualByKey = byKey(stages, isManualStage);
607
+ const stageWritesLocalFileByKey = stageFieldByKey("writesLocalFile");
608
+ const stageExternalCallsByKey = stageFieldByKey("externalCalls");
609
+ const stageTargetRepoMutationByKey = stageFieldByKey("targetRepoMutation");
610
+ const commandStageKeys = stageKeysBy(hasCommands);
611
+ const manualStageKeys = stageKeysBy(isManualStage);
612
+ const nextStageKey = "verifySourceBundle";
613
+ const nextCommandKey = "source.bundleCheck.strict";
614
+ const nextStage = stageByKey[nextStageKey] || null;
615
+ const nextStageActionRow = stageActionRows.find((stage) => stage.key === nextStageKey) || null;
616
+ const nextCommandEntry = commandByKey.get(nextCommandKey) || null;
617
+ const nextActionField = (field, fallback = "") => nextStageActionRow?.[field] || fallback;
618
+ const nextActionListField = (field) => nextActionField(field, []);
619
+ const nextActionObjectField = (field) => nextActionField(field, {});
620
+ const nextActionNumberField = (field) => nextActionField(field, 0);
621
+ const nextActionBooleanField = (field) => nextStageActionRow?.[field] === true;
622
+ const nextStageField = (field, fallback = "") => nextStage?.[field] || fallback;
623
+ const nextStageListField = (field) => nextStageField(field, []);
624
+ const nextStageBooleanField = (field) => nextStage?.[field] === true;
625
+ const nextStageCommandValues = (getValue) => nextStage?.commands?.map(getValue) || [];
626
+ const nextActionEvidenceProgressSummary = nextActionObjectField("actionEvidenceCaptureInitialValidationChecklistSummary");
627
+ const nextStageHumanLine = nextStage ? stageHumanLineByKey[nextStage.key] || "" : "";
628
+ const nextStageHumanLineDisplayRow = nextStage ? stageHumanLineDisplayRowByKey[nextStage.key] || {} : {};
629
+ const nextStageCommandCount = nextStageField("commandCount", 0);
630
+ const nextCommandField = (field, fallback = "") => nextCommandEntry?.[field] || fallback;
631
+ const nextCommandListField = (field) => nextCommandField(field, []);
632
+ const nextCommandSafety = nextCommandEntry?.safety || null;
633
+ const nextStageHumanLineSummary = nextStage ? {
634
+ stageKey: nextStage.key,
635
+ line: nextStageHumanLine,
636
+ hasEvidenceProgress: (nextActionEvidenceProgressSummary.itemCount || 0) > 0,
637
+ evidenceProgressStatus: nextActionEvidenceProgressSummary.status || "",
638
+ evidenceProgressLabel: nextActionEvidenceProgressSummary.progressLabel || "",
639
+ firstUncheckedEvidenceItemLabel: nextActionEvidenceProgressSummary.firstUncheckedItemLabel || "",
640
+ } : {};
641
+ const nextStageIdentity = {
642
+ nextStageLabel: nextStageField("label"),
643
+ nextStageSummary: nextStageField("reason"),
644
+ nextStageHumanLine,
645
+ nextStageHumanLineDisplayRow,
646
+ nextStageHumanLineSummary,
647
+ };
648
+ const nextStageActionStatus = {
649
+ nextStageActionType: nextActionField("actionType"),
650
+ nextStageActionLabel: nextActionField("actionLabel"),
651
+ nextStageActionInstruction: nextActionField("actionInstruction"),
652
+ nextStageActionButtonLabel: nextActionField("actionButtonLabel"),
653
+ nextStageActionAffordance: nextActionField("actionAffordance"),
654
+ nextStageActionEnabled: nextActionBooleanField("actionEnabled"),
655
+ nextStageActionStatus: nextActionField("actionStatus"),
656
+ nextStageActionStatusLabel: nextActionField("actionStatusLabel"),
657
+ nextStageActionStatusTone: nextActionField("actionStatusTone"),
658
+ nextStageActionDisabledReasonCode: nextActionField("actionDisabledReasonCode"),
659
+ nextStageActionDisabledReason: nextActionField("actionDisabledReason"),
660
+ };
661
+ const nextStageActionDependencies = {
662
+ nextStageActionPrerequisiteKeys: nextActionListField("actionPrerequisiteKeys"),
663
+ nextStageActionPrerequisiteLabels: nextActionListField("actionPrerequisiteLabels"),
664
+ nextStageActionPrerequisiteCount: nextActionNumberField("actionPrerequisiteCount"),
665
+ nextStageActionHasPrerequisites: nextActionBooleanField("actionHasPrerequisites"),
666
+ nextStageActionDependencyReasonCode: nextActionField("actionDependencyReasonCode"),
667
+ nextStageActionDependencyReason: nextActionField("actionDependencyReason"),
668
+ nextStageActionBlockedStageKeys: nextActionListField("actionBlockedStageKeys"),
669
+ nextStageActionBlockedStageLabels: nextActionListField("actionBlockedStageLabels"),
670
+ nextStageActionBlockedStageCount: nextActionNumberField("actionBlockedStageCount"),
671
+ nextStageActionBlocksStages: nextActionBooleanField("actionBlocksStages"),
672
+ nextStageActionCompletionCriteria: nextActionListField("actionCompletionCriteria"),
673
+ nextStageActionCompletionCriteriaCount: nextActionNumberField("actionCompletionCriteriaCount"),
674
+ nextStageActionHasCompletionCriteria: nextActionBooleanField("actionHasCompletionCriteria"),
675
+ };
676
+ const nextStageActionEvidence = {
677
+ nextStageActionEvidenceRequirements: nextActionListField("actionEvidenceRequirements"),
678
+ nextStageActionEvidenceRequirementCount: nextActionNumberField("actionEvidenceRequirementCount"),
679
+ nextStageActionRequiresEvidence: nextActionBooleanField("actionRequiresEvidence"),
680
+ nextStageActionEvidenceTarget: nextActionField("actionEvidenceTarget"),
681
+ nextStageActionEvidenceTargetLabel: nextActionField("actionEvidenceTargetLabel"),
682
+ };
683
+ const nextStageEvidenceCaptureFieldMetadata = {
684
+ nextStageActionEvidenceCaptureFields: nextActionListField("actionEvidenceCaptureFields"),
685
+ nextStageActionEvidenceCaptureFieldKeys: nextActionListField("actionEvidenceCaptureFieldKeys"),
686
+ nextStageActionEvidenceCaptureFieldLabels: nextActionListField("actionEvidenceCaptureFieldLabels"),
687
+ nextStageActionEvidenceCaptureFieldPlaceholders: nextActionListField("actionEvidenceCaptureFieldPlaceholders"),
688
+ nextStageActionEvidenceCaptureFieldRequirementLabels: nextActionListField("actionEvidenceCaptureFieldRequirementLabels"),
689
+ nextStageActionEvidenceCaptureFieldAriaLabels: nextActionListField("actionEvidenceCaptureFieldAriaLabels"),
690
+ nextStageActionEvidenceCaptureFieldHelpTexts: nextActionListField("actionEvidenceCaptureFieldHelpTexts"),
691
+ nextStageActionEvidenceCaptureFieldSectionKeys: nextActionListField("actionEvidenceCaptureFieldSectionKeys"),
692
+ nextStageActionEvidenceCaptureFieldSectionLabels: nextActionListField("actionEvidenceCaptureFieldSectionLabels"),
693
+ nextStageActionEvidenceCaptureSectionKeys: nextActionListField("actionEvidenceCaptureSectionKeys"),
694
+ nextStageActionEvidenceCaptureSectionLabels: nextActionListField("actionEvidenceCaptureSectionLabels"),
695
+ nextStageActionEvidenceCaptureSectionCount: nextActionNumberField("actionEvidenceCaptureSectionCount"),
696
+ };
697
+ const nextStageEvidenceCapturePayload = {
698
+ nextStageActionEvidenceCaptureFieldPayloadNamespaces: nextActionListField("actionEvidenceCaptureFieldPayloadNamespaces"),
699
+ nextStageActionEvidenceCaptureFieldPayloadPaths: nextActionListField("actionEvidenceCaptureFieldPayloadPaths"),
700
+ nextStageActionEvidenceCapturePayloadNamespaces: nextActionListField("actionEvidenceCapturePayloadNamespaces"),
701
+ nextStageActionEvidenceCapturePayloadNamespaceCount: nextActionNumberField("actionEvidenceCapturePayloadNamespaceCount"),
702
+ nextStageActionEvidenceCapturePayloadTemplate: nextActionObjectField("actionEvidenceCapturePayloadTemplate"),
703
+ nextStageActionEvidenceCapturePayloadFlatTemplate: nextActionObjectField("actionEvidenceCapturePayloadFlatTemplate"),
704
+ nextStageActionEvidenceCapturePayloadBindings: nextActionListField("actionEvidenceCapturePayloadBindings"),
705
+ };
706
+ const nextStageEvidenceCaptureValidation = {
707
+ nextStageActionEvidenceCaptureValidationSpecs: nextActionListField("actionEvidenceCaptureValidationSpecs"),
708
+ nextStageActionEvidenceCaptureInitialValidationStates: nextActionListField("actionEvidenceCaptureInitialValidationStates"),
709
+ nextStageActionEvidenceCaptureInitialValidationDisplayMetadata: nextActionListField("actionEvidenceCaptureInitialValidationDisplayMetadata"),
710
+ nextStageActionEvidenceCaptureInitialValidationChecklist: nextActionListField("actionEvidenceCaptureInitialValidationChecklist"),
711
+ nextStageActionEvidenceCaptureInitialValidationChecklistSummary: nextActionObjectField("actionEvidenceCaptureInitialValidationChecklistSummary"),
712
+ nextStageActionEvidenceCaptureInitialValidationSummary: nextActionObjectField("actionEvidenceCaptureInitialValidationSummary"),
713
+ };
714
+ const nextStageEvidenceCaptureFieldRules = {
715
+ nextStageActionEvidenceCaptureFieldInputTypes: nextActionListField("actionEvidenceCaptureFieldInputTypes"),
716
+ nextStageActionEvidenceCaptureFieldValueShapes: nextActionListField("actionEvidenceCaptureFieldValueShapes"),
717
+ nextStageActionEvidenceCaptureFieldAcceptsMultiple: nextActionListField("actionEvidenceCaptureFieldAcceptsMultiple"),
718
+ nextStageActionEvidenceCaptureFieldDefaultValues: nextActionListField("actionEvidenceCaptureFieldDefaultValues"),
719
+ nextStageActionEvidenceCaptureFieldEmptyValues: nextActionListField("actionEvidenceCaptureFieldEmptyValues"),
720
+ nextStageActionEvidenceCaptureFieldValidationRules: nextActionListField("actionEvidenceCaptureFieldValidationRules"),
721
+ nextStageActionEvidenceCaptureFieldMinLengths: nextActionListField("actionEvidenceCaptureFieldMinLengths"),
722
+ nextStageActionEvidenceCaptureFieldExamples: nextActionListField("actionEvidenceCaptureFieldExamples"),
723
+ nextStageActionEvidenceCaptureFieldValidationHints: nextActionListField("actionEvidenceCaptureFieldValidationHints"),
724
+ nextStageActionRequiredEvidenceCaptureFieldKeys: nextActionListField("actionRequiredEvidenceCaptureFieldKeys"),
725
+ nextStageActionOptionalEvidenceCaptureFieldKeys: nextActionListField("actionOptionalEvidenceCaptureFieldKeys"),
726
+ };
727
+ const nextStageEvidenceCaptureFieldCounts = {
728
+ nextStageActionEvidenceCaptureFieldCount: nextActionNumberField("actionEvidenceCaptureFieldCount"),
729
+ nextStageActionRequiredEvidenceCaptureFieldCount: nextActionNumberField("actionRequiredEvidenceCaptureFieldCount"),
730
+ nextStageActionOptionalEvidenceCaptureFieldCount: nextActionNumberField("actionOptionalEvidenceCaptureFieldCount"),
731
+ nextStageActionHasEvidenceCaptureFields: nextActionBooleanField("actionHasEvidenceCaptureFields"),
732
+ };
733
+ const nextStageEvidenceCapture = {
734
+ ...nextStageEvidenceCaptureFieldMetadata,
735
+ ...nextStageEvidenceCapturePayload,
736
+ ...nextStageEvidenceCaptureValidation,
737
+ ...nextStageEvidenceCaptureFieldRules,
738
+ ...nextStageEvidenceCaptureFieldCounts,
739
+ };
740
+ const nextStageClassification = {
741
+ nextStageKind: nextStageField("kind"),
742
+ nextStageRequired: nextStage?.required === true,
743
+ nextStageRunPolicy: nextStageField("runPolicy"),
744
+ nextStageSafetyLevel: nextStageField("safetyLevel"),
745
+ };
746
+ const nextStageCommandMetadata = {
747
+ nextStageCommandCount,
748
+ nextStageCommandLabels: nextStageCommandValues((command) => command.label),
749
+ nextStageCommands: nextStageCommandValues((command) => command.command),
750
+ nextStageCommandArgsList: nextStageCommandValues((command) => command.commandArgs),
751
+ nextStageCommandRunPolicies: nextStageCommandValues((command) => command.runPolicy),
752
+ nextStageCommandSafetyLevels: nextStageCommandValues((command) => command.safety?.safetyLevel || ""),
753
+ };
754
+ const nextStageExecutionContext = {
755
+ nextStageOutputFiles: nextStageListField("outputFiles"),
756
+ nextStageHasCommands: nextStageCommandCount > 0,
757
+ nextStageManual: nextStageCommandCount === 0,
758
+ nextStageWritesLocalFile: nextStageBooleanField("writesLocalFile"),
759
+ nextStageExternalCalls: nextStageBooleanField("externalCalls"),
760
+ nextStageTargetRepoMutation: nextStageBooleanField("targetRepoMutation"),
761
+ nextStageCommandKeys: nextStageListField("commandKeys"),
762
+ };
763
+ const nextStageCommandSummary = {
764
+ ...nextStageClassification,
765
+ ...nextStageCommandMetadata,
766
+ ...nextStageExecutionContext,
767
+ };
768
+ const nextCommandSummary = {
769
+ nextCommand: nextCommandField("command"),
770
+ nextCommandArgs: nextCommandListField("commandArgs"),
771
+ nextCommandRunPolicy: nextCommandField("runPolicy"),
772
+ nextCommandSafetyLevel: nextCommandSafety?.safetyLevel || "",
773
+ nextCommandSafety,
774
+ nextCommandEntry,
775
+ };
776
+ const nextActionCoreSummary = {
777
+ nextActionKey: nextStageKey,
778
+ nextActionType: nextActionField("actionType"),
779
+ nextActionLabel: nextActionField("actionLabel"),
780
+ nextActionEnabled: nextActionBooleanField("actionEnabled"),
781
+ nextActionStatus: nextActionField("actionStatus"),
782
+ nextActionStatusLabel: nextActionField("actionStatusLabel"),
783
+ nextActionStatusTone: nextActionField("actionStatusTone"),
784
+ nextActionDisabledReasonCode: nextActionField("actionDisabledReasonCode"),
785
+ nextActionPrerequisiteKeys: nextActionListField("actionPrerequisiteKeys"),
786
+ nextActionPrerequisiteLabels: nextActionListField("actionPrerequisiteLabels"),
787
+ nextActionPrerequisiteCount: nextActionNumberField("actionPrerequisiteCount"),
788
+ nextActionHasPrerequisites: nextActionBooleanField("actionHasPrerequisites"),
789
+ nextActionDependencyReasonCode: nextActionField("actionDependencyReasonCode"),
790
+ nextActionDependencyReason: nextActionField("actionDependencyReason"),
791
+ nextActionBlockedStageKeys: nextActionListField("actionBlockedStageKeys"),
792
+ nextActionBlockedStageLabels: nextActionListField("actionBlockedStageLabels"),
793
+ nextActionBlockedStageCount: nextActionNumberField("actionBlockedStageCount"),
794
+ nextActionBlocksStages: nextActionBooleanField("actionBlocksStages"),
795
+ nextActionCompletionCriteria: nextActionListField("actionCompletionCriteria"),
796
+ nextActionCompletionCriteriaCount: nextActionNumberField("actionCompletionCriteriaCount"),
797
+ nextActionHasCompletionCriteria: nextActionBooleanField("actionHasCompletionCriteria"),
798
+ nextActionEvidenceRequirements: nextActionListField("actionEvidenceRequirements"),
799
+ nextActionEvidenceRequirementCount: nextActionNumberField("actionEvidenceRequirementCount"),
800
+ nextActionRequiresEvidence: nextActionBooleanField("actionRequiresEvidence"),
801
+ nextActionEvidenceTarget: nextActionField("actionEvidenceTarget"),
802
+ nextActionEvidenceTargetLabel: nextActionField("actionEvidenceTargetLabel"),
803
+ };
804
+ const nextActionEvidenceCaptureFieldMetadata = {
805
+ nextActionEvidenceCaptureFields: nextActionListField("actionEvidenceCaptureFields"),
806
+ nextActionEvidenceCaptureFieldKeys: nextActionListField("actionEvidenceCaptureFieldKeys"),
807
+ nextActionEvidenceCaptureFieldLabels: nextActionListField("actionEvidenceCaptureFieldLabels"),
808
+ nextActionEvidenceCaptureFieldPlaceholders: nextActionListField("actionEvidenceCaptureFieldPlaceholders"),
809
+ nextActionEvidenceCaptureFieldRequirementLabels: nextActionListField("actionEvidenceCaptureFieldRequirementLabels"),
810
+ nextActionEvidenceCaptureFieldAriaLabels: nextActionListField("actionEvidenceCaptureFieldAriaLabels"),
811
+ nextActionEvidenceCaptureFieldHelpTexts: nextActionListField("actionEvidenceCaptureFieldHelpTexts"),
812
+ nextActionEvidenceCaptureFieldSectionKeys: nextActionListField("actionEvidenceCaptureFieldSectionKeys"),
813
+ nextActionEvidenceCaptureFieldSectionLabels: nextActionListField("actionEvidenceCaptureFieldSectionLabels"),
814
+ nextActionEvidenceCaptureSectionKeys: nextActionListField("actionEvidenceCaptureSectionKeys"),
815
+ nextActionEvidenceCaptureSectionLabels: nextActionListField("actionEvidenceCaptureSectionLabels"),
816
+ nextActionEvidenceCaptureSectionCount: nextActionNumberField("actionEvidenceCaptureSectionCount"),
817
+ };
818
+ const nextActionEvidenceCapturePayload = {
819
+ nextActionEvidenceCaptureFieldPayloadNamespaces: nextActionListField("actionEvidenceCaptureFieldPayloadNamespaces"),
820
+ nextActionEvidenceCaptureFieldPayloadPaths: nextActionListField("actionEvidenceCaptureFieldPayloadPaths"),
821
+ nextActionEvidenceCapturePayloadNamespaces: nextActionListField("actionEvidenceCapturePayloadNamespaces"),
822
+ nextActionEvidenceCapturePayloadNamespaceCount: nextActionNumberField("actionEvidenceCapturePayloadNamespaceCount"),
823
+ nextActionEvidenceCapturePayloadTemplate: nextActionObjectField("actionEvidenceCapturePayloadTemplate"),
824
+ nextActionEvidenceCapturePayloadFlatTemplate: nextActionObjectField("actionEvidenceCapturePayloadFlatTemplate"),
825
+ nextActionEvidenceCapturePayloadBindings: nextActionListField("actionEvidenceCapturePayloadBindings"),
826
+ };
827
+ const nextActionEvidenceCaptureValidation = {
828
+ nextActionEvidenceCaptureValidationSpecs: nextActionListField("actionEvidenceCaptureValidationSpecs"),
829
+ nextActionEvidenceCaptureInitialValidationStates: nextActionListField("actionEvidenceCaptureInitialValidationStates"),
830
+ nextActionEvidenceCaptureInitialValidationDisplayMetadata: nextActionListField("actionEvidenceCaptureInitialValidationDisplayMetadata"),
831
+ nextActionEvidenceCaptureInitialValidationChecklist: nextActionListField("actionEvidenceCaptureInitialValidationChecklist"),
832
+ nextActionEvidenceCaptureInitialValidationChecklistSummary: nextActionObjectField("actionEvidenceCaptureInitialValidationChecklistSummary"),
833
+ nextActionEvidenceCaptureInitialValidationSummary: nextActionObjectField("actionEvidenceCaptureInitialValidationSummary"),
834
+ };
835
+ const nextActionEvidenceCaptureFieldRules = {
836
+ nextActionEvidenceCaptureFieldInputTypes: nextActionListField("actionEvidenceCaptureFieldInputTypes"),
837
+ nextActionEvidenceCaptureFieldValueShapes: nextActionListField("actionEvidenceCaptureFieldValueShapes"),
838
+ nextActionEvidenceCaptureFieldAcceptsMultiple: nextActionListField("actionEvidenceCaptureFieldAcceptsMultiple"),
839
+ nextActionEvidenceCaptureFieldDefaultValues: nextActionListField("actionEvidenceCaptureFieldDefaultValues"),
840
+ nextActionEvidenceCaptureFieldEmptyValues: nextActionListField("actionEvidenceCaptureFieldEmptyValues"),
841
+ nextActionEvidenceCaptureFieldValidationRules: nextActionListField("actionEvidenceCaptureFieldValidationRules"),
842
+ nextActionEvidenceCaptureFieldMinLengths: nextActionListField("actionEvidenceCaptureFieldMinLengths"),
843
+ nextActionEvidenceCaptureFieldExamples: nextActionListField("actionEvidenceCaptureFieldExamples"),
844
+ nextActionEvidenceCaptureFieldValidationHints: nextActionListField("actionEvidenceCaptureFieldValidationHints"),
845
+ nextActionRequiredEvidenceCaptureFieldKeys: nextActionListField("actionRequiredEvidenceCaptureFieldKeys"),
846
+ nextActionOptionalEvidenceCaptureFieldKeys: nextActionListField("actionOptionalEvidenceCaptureFieldKeys"),
847
+ };
848
+ const nextActionEvidenceCaptureFieldCounts = {
849
+ nextActionEvidenceCaptureFieldCount: nextActionNumberField("actionEvidenceCaptureFieldCount"),
850
+ nextActionRequiredEvidenceCaptureFieldCount: nextActionNumberField("actionRequiredEvidenceCaptureFieldCount"),
851
+ nextActionOptionalEvidenceCaptureFieldCount: nextActionNumberField("actionOptionalEvidenceCaptureFieldCount"),
852
+ nextActionHasEvidenceCaptureFields: nextActionBooleanField("actionHasEvidenceCaptureFields"),
853
+ };
854
+ const nextActionRunContext = {
855
+ nextActionRunPolicy: nextStageField("runPolicy"),
856
+ nextActionSafetyLevel: nextStageField("safetyLevel"),
857
+ };
858
+ const nextActionSummary = {
859
+ ...nextActionCoreSummary,
860
+ ...nextActionEvidenceCaptureFieldMetadata,
861
+ ...nextActionEvidenceCapturePayload,
862
+ ...nextActionEvidenceCaptureValidation,
863
+ ...nextActionEvidenceCaptureFieldRules,
864
+ ...nextActionEvidenceCaptureFieldCounts,
865
+ ...nextActionRunContext,
866
+ };
867
+ const sumActions = (getValue) => stageActionRows.reduce((sum, stage) => sum + getValue(stage), 0);
868
+ const maxActionValue = (getValue) => Math.max(0, ...stageActionRows.map(getValue));
869
+ const countActionsWithItems = (field) => countActions((stage) => stage[field].length > 0);
870
+ const sumActionItems = (field) => sumActions((stage) => stage[field].length);
871
+ const sumActionItemValues = (field, getValue) => sumActions(
872
+ (stage) => stage[field].reduce((sum, item) => sum + getValue(item), 0),
873
+ );
874
+ const countActionItems = (field, predicate) => sumActions(
875
+ (stage) => stage[field].filter(predicate).length,
876
+ );
877
+ const countEvidenceCaptureFields = (predicate) => countActionItems("actionEvidenceCaptureFields", predicate);
878
+ const countPayloadBindings = (predicate) => countActionItems("actionEvidenceCapturePayloadBindings", predicate);
879
+ const countValidationSpecs = (predicate) => countActionItems("actionEvidenceCaptureValidationSpecs", predicate);
880
+ const countInitialValidationStates = (predicate) => countActionItems("actionEvidenceCaptureInitialValidationStates", predicate);
881
+ const countInitialDisplayRows = (predicate) => countActionItems("actionEvidenceCaptureInitialValidationDisplayMetadata", predicate);
882
+ const countInitialChecklistItems = (predicate) => countActionItems("actionEvidenceCaptureInitialValidationChecklist", predicate);
883
+ const countActionsBySummary = (field, predicate) => countActions((stage) => predicate(stage[field]));
884
+ const sumSummaryValues = (field, getValue) => sumActions((stage) => getValue(stage[field]));
885
+ const countInitialValidationSummaries = (predicate) => (
886
+ countActionsBySummary("actionEvidenceCaptureInitialValidationSummary", predicate)
887
+ );
888
+ const sumInitialValidationSummaryValues = (getValue) => (
889
+ sumSummaryValues("actionEvidenceCaptureInitialValidationSummary", getValue)
890
+ );
891
+ const countInitialChecklistSummaries = (predicate) => (
892
+ countActionsBySummary("actionEvidenceCaptureInitialValidationChecklistSummary", predicate)
893
+ );
894
+ const sumInitialChecklistSummaryValues = (getValue) => (
895
+ sumSummaryValues("actionEvidenceCaptureInitialValidationChecklistSummary", getValue)
896
+ );
897
+ const uniqueActionListValueCount = (field) => uniqueValues(stageActionRows.flatMap((stage) => stage[field])).length;
898
+ const payloadTemplatePathCount = (stage) => Object.keys(stage.actionEvidenceCapturePayloadFlatTemplate).length;
899
+ const maxActionItemValue = (field, getValue) => Math.max(
900
+ 0,
901
+ ...stageActionRows.flatMap((stage) => stage[field].map(getValue)),
902
+ );
903
+ const maxEvidenceCaptureFieldValue = (getValue) => maxActionItemValue("actionEvidenceCaptureFields", getValue);
904
+ const firstActionWithEvidenceCaptureField = (predicate) => (
905
+ firstActionKey((stage) => stage.actionEvidenceCaptureFields.some(predicate))
906
+ );
907
+ const firstStageKey = (predicate) => stages.find(predicate)?.key || "";
908
+ const isActionEnabled = (action) => action.actionEnabled;
909
+ const isActionDisabled = (action) => !action.actionEnabled;
910
+ const isManualDisabledAction = (action) => isActionDisabled(action) && action.manual;
911
+ const hasActionPrerequisites = (action) => action.actionHasPrerequisites;
912
+ const hasActionDependencyReason = (action) => action.actionDependencyReasonCode;
913
+ const blocksOtherActions = (action) => action.actionBlocksStages;
914
+ const hasActionCompletionCriteria = (action) => action.actionHasCompletionCriteria;
915
+ const requiresActionEvidence = (action) => action.actionRequiresEvidence;
916
+ const targetsLocalCommandEvidence = (action) => action.actionEvidenceTarget === "local-command-output";
917
+ const targetsLocalOutputEvidence = (action) => action.actionEvidenceTarget === "local-output-file";
918
+ const targetsTargetRepoEvidence = (action) => action.actionEvidenceTarget === "target-repo-working-tree";
919
+ const targetsHandoffRecordEvidence = (action) => action.actionEvidenceTarget === "handoff-evidence-record";
920
+ const hasActionEvidenceCaptureFields = (action) => action.actionHasEvidenceCaptureFields;
921
+ const hasRequiredActionEvidenceCaptureFields = (action) => action.actionRequiredEvidenceCaptureFieldCount > 0;
922
+ const hasOptionalActionEvidenceCaptureFields = (action) => action.actionOptionalEvidenceCaptureFieldCount > 0;
923
+ const hasMultipleEvidenceCaptureSections = (action) => action.actionEvidenceCaptureSectionCount > 1;
924
+ const hasMultipleEvidenceCapturePayloadNamespaces = (action) => action.actionEvidenceCapturePayloadNamespaceCount > 1;
925
+ const hasEvidenceCapturePayloadTemplate = (action) => payloadTemplatePathCount(action) > 0;
926
+ const isManualAction = (action) => action.manual;
927
+ const isManualEvidenceAction = (action) => action.actionType === "manual-evidence";
928
+ const usesTextareaInput = (field) => field.inputType === "textarea";
929
+ const usesTextInput = (field) => field.inputType === "text";
930
+ const usesFilePathInput = (field) => field.inputType === "file-path";
931
+ const usesListInput = (field) => field.inputType === "list";
932
+ const capturesLongText = (field) => field.valueShape === "long-text";
933
+ const capturesShortText = (field) => field.valueShape === "short-text";
934
+ const capturesFilePathValue = (field) => field.valueShape === "file-path";
935
+ const capturesStringList = (field) => field.valueShape === "string-list";
936
+ const acceptsMultipleValues = (item) => item.acceptsMultiple;
937
+ const acceptsSingleValue = (item) => !item.acceptsMultiple;
938
+ const hasEmptyStringValue = (field) => field.emptyValue === "";
939
+ const hasEmptyListValue = (field) => Array.isArray(field.emptyValue);
940
+ const hasPlaceholder = (field) => Boolean(field.placeholder);
941
+ const hasAriaLabel = (field) => Boolean(field.ariaLabel);
942
+ const hasHelpText = (field) => Boolean(field.helpText);
943
+ const belongsToEvidenceCaptureSection = (field) => Boolean(field.sectionKey);
944
+ const mapsToPayloadPath = (field) => Boolean(field.payloadPath);
945
+ const isRequiredItem = (item) => item.required;
946
+ const isOptionalItem = (item) => !item.required;
947
+ const hasValidationRule = (item) => Boolean(item.validationRule);
948
+ const isRequiredValidatedField = (field) => isRequiredItem(field) && hasValidationRule(field);
949
+ const isOptionalValidatedField = (field) => isOptionalItem(field) && hasValidationRule(field);
950
+ const isErrorValidationSpec = (spec) => spec.severity === "error";
951
+ const isInfoValidationSpec = (spec) => spec.severity === "info";
952
+ const isValidInitialState = (state) => state.valid;
953
+ const isInvalidInitialState = (state) => !state.valid;
954
+ const isBlockingInitialState = (state) => state.blocking;
955
+ const isOptionalEmptyInitialState = (state) => state.status === "optional-empty";
956
+ const isMissingRequiredInitialState = (state) => state.status === "missing-required";
957
+ const isPristineInitialState = (state) => !state.dirty && !state.touched;
958
+ const isDangerInitialDisplayRow = (display) => display.statusTone === "danger";
959
+ const isInfoInitialDisplayRow = (display) => display.statusTone === "info";
960
+ const isBlockingInitialDisplayRow = (display) => display.blocking;
961
+ const isNonBlockingInitialDisplayRow = (display) => !display.blocking;
962
+ const isInitiallyCheckedChecklistItem = (item) => item.checkedInitially;
963
+ const isInitiallyUncheckedChecklistItem = (item) => !item.checkedInitially;
964
+ const blocksChecklistCompletion = (item) => item.completionBlocking;
965
+ const doesNotBlockChecklistCompletion = (item) => !item.completionBlocking;
966
+ const actionCountSummary = {
967
+ totalActionCount: stages.length,
968
+ commandActionCount: commandStages.length,
969
+ manualActionCount: countBy(isManualStage),
970
+ enabledActionCount: countActions(isActionEnabled),
971
+ disabledActionCount: countActions(isActionDisabled),
972
+ manualDisabledActionCount: countActions(isManualDisabledAction),
973
+ };
974
+ const actionDependencySummary = {
975
+ actionWithPrerequisiteCount: countActions(hasActionPrerequisites),
976
+ maxActionPrerequisiteCount: maxActionValue((stage) => stage.actionPrerequisiteCount),
977
+ actionWithDependencyReasonCount: countActions(hasActionDependencyReason),
978
+ actionBlockingOtherActionCount: countActions(blocksOtherActions),
979
+ maxActionBlockedStageCount: maxActionValue((stage) => stage.actionBlockedStageCount),
980
+ actionWithCompletionCriteriaCount: countActions(hasActionCompletionCriteria),
981
+ totalActionCompletionCriteriaCount: sumActions((stage) => stage.actionCompletionCriteriaCount),
982
+ maxActionCompletionCriteriaCount: maxActionValue((stage) => stage.actionCompletionCriteriaCount),
983
+ };
984
+ const actionEvidenceSummary = {
985
+ actionRequiringEvidenceCount: countActions(requiresActionEvidence),
986
+ totalActionEvidenceRequirementCount: sumActions((stage) => stage.actionEvidenceRequirementCount),
987
+ maxActionEvidenceRequirementCount: maxActionValue((stage) => stage.actionEvidenceRequirementCount),
988
+ localCommandEvidenceActionCount: countActions(targetsLocalCommandEvidence),
989
+ localOutputEvidenceActionCount: countActions(targetsLocalOutputEvidence),
990
+ targetRepoEvidenceActionCount: countActions(targetsTargetRepoEvidence),
991
+ handoffRecordEvidenceActionCount: countActions(targetsHandoffRecordEvidence),
992
+ };
993
+ const actionEvidenceCaptureFieldSummary = {
994
+ actionWithEvidenceCaptureFieldCount: countActions(hasActionEvidenceCaptureFields),
995
+ actionWithRequiredEvidenceCaptureFieldCount: countActions(hasRequiredActionEvidenceCaptureFields),
996
+ actionWithOptionalEvidenceCaptureFieldCount: countActions(hasOptionalActionEvidenceCaptureFields),
997
+ totalActionEvidenceCaptureFieldCount: sumActions((stage) => stage.actionEvidenceCaptureFieldCount),
998
+ totalRequiredActionEvidenceCaptureFieldCount: sumActions((stage) => stage.actionRequiredEvidenceCaptureFieldCount),
999
+ totalOptionalActionEvidenceCaptureFieldCount: sumActions((stage) => stage.actionOptionalEvidenceCaptureFieldCount),
1000
+ maxActionEvidenceCaptureFieldCount: maxActionValue((stage) => stage.actionEvidenceCaptureFieldCount),
1001
+ textareaEvidenceCaptureFieldCount: countEvidenceCaptureFields(usesTextareaInput),
1002
+ textEvidenceCaptureFieldCount: countEvidenceCaptureFields(usesTextInput),
1003
+ filePathEvidenceCaptureFieldCount: countEvidenceCaptureFields(usesFilePathInput),
1004
+ listEvidenceCaptureFieldCount: countEvidenceCaptureFields(usesListInput),
1005
+ longTextEvidenceCaptureFieldCount: countEvidenceCaptureFields(capturesLongText),
1006
+ shortTextEvidenceCaptureFieldCount: countEvidenceCaptureFields(capturesShortText),
1007
+ filePathValueEvidenceCaptureFieldCount: countEvidenceCaptureFields(capturesFilePathValue),
1008
+ stringListEvidenceCaptureFieldCount: countEvidenceCaptureFields(capturesStringList),
1009
+ multiValueEvidenceCaptureFieldCount: countEvidenceCaptureFields(acceptsMultipleValues),
1010
+ singleValueEvidenceCaptureFieldCount: countEvidenceCaptureFields(acceptsSingleValue),
1011
+ emptyStringEvidenceCaptureFieldCount: countEvidenceCaptureFields(hasEmptyStringValue),
1012
+ emptyListEvidenceCaptureFieldCount: countEvidenceCaptureFields(hasEmptyListValue),
1013
+ placeholderEvidenceCaptureFieldCount: countEvidenceCaptureFields(hasPlaceholder),
1014
+ ariaLabelEvidenceCaptureFieldCount: countEvidenceCaptureFields(hasAriaLabel),
1015
+ helpTextEvidenceCaptureFieldCount: countEvidenceCaptureFields(hasHelpText),
1016
+ sectionedEvidenceCaptureFieldCount: countEvidenceCaptureFields(belongsToEvidenceCaptureSection),
1017
+ uniqueEvidenceCaptureSectionCount: uniqueActionListValueCount("actionEvidenceCaptureSectionKeys"),
1018
+ actionWithMultipleEvidenceCaptureSectionCount: countActions(hasMultipleEvidenceCaptureSections),
1019
+ maxActionEvidenceCaptureSectionCount: maxActionValue((stage) => stage.actionEvidenceCaptureSectionCount),
1020
+ payloadMappedEvidenceCaptureFieldCount: countEvidenceCaptureFields(mapsToPayloadPath),
1021
+ };
1022
+ const actionEvidenceCapturePayloadSummary = {
1023
+ uniqueEvidenceCapturePayloadNamespaceCount: uniqueActionListValueCount("actionEvidenceCapturePayloadNamespaces"),
1024
+ actionWithMultipleEvidenceCapturePayloadNamespaceCount: countActions(hasMultipleEvidenceCapturePayloadNamespaces),
1025
+ maxActionEvidenceCapturePayloadNamespaceCount: maxActionValue((stage) => stage.actionEvidenceCapturePayloadNamespaceCount),
1026
+ actionWithEvidenceCapturePayloadTemplateCount: countActions(hasEvidenceCapturePayloadTemplate),
1027
+ evidenceCapturePayloadTemplatePathCount: sumActions(payloadTemplatePathCount),
1028
+ maxActionEvidenceCapturePayloadTemplatePathCount: maxActionValue(payloadTemplatePathCount),
1029
+ actionWithEvidenceCapturePayloadBindingCount: countActionsWithItems("actionEvidenceCapturePayloadBindings"),
1030
+ evidenceCapturePayloadBindingCount: sumActionItems("actionEvidenceCapturePayloadBindings"),
1031
+ requiredEvidenceCapturePayloadBindingCount: countPayloadBindings(isRequiredItem),
1032
+ optionalEvidenceCapturePayloadBindingCount: countPayloadBindings(isOptionalItem),
1033
+ multiValueEvidenceCapturePayloadBindingCount: countPayloadBindings(acceptsMultipleValues),
1034
+ };
1035
+ const actionEvidenceCaptureValidationSummary = {
1036
+ actionWithEvidenceCaptureValidationSpecCount: countActionsWithItems("actionEvidenceCaptureValidationSpecs"),
1037
+ evidenceCaptureValidationSpecCount: sumActionItems("actionEvidenceCaptureValidationSpecs"),
1038
+ requiredEvidenceCaptureValidationSpecCount: countValidationSpecs(isRequiredItem),
1039
+ optionalEvidenceCaptureValidationSpecCount: countValidationSpecs(isOptionalItem),
1040
+ errorEvidenceCaptureValidationSpecCount: countValidationSpecs(isErrorValidationSpec),
1041
+ infoEvidenceCaptureValidationSpecCount: countValidationSpecs(isInfoValidationSpec),
1042
+ multiValueEvidenceCaptureValidationSpecCount: countValidationSpecs(acceptsMultipleValues),
1043
+ };
1044
+ const actionEvidenceCaptureInitialStateSummary = {
1045
+ actionWithEvidenceCaptureInitialValidationStateCount: countActionsWithItems("actionEvidenceCaptureInitialValidationStates"),
1046
+ evidenceCaptureInitialValidationStateCount: sumActionItems("actionEvidenceCaptureInitialValidationStates"),
1047
+ validInitialEvidenceCaptureStateCount: countInitialValidationStates(isValidInitialState),
1048
+ invalidInitialEvidenceCaptureStateCount: countInitialValidationStates(isInvalidInitialState),
1049
+ blockingInitialEvidenceCaptureStateCount: countInitialValidationStates(isBlockingInitialState),
1050
+ optionalEmptyInitialEvidenceCaptureStateCount: countInitialValidationStates(isOptionalEmptyInitialState),
1051
+ missingRequiredInitialEvidenceCaptureStateCount: countInitialValidationStates(isMissingRequiredInitialState),
1052
+ pristineInitialEvidenceCaptureStateCount: countInitialValidationStates(isPristineInitialState),
1053
+ };
1054
+ const actionEvidenceCaptureInitialDisplaySummary = {
1055
+ actionWithEvidenceCaptureInitialValidationDisplayMetadataCount: countActionsWithItems("actionEvidenceCaptureInitialValidationDisplayMetadata"),
1056
+ evidenceCaptureInitialValidationDisplayMetadataCount: sumActionItems("actionEvidenceCaptureInitialValidationDisplayMetadata"),
1057
+ dangerInitialEvidenceCaptureDisplayMetadataCount: countInitialDisplayRows(isDangerInitialDisplayRow),
1058
+ infoInitialEvidenceCaptureDisplayMetadataCount: countInitialDisplayRows(isInfoInitialDisplayRow),
1059
+ blockingInitialEvidenceCaptureDisplayMetadataCount: countInitialDisplayRows(isBlockingInitialDisplayRow),
1060
+ nonBlockingInitialEvidenceCaptureDisplayMetadataCount: countInitialDisplayRows(isNonBlockingInitialDisplayRow),
1061
+ };
1062
+ const actionEvidenceCaptureInitialValidationSummary = {
1063
+ actionWithEvidenceCaptureInitialValidationSummaryCount: countInitialValidationSummaries((summary) => summary.fieldCount > 0),
1064
+ blockedInitialEvidenceCaptureSummaryActionCount: countInitialValidationSummaries((summary) => summary.status === "blocked"),
1065
+ readyInitialEvidenceCaptureSummaryActionCount: countInitialValidationSummaries((summary) => summary.status === "ready"),
1066
+ completableInitialEvidenceCaptureSummaryActionCount: countInitialValidationSummaries((summary) => summary.canCompleteInitially),
1067
+ nonCompletableInitialEvidenceCaptureSummaryActionCount: countInitialValidationSummaries((summary) => !summary.canCompleteInitially),
1068
+ initialEvidenceCaptureSummaryBlockingFieldCount: sumInitialValidationSummaryValues((summary) => summary.blockingCount),
1069
+ initialEvidenceCaptureSummaryMissingRequiredFieldCount: sumInitialValidationSummaryValues((summary) => summary.missingRequiredCount),
1070
+ initialEvidenceCaptureSummaryOptionalEmptyFieldCount: sumInitialValidationSummaryValues((summary) => summary.optionalEmptyCount),
1071
+ };
1072
+ const actionEvidenceCaptureInitialChecklistSummary = {
1073
+ actionWithEvidenceCaptureInitialValidationChecklistCount: countActionsWithItems("actionEvidenceCaptureInitialValidationChecklist"),
1074
+ evidenceCaptureInitialValidationChecklistItemCount: sumActionItems("actionEvidenceCaptureInitialValidationChecklist"),
1075
+ checkedInitialEvidenceCaptureChecklistItemCount: countInitialChecklistItems(isInitiallyCheckedChecklistItem),
1076
+ uncheckedInitialEvidenceCaptureChecklistItemCount: countInitialChecklistItems(isInitiallyUncheckedChecklistItem),
1077
+ blockingInitialEvidenceCaptureChecklistItemCount: countInitialChecklistItems(blocksChecklistCompletion),
1078
+ nonBlockingInitialEvidenceCaptureChecklistItemCount: countInitialChecklistItems(doesNotBlockChecklistCompletion),
1079
+ requiredInitialEvidenceCaptureChecklistItemCount: countInitialChecklistItems(isRequiredItem),
1080
+ optionalInitialEvidenceCaptureChecklistItemCount: countInitialChecklistItems(isOptionalItem),
1081
+ actionWithEvidenceCaptureInitialValidationChecklistSummaryCount: countInitialChecklistSummaries((summary) => summary.itemCount > 0),
1082
+ blockedInitialEvidenceCaptureChecklistSummaryActionCount: countInitialChecklistSummaries((summary) => summary.status === "blocked"),
1083
+ readyInitialEvidenceCaptureChecklistSummaryActionCount: countInitialChecklistSummaries((summary) => summary.status === "ready"),
1084
+ completeInitialEvidenceCaptureChecklistSummaryActionCount: countInitialChecklistSummaries((summary) => summary.allCheckedInitially),
1085
+ incompleteInitialEvidenceCaptureChecklistSummaryActionCount: countInitialChecklistSummaries((summary) => !summary.allCheckedInitially),
1086
+ initialEvidenceCaptureChecklistSummaryCheckedItemCount: sumInitialChecklistSummaryValues((summary) => summary.checkedCount),
1087
+ initialEvidenceCaptureChecklistSummaryUncheckedItemCount: sumInitialChecklistSummaryValues((summary) => summary.uncheckedCount),
1088
+ initialEvidenceCaptureChecklistSummaryBlockingUncheckedItemCount: sumInitialChecklistSummaryValues((summary) => summary.blockingUncheckedCount),
1089
+ };
1090
+ const humanLineActionSummary = {
1091
+ humanLineCount: stageHumanLineSummary.count,
1092
+ humanLineByKeyCount: stageHumanLineSummary.byKeyCount,
1093
+ humanLineWithEvidenceProgressCount: stageHumanLineSummary.evidenceProgressCount,
1094
+ humanLineWithBlockedEvidenceProgressCount: stageHumanLineSummary.blockedEvidenceProgressCount,
1095
+ humanLineWithReadyEvidenceProgressCount: stageHumanLineSummary.readyEvidenceProgressCount,
1096
+ humanLineDisplayRowCount: stageHumanLineDisplayRowSummary.count,
1097
+ humanLineDisplayRowByKeyCount: stageHumanLineDisplayRowSummary.byKeyCount,
1098
+ humanLineDisplayRowWithEvidenceProgressCount: stageHumanLineDisplayRowSummary.evidenceProgressCount,
1099
+ humanLineDisplayRowWithBlockedEvidenceProgressCount: stageHumanLineDisplayRowSummary.blockedEvidenceProgressCount,
1100
+ humanLineDisplayRowWithReadyEvidenceProgressCount: stageHumanLineDisplayRowSummary.readyEvidenceProgressCount,
1101
+ humanLineDisplayRowReadyActionCount: stageHumanLineDisplayRowSummary.readyActionStatusCount,
1102
+ humanLineDisplayRowManualActionCount: stageHumanLineDisplayRowSummary.manualActionStatusCount,
1103
+ };
1104
+ const evidenceCaptureValidatedFieldSummary = {
1105
+ validatedEvidenceCaptureFieldCount: countEvidenceCaptureFields(hasValidationRule),
1106
+ requiredValidatedEvidenceCaptureFieldCount: countEvidenceCaptureFields(isRequiredValidatedField),
1107
+ optionalValidatedEvidenceCaptureFieldCount: countEvidenceCaptureFields(isOptionalValidatedField),
1108
+ minEvidenceCaptureFieldLengthTotal: sumActionItemValues(
1109
+ "actionEvidenceCaptureFields",
1110
+ (field) => field.minLength,
1111
+ ),
1112
+ maxEvidenceCaptureFieldMinLength: maxEvidenceCaptureFieldValue((field) => field.minLength),
1113
+ };
1114
+ const actionRunPolicySummary = {
1115
+ requiredActionCount: countBy(isRequiredStage),
1116
+ optionalActionCount: countBy(isOptionalStage),
1117
+ readOnlyActionCount: countBy(usesReadOnlyRunPolicy),
1118
+ localOutputActionCount: countBy(usesLocalOutputRunPolicy),
1119
+ outputFileActionCount: countBy(hasOutputFile),
1120
+ externalCallActionCount: countBy(callsExternalSystem),
1121
+ targetRepoMutationActionCount: countBy(mutatesTargetRepo),
1122
+ };
1123
+ const firstActionLookupSummary = {
1124
+ firstRequiredCommandStageKey: firstStageKey((stage) => isRequiredStage(stage) && hasCommands(stage)),
1125
+ firstLocalOutputStageKey: firstStageKey((stage) => stage.writesLocalFile),
1126
+ firstManualStageKey: firstStageKey(isManualStage),
1127
+ firstRequiredManualStageKey: firstStageKey((stage) => isRequiredStage(stage) && isManualStage(stage)),
1128
+ firstEvidenceStageKey: firstStageKey((stage) => stage.kind === "manual-reporting"),
1129
+ firstActionWithPrerequisiteKey: firstActionKey(hasActionPrerequisites),
1130
+ firstManualActionWithPrerequisiteKey: firstActionKey((action) => isManualAction(action) && hasActionPrerequisites(action)),
1131
+ firstEvidenceActionWithPrerequisiteKey: firstActionKey((action) => isManualEvidenceAction(action) && hasActionPrerequisites(action)),
1132
+ firstActionWithDependencyReasonKey: firstActionKey(hasActionDependencyReason),
1133
+ firstActionBlockingOtherActionKey: firstActionKey(blocksOtherActions),
1134
+ firstActionWithCompletionCriteriaKey: firstActionKey(hasActionCompletionCriteria),
1135
+ firstManualActionWithCompletionCriteriaKey: firstActionKey((action) => isManualAction(action) && hasActionCompletionCriteria(action)),
1136
+ firstActionRequiringEvidenceKey: firstActionKey(requiresActionEvidence),
1137
+ firstManualActionRequiringEvidenceKey: firstActionKey((action) => isManualAction(action) && requiresActionEvidence(action)),
1138
+ firstEvidenceRecordingActionKey: firstActionKey((action) => isManualEvidenceAction(action) && requiresActionEvidence(action)),
1139
+ firstTargetRepoEvidenceActionKey: firstActionKey(targetsTargetRepoEvidence),
1140
+ firstLocalOutputEvidenceActionKey: firstActionKey(targetsLocalOutputEvidence),
1141
+ firstActionWithEvidenceCaptureFieldKey: firstActionKey(hasActionEvidenceCaptureFields),
1142
+ firstActionWithOptionalEvidenceCaptureFieldKey: firstActionKey(hasOptionalActionEvidenceCaptureFields),
1143
+ firstManualActionWithEvidenceCaptureFieldKey: firstActionKey((action) => isManualAction(action) && hasActionEvidenceCaptureFields(action)),
1144
+ firstTextareaEvidenceCaptureActionKey: firstActionWithEvidenceCaptureField(usesTextareaInput),
1145
+ firstMultiValueEvidenceCaptureActionKey: firstActionWithEvidenceCaptureField(acceptsMultipleValues),
1146
+ firstValidationRuleEvidenceCaptureActionKey: firstActionWithEvidenceCaptureField(hasValidationRule),
1147
+ };
1148
+ const actionBoundarySummary = {
1149
+ requiresTargetRepoWork: stages.some((stage) => stage.kind === "manual-target-repo"),
1150
+ requiresEvidenceReturn: stages.some((stage) => stage.kind === "manual-reporting"),
1151
+ externalCalls: stages.some(callsExternalSystem),
1152
+ targetRepoMutation: stages.some(mutatesTargetRepo),
1153
+ };
1154
+ const actionSummary = {
1155
+ ...actionCountSummary,
1156
+ ...actionDependencySummary,
1157
+ ...actionEvidenceSummary,
1158
+ ...actionEvidenceCaptureFieldSummary,
1159
+ ...actionEvidenceCapturePayloadSummary,
1160
+ ...actionEvidenceCaptureValidationSummary,
1161
+ ...actionEvidenceCaptureInitialStateSummary,
1162
+ ...actionEvidenceCaptureInitialDisplaySummary,
1163
+ ...actionEvidenceCaptureInitialValidationSummary,
1164
+ ...actionEvidenceCaptureInitialChecklistSummary,
1165
+ ...humanLineActionSummary,
1166
+ ...evidenceCaptureValidatedFieldSummary,
1167
+ ...actionRunPolicySummary,
1168
+ ...nextActionSummary,
1169
+ ...firstActionLookupSummary,
1170
+ ...actionBoundarySummary,
1171
+ };
1172
+ const runbookCountSummary = {
1173
+ stageCount: stages.length,
1174
+ commandStageCount: commandStages.length,
1175
+ manualStageCount: countBy(isManualStage),
1176
+ requiredStageCount: countBy(isRequiredStage),
1177
+ optionalStageCount: countBy(isOptionalStage),
1178
+ readOnlyCommandStageCount: countBy(usesReadOnlyRunPolicy),
1179
+ localOutputCommandStageCount: countBy(usesLocalOutputRunPolicy),
1180
+ externalCallCommandStageCount: countBy(callsExternalSystem),
1181
+ targetRepoMutationCommandStageCount: countBy(mutatesTargetRepo),
1182
+ effectiveTaskId: commandManifest?.effectiveTaskId || "",
1183
+ effectiveStrictTaskCommandKey,
1184
+ };
1185
+ const stageIdentityMaps = {
1186
+ stageKeys,
1187
+ stageByKey,
1188
+ stageLabelByKey,
1189
+ stageSummaryByKey,
1190
+ };
1191
+ const stageHumanLineMaps = {
1192
+ stageHumanLines,
1193
+ stageHumanLineByKey,
1194
+ stageHumanLineDisplayRows,
1195
+ stageHumanLineDisplayRowByKey,
1196
+ stageHumanLineDisplayRowKeysByActionStatus,
1197
+ stageHumanLineDisplayRowKeysByEvidenceProgressStatus,
1198
+ stageHumanLineDisplayRowSummary,
1199
+ stageHumanLineSummary,
1200
+ };
1201
+ const stageActionStatusMaps = {
1202
+ stageActionRows,
1203
+ stageActionTypeByKey,
1204
+ stageActionLabelByKey,
1205
+ stageActionInstructionsByKey,
1206
+ stageActionButtonLabelsByKey,
1207
+ stageActionAffordanceByKey,
1208
+ stageActionEnabledByKey,
1209
+ stageActionStatusByKey,
1210
+ stageActionStatusLabelsByKey,
1211
+ stageActionStatusToneByKey,
1212
+ stageActionDisabledReasonCodeByKey,
1213
+ stageActionDisabledReasonByKey,
1214
+ };
1215
+ const stageActionDependencyMaps = {
1216
+ stageActionPrerequisiteKeysByKey,
1217
+ stageActionPrerequisiteLabelsByKey,
1218
+ stageActionPrerequisiteCountByKey,
1219
+ stageActionHasPrerequisitesByKey,
1220
+ stageActionDependencyReasonCodeByKey,
1221
+ stageActionDependencyReasonByKey,
1222
+ stageActionBlockedStageKeysByKey,
1223
+ stageActionBlockedStageLabelsByKey,
1224
+ stageActionBlockedStageCountByKey,
1225
+ stageActionBlocksStagesByKey,
1226
+ stageActionCompletionCriteriaByKey,
1227
+ stageActionCompletionCriteriaCountByKey,
1228
+ stageActionHasCompletionCriteriaByKey,
1229
+ };
1230
+ const stageActionEvidenceMaps = {
1231
+ stageActionEvidenceRequirementsByKey,
1232
+ stageActionEvidenceRequirementCountByKey,
1233
+ stageActionRequiresEvidenceByKey,
1234
+ stageActionEvidenceTargetByKey,
1235
+ stageActionEvidenceTargetLabelByKey,
1236
+ };
1237
+ const stageActionEvidenceCaptureMaps = {
1238
+ stageActionEvidenceCaptureFieldsByKey,
1239
+ stageActionEvidenceCaptureFieldKeysByKey,
1240
+ stageActionEvidenceCaptureFieldLabelsByKey,
1241
+ stageActionEvidenceCaptureFieldPlaceholdersByKey,
1242
+ stageActionEvidenceCaptureFieldRequirementLabelsByKey,
1243
+ stageActionEvidenceCaptureFieldAriaLabelsByKey,
1244
+ stageActionEvidenceCaptureFieldHelpTextsByKey,
1245
+ stageActionEvidenceCaptureFieldSectionKeysByKey,
1246
+ stageActionEvidenceCaptureFieldSectionLabelsByKey,
1247
+ stageActionEvidenceCaptureSectionKeysByKey,
1248
+ stageActionEvidenceCaptureSectionLabelsByKey,
1249
+ stageActionEvidenceCaptureSectionCountByKey,
1250
+ stageActionEvidenceCaptureFieldPayloadNamespacesByKey,
1251
+ stageActionEvidenceCaptureFieldPayloadPathsByKey,
1252
+ stageActionEvidenceCapturePayloadNamespacesByKey,
1253
+ stageActionEvidenceCapturePayloadNamespaceCountByKey,
1254
+ stageActionEvidenceCapturePayloadTemplateByKey,
1255
+ stageActionEvidenceCapturePayloadFlatTemplateByKey,
1256
+ stageActionEvidenceCapturePayloadBindingsByKey,
1257
+ stageActionEvidenceCaptureValidationSpecsByKey,
1258
+ stageActionEvidenceCaptureInitialValidationStatesByKey,
1259
+ stageActionEvidenceCaptureInitialValidationDisplayMetadataByKey,
1260
+ stageActionEvidenceCaptureInitialValidationChecklistByKey,
1261
+ stageActionEvidenceCaptureInitialValidationChecklistSummaryByKey,
1262
+ stageActionEvidenceCaptureInitialValidationSummaryByKey,
1263
+ stageActionEvidenceCaptureFieldInputTypesByKey,
1264
+ stageActionEvidenceCaptureFieldValueShapesByKey,
1265
+ stageActionEvidenceCaptureFieldAcceptsMultipleByKey,
1266
+ stageActionEvidenceCaptureFieldDefaultValuesByKey,
1267
+ stageActionEvidenceCaptureFieldEmptyValuesByKey,
1268
+ stageActionEvidenceCaptureFieldValidationRulesByKey,
1269
+ stageActionEvidenceCaptureFieldMinLengthsByKey,
1270
+ stageActionEvidenceCaptureFieldExamplesByKey,
1271
+ stageActionEvidenceCaptureFieldValidationHintsByKey,
1272
+ stageActionRequiredEvidenceCaptureFieldKeysByKey,
1273
+ stageActionOptionalEvidenceCaptureFieldKeysByKey,
1274
+ stageActionEvidenceCaptureFieldCountByKey,
1275
+ stageActionRequiredEvidenceCaptureFieldCountByKey,
1276
+ stageActionOptionalEvidenceCaptureFieldCountByKey,
1277
+ stageActionHasEvidenceCaptureFieldsByKey,
1278
+ };
1279
+ const stageExecutionMaps = {
1280
+ stageKindByKey,
1281
+ stageRequiredByKey,
1282
+ stageRunPolicyByKey,
1283
+ stageSafetyLevelByKey,
1284
+ stageCommandCountByKey,
1285
+ stageCommandKeysByKey,
1286
+ stageCommandLabelsByKey,
1287
+ stageCommandStringsByKey,
1288
+ stageCommandArgsByKey,
1289
+ stageCommandRunPoliciesByKey,
1290
+ stageCommandSafetyLevelsByKey,
1291
+ stageOutputFilesByKey,
1292
+ stageHasCommandsByKey,
1293
+ stageManualByKey,
1294
+ stageWritesLocalFileByKey,
1295
+ stageExternalCallsByKey,
1296
+ stageTargetRepoMutationByKey,
1297
+ commandStageKeys,
1298
+ manualStageKeys,
1299
+ };
1300
+ const nextStepSummary = {
1301
+ nextStageKey,
1302
+ nextStage,
1303
+ ...nextStageIdentity,
1304
+ ...nextStageActionStatus,
1305
+ ...nextStageActionDependencies,
1306
+ ...nextStageActionEvidence,
1307
+ ...nextStageEvidenceCapture,
1308
+ ...nextStageCommandSummary,
1309
+ nextCommandKey,
1310
+ ...nextCommandSummary,
1311
+ };
1312
+ return {
1313
+ version: 1,
1314
+ source: "bundle-handoff",
1315
+ ...runbookCountSummary,
1316
+ ...stageIdentityMaps,
1317
+ ...stageHumanLineMaps,
1318
+ ...stageActionStatusMaps,
1319
+ ...stageActionDependencyMaps,
1320
+ ...stageActionEvidenceMaps,
1321
+ ...stageActionEvidenceCaptureMaps,
1322
+ actionSummary,
1323
+ ...stageExecutionMaps,
1324
+ ...nextStepSummary,
1325
+ stages,
1326
+ };
1327
+ }
1328
+
1329
+ export {
1330
+ formatBundleHandoffOperatorRunbookLines,
1331
+ } from "./site-bundle-handoff-runbook-format.mjs";