@cassiomc1/forgeloop 1.2.4 → 1.5.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.
- package/.github/copilot-instructions.md +1 -0
- package/AGENTS.md +1 -0
- package/AGENT_COMPATIBILITY.md +4 -0
- package/CLAUDE.md +1 -0
- package/DOCS_INDEX.md +14 -0
- package/EXECUTION_STATE.md +48 -0
- package/LOOP_ENGINEERING.md +55 -6
- package/LOOP_SYSTEM_DESIGN.md +32 -1
- package/PROTOCOL_INTEGRATION.md +71 -0
- package/README.md +86 -0
- package/TERMINOLOGY.md +15 -0
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/THREAT_MODEL.md +22 -1
- package/docs/ARTIFACT_REFERENCE.md +54 -0
- package/docs/CLI_REFERENCE.md +177 -5
- package/docs/CROSS_HARNESS_CONTINUITY.md +34 -0
- package/docs/DOCUMENTATION_GUIDE.md +31 -0
- package/docs/GETTING_STARTED.md +10 -0
- package/docs/MCP.md +126 -0
- package/docs/RECIPES.md +87 -1
- package/docs/RELEASE_CHECKLIST_1_4.md +38 -0
- package/docs/RELEASE_CHECKLIST_1_5_MCP.md +78 -0
- package/docs/TROUBLESHOOTING.md +243 -40
- package/docs/UNIVERSAL_INTEGRATION.md +48 -0
- package/package.json +17 -3
- package/schemas/execution.schema.json +11 -1
- package/schemas/task-recovery.schema.json +61 -0
- package/schemas/work-state.schema.json +1 -0
- package/src/cli.js +182 -337
- package/src/commands/audit.js +5 -0
- package/src/commands/doctor.js +22 -0
- package/src/commands/inspect.js +6 -0
- package/src/commands/migrate-protocol.js +18 -0
- package/src/commands/progress.js +6 -2
- package/src/commands/protocol-info.js +16 -0
- package/src/commands/run-check.js +2 -0
- package/src/commands/status.js +17 -0
- package/src/commands/task-create.js +42 -3
- package/src/commands/task-list.js +14 -1
- package/src/commands/task-lock-status.js +29 -0
- package/src/commands/task-recover.js +202 -0
- package/src/commands/task-repair-legacy-recovery.js +417 -0
- package/src/commands/task-resume.js +172 -0
- package/src/commands/task-scope.js +23 -4
- package/src/commands/task-show.js +21 -7
- package/src/commands/task-unlock.js +8 -6
- package/src/commands/validate-protocol.js +19 -2
- package/src/core/artifact-registry.js +12 -0
- package/src/core/artifacts.js +17 -4
- package/src/core/audit.js +20 -4
- package/src/core/bundles.js +15 -0
- package/src/core/cli-command-definitions.js +94 -4
- package/src/core/command-executors.js +387 -0
- package/src/core/command-input.js +107 -0
- package/src/core/command-runtime.js +106 -0
- package/src/core/completion-artifacts.js +17 -6
- package/src/core/completion-ownership.js +88 -0
- package/src/core/completion.js +15 -3
- package/src/core/diagnosis.js +15 -11
- package/src/core/error-codes.js +136 -1
- package/src/core/events.js +239 -9
- package/src/core/execution.js +73 -9
- package/src/core/filesystem.js +75 -8
- package/src/core/inspect.js +27 -0
- package/src/core/integration-invocation-policy.js +170 -0
- package/src/core/integration-limits.js +20 -0
- package/src/core/integration-resources.js +127 -0
- package/src/core/next-action-model.js +60 -0
- package/src/core/next-action.js +31 -0
- package/src/core/phase.js +10 -3
- package/src/core/project-root.js +21 -0
- package/src/core/protocol-info.js +54 -0
- package/src/core/protocol-migration.js +59 -0
- package/src/core/reconcile-closure.js +54 -14
- package/src/core/recovery-history.js +116 -0
- package/src/core/resumability.js +8 -6
- package/src/core/schema-validation.js +1 -0
- package/src/core/task-claim-state.js +272 -0
- package/src/core/task-command.js +8 -4
- package/src/core/task-conflict-inspection.js +321 -0
- package/src/core/task-context.js +32 -29
- package/src/core/task-discovery.js +14 -1
- package/src/core/task-lock.js +248 -18
- package/src/core/task-migration.js +24 -1
- package/src/core/task-paths.js +6 -3
- package/src/core/task-recovery-migration.js +192 -0
- package/src/core/task-recovery.js +205 -0
- package/src/core/task-scope.js +33 -1
- package/src/core/templates.js +1 -0
- package/src/core/transaction.js +285 -0
- package/src/core/work-state.js +70 -6
- package/src/integration.js +47 -0
package/src/cli.js
CHANGED
|
@@ -4,50 +4,55 @@ import { readFile } from "node:fs/promises";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
|
|
7
|
+
import { formatStatusResult } from "./commands/status.js";
|
|
8
|
+
import { formatValidateStateResult } from "./commands/validate-state.js";
|
|
9
|
+
import { formatClearStateResult } from "./commands/clear-state.js";
|
|
10
|
+
import { formatInspectResult } from "./commands/inspect.js";
|
|
11
|
+
import { formatRouteResult } from "./commands/route.js";
|
|
12
|
+
import { formatValidateProtocolResult } from "./commands/validate-protocol.js";
|
|
13
|
+
import { formatActivateResult } from "./commands/activate.js";
|
|
14
|
+
import { formatAdvanceResult } from "./commands/advance.js";
|
|
15
|
+
import { formatPreflightResult } from "./commands/preflight.js";
|
|
16
|
+
import { formatCompleteResult } from "./commands/complete.js";
|
|
17
|
+
import { formatAuditResult } from "./commands/audit.js";
|
|
18
|
+
import { formatReportResult } from "./commands/report.js";
|
|
19
|
+
import { formatPolicyResult } from "./commands/policy.js";
|
|
20
|
+
import { formatPolicyDiscoverResult } from "./commands/policy-discover.js";
|
|
21
|
+
import { formatPolicyStatusResult } from "./commands/policy-status.js";
|
|
22
|
+
import { formatPolicyDiffResult } from "./commands/policy-diff.js";
|
|
23
|
+
import { formatRuleVerifyResult } from "./commands/rule-verify.js";
|
|
24
|
+
import { formatBaselineResult } from "./commands/baseline.js";
|
|
25
|
+
import { formatProfileInterviewResult } from "./commands/profile-interview.js";
|
|
26
|
+
import { formatBundleResult } from "./commands/bundle.js";
|
|
27
|
+
import { formatPrepareCompletionResult } from "./commands/prepare-completion.js";
|
|
28
|
+
import { formatRecordCheckResult } from "./commands/record-check.js";
|
|
29
|
+
import { formatRunCheckResult } from "./commands/run-check.js";
|
|
30
|
+
import { formatReconcileClosureResult } from "./commands/reconcile-closure.js";
|
|
31
|
+
import { formatRecordTerminalResult } from "./commands/record-terminal-result.js";
|
|
32
|
+
import { formatRecordDiagnosisResult } from "./commands/record-diagnosis.js";
|
|
33
|
+
import { formatProgressResult } from "./commands/progress.js";
|
|
34
|
+
import { formatRecordDecisionCriterionResult } from "./commands/record-decision-criterion.js";
|
|
35
|
+
import { formatNextActionResult } from "./commands/next.js";
|
|
36
|
+
import { formatContinuityResult } from "./commands/continuity.js";
|
|
37
|
+
import { formatRecordContinuityResult } from "./commands/record-continuity.js";
|
|
38
|
+
import { formatReconcileContinuityResult } from "./commands/reconcile-continuity.js";
|
|
39
|
+
import { formatClearContinuityResult } from "./commands/clear-continuity.js";
|
|
40
|
+
import { formatTaskCreateResult } from "./commands/task-create.js";
|
|
41
|
+
import { formatTaskListResult } from "./commands/task-list.js";
|
|
42
|
+
import { formatTaskShowResult } from "./commands/task-show.js";
|
|
43
|
+
import { formatTaskScopeResult } from "./commands/task-scope.js";
|
|
44
|
+
import { formatTaskMigrateResult } from "./commands/task-migrate.js";
|
|
45
|
+
import { formatMigrateProtocolResult } from "./commands/migrate-protocol.js";
|
|
46
|
+
import { formatTaskUnlockResult } from "./commands/task-unlock.js";
|
|
47
|
+
import { formatTaskRecoverResult } from "./commands/task-recover.js";
|
|
48
|
+
import { formatTaskResumeResult } from "./commands/task-resume.js";
|
|
49
|
+
import {
|
|
50
|
+
formatTaskRepairLegacyRecoveryResult,
|
|
51
|
+
} from "./commands/task-repair-legacy-recovery.js";
|
|
52
|
+
import { formatTaskLockStatusResult } from "./commands/task-lock-status.js";
|
|
53
|
+
import { formatProtocolInfoResult } from "./commands/protocol-info.js";
|
|
54
|
+
import { defaultCommandInputValues, validateForgeLoopCommandInput } from "./core/command-input.js";
|
|
55
|
+
import { COMMAND_EXECUTORS } from "./core/command-executors.js";
|
|
51
56
|
import { resolveTarget } from "./core/filesystem.js";
|
|
52
57
|
import { getPackageRoot } from "./core/templates.js";
|
|
53
58
|
import { CLI_COMMAND_DEFINITIONS, buildOptionLookup, getPositionalDefinitions } from "./core/cli-command-definitions.js";
|
|
@@ -193,48 +198,7 @@ export function discoverCommand(argv) {
|
|
|
193
198
|
}
|
|
194
199
|
|
|
195
200
|
export function parseCliSyntax(argv) {
|
|
196
|
-
const options =
|
|
197
|
-
path: ".",
|
|
198
|
-
dryRun: false,
|
|
199
|
-
json: false,
|
|
200
|
-
strict: false,
|
|
201
|
-
fix: false,
|
|
202
|
-
adopt: [],
|
|
203
|
-
work: null,
|
|
204
|
-
surfaces: [],
|
|
205
|
-
risks: [],
|
|
206
|
-
platforms: [],
|
|
207
|
-
behaviorChange: false,
|
|
208
|
-
executableChange: false,
|
|
209
|
-
to: null,
|
|
210
|
-
file: null,
|
|
211
|
-
contractFile: null,
|
|
212
|
-
routeFile: null,
|
|
213
|
-
stateFile: null,
|
|
214
|
-
receiptFile: null,
|
|
215
|
-
continuityFile: null,
|
|
216
|
-
...continuityOptionDefaults(),
|
|
217
|
-
taskBriefFiles: [],
|
|
218
|
-
delegatedResultFiles: [],
|
|
219
|
-
checkId: null,
|
|
220
|
-
checkKind: null,
|
|
221
|
-
checkRequirement: null,
|
|
222
|
-
checkStatus: null,
|
|
223
|
-
checkEvidenceKind: null,
|
|
224
|
-
checkCommand: null,
|
|
225
|
-
checkResult: null,
|
|
226
|
-
checkExitCode: null,
|
|
227
|
-
checkDetails: null,
|
|
228
|
-
checkExecutionRef: null,
|
|
229
|
-
checkProvenance: null,
|
|
230
|
-
commandArgv: [],
|
|
231
|
-
checkType: null,
|
|
232
|
-
checkSource: null,
|
|
233
|
-
policy: null,
|
|
234
|
-
task: null,
|
|
235
|
-
help: false,
|
|
236
|
-
version: false,
|
|
237
|
-
};
|
|
201
|
+
const options = defaultCommandInputValues();
|
|
238
202
|
|
|
239
203
|
const command = discoverCommand(argv);
|
|
240
204
|
const bootstrapLookup = buildOptionLookup(null);
|
|
@@ -311,53 +275,7 @@ export function parseCliSyntax(argv) {
|
|
|
311
275
|
}
|
|
312
276
|
|
|
313
277
|
export function validateCliSemantics({ command, options } = {}) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (command === "policy" && !options.policy) {
|
|
317
|
-
throw new Error("policy requires a name");
|
|
318
|
-
}
|
|
319
|
-
if (command !== "policy" && options.policy) {
|
|
320
|
-
throw new Error(`Policy name is not valid for ${command}`);
|
|
321
|
-
}
|
|
322
|
-
if (command === "bundle" && !options.task) {
|
|
323
|
-
throw new Error("bundle requires --task");
|
|
324
|
-
}
|
|
325
|
-
if (command === "task-create" && !options.task) {
|
|
326
|
-
throw new Error("task-create requires --task");
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
validateContinuityOptions(command, options);
|
|
330
|
-
|
|
331
|
-
if (command === "record-check" && !options.help) {
|
|
332
|
-
if (!options.checkId) throw new Error("record-check requires --id");
|
|
333
|
-
if (!options.checkRequirement) throw new Error("record-check requires --requirement");
|
|
334
|
-
if (!options.checkStatus) throw new Error("record-check requires --status");
|
|
335
|
-
if (!options.checkEvidenceKind) throw new Error("record-check requires --evidence-kind");
|
|
336
|
-
if (!options.checkCommand && !options.checkResult) throw new Error("record-check requires --command or --result");
|
|
337
|
-
}
|
|
338
|
-
if (command === "run-check" && !options.help) {
|
|
339
|
-
if (!options.checkId) throw new Error("run-check requires --id");
|
|
340
|
-
if (!options.checkRequirement) throw new Error("run-check requires --requirement");
|
|
341
|
-
if (options.checkKind || options.checkStatus || options.checkEvidenceKind || options.checkCommand
|
|
342
|
-
|| options.checkResult || options.checkExitCode !== null || options.checkExecutionRef || options.checkProvenance) {
|
|
343
|
-
throw new Error("run-check accepts only --id, --requirement, --details, and -- <argv>");
|
|
344
|
-
}
|
|
345
|
-
if (!Array.isArray(options.commandArgv) || options.commandArgv.length === 0) {
|
|
346
|
-
throw new Error("run-check requires -- followed by an exact command argv");
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
if (command === "reconcile-closure" && !options.help) {
|
|
350
|
-
if (!options.task) throw new Error("reconcile-closure requires --task");
|
|
351
|
-
if (!options.checkId) throw new Error("reconcile-closure requires --id");
|
|
352
|
-
if (!options.checkRequirement) throw new Error("reconcile-closure requires --requirement");
|
|
353
|
-
if (options.checkKind || options.checkStatus || options.checkEvidenceKind || options.checkCommand
|
|
354
|
-
|| options.checkResult || options.checkExitCode !== null || options.checkExecutionRef || options.checkProvenance) {
|
|
355
|
-
throw new Error("reconcile-closure accepts only --id, --requirement, --details, and -- <argv>");
|
|
356
|
-
}
|
|
357
|
-
if (!Array.isArray(options.commandArgv) || options.commandArgv.length === 0) {
|
|
358
|
-
throw new Error("reconcile-closure requires -- followed by an exact command argv");
|
|
359
|
-
}
|
|
360
|
-
}
|
|
278
|
+
validateForgeLoopCommandInput({ command, input: options, help: options?.help ?? false });
|
|
361
279
|
}
|
|
362
280
|
|
|
363
281
|
export function parseArgs(argv) {
|
|
@@ -380,20 +298,23 @@ function printActions(actions) {
|
|
|
380
298
|
}
|
|
381
299
|
}
|
|
382
300
|
|
|
301
|
+
function renderJsonOr(options, result, formatter) {
|
|
302
|
+
console.log(options.json ? JSON.stringify(result, null, 2) : formatter(result));
|
|
303
|
+
}
|
|
304
|
+
|
|
383
305
|
export const COMMAND_HANDLERS = Object.freeze({
|
|
306
|
+
"protocol-info": async ({ packageVersion, options }) => {
|
|
307
|
+
const { result } = await COMMAND_EXECUTORS["protocol-info"]({ packageVersion, options });
|
|
308
|
+
renderJsonOr(options, result, formatProtocolInfoResult);
|
|
309
|
+
return 0;
|
|
310
|
+
},
|
|
384
311
|
init: async ({ target, packageRoot, packageVersion, options }) => {
|
|
385
|
-
const result = await
|
|
312
|
+
const { result } = await COMMAND_EXECUTORS.init({ target, packageRoot, packageVersion, options });
|
|
386
313
|
printActions(result.actions);
|
|
387
314
|
return 0;
|
|
388
315
|
},
|
|
389
316
|
doctor: async ({ target, packageRoot, options }) => {
|
|
390
|
-
const result = await
|
|
391
|
-
target,
|
|
392
|
-
packageRoot,
|
|
393
|
-
adoptPaths: options.adopt,
|
|
394
|
-
strict: options.strict,
|
|
395
|
-
fix: options.fix,
|
|
396
|
-
});
|
|
317
|
+
const { result } = await COMMAND_EXECUTORS.doctor({ target, packageRoot, options });
|
|
397
318
|
if (options.json) {
|
|
398
319
|
console.log(JSON.stringify(result, null, 2));
|
|
399
320
|
} else {
|
|
@@ -405,317 +326,241 @@ export const COMMAND_HANDLERS = Object.freeze({
|
|
|
405
326
|
return result.ok ? 0 : 1;
|
|
406
327
|
},
|
|
407
328
|
route: async ({ target, packageRoot, options }) => {
|
|
408
|
-
const result = await
|
|
409
|
-
|
|
410
|
-
packageRoot,
|
|
411
|
-
workType: options.work,
|
|
412
|
-
surfaces: options.surfaces,
|
|
413
|
-
risks: options.risks,
|
|
414
|
-
platforms: options.platforms,
|
|
415
|
-
behaviorChange: options.behaviorChange,
|
|
416
|
-
executableChange: options.executableChange,
|
|
417
|
-
taskId: options.task,
|
|
418
|
-
});
|
|
419
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatRouteResult(result));
|
|
329
|
+
const { result } = await COMMAND_EXECUTORS.route({ target, packageRoot, options });
|
|
330
|
+
renderJsonOr(options, result, formatRouteResult);
|
|
420
331
|
return 0;
|
|
421
332
|
},
|
|
422
333
|
activate: async ({ target, packageRoot, options }) => {
|
|
423
|
-
const result = await
|
|
424
|
-
|
|
334
|
+
const { result } = await COMMAND_EXECUTORS.activate({ target, packageRoot, options });
|
|
335
|
+
renderJsonOr(options, result, formatActivateResult);
|
|
425
336
|
return 0;
|
|
426
337
|
},
|
|
427
338
|
preflight: async ({ target, packageRoot, options }) => {
|
|
428
|
-
const result = await
|
|
429
|
-
|
|
430
|
-
return
|
|
339
|
+
const { result, exitCode } = await COMMAND_EXECUTORS.preflight({ target, packageRoot, options });
|
|
340
|
+
renderJsonOr(options, result, formatPreflightResult);
|
|
341
|
+
return exitCode;
|
|
431
342
|
},
|
|
432
343
|
advance: async ({ target, packageRoot, options }) => {
|
|
433
|
-
const result = await
|
|
434
|
-
|
|
344
|
+
const { result } = await COMMAND_EXECUTORS.advance({ target, packageRoot, options });
|
|
345
|
+
renderJsonOr(options, result, formatAdvanceResult);
|
|
435
346
|
return 0;
|
|
436
347
|
},
|
|
437
348
|
next: async ({ target, packageRoot, options }) => {
|
|
438
|
-
const result = await
|
|
439
|
-
|
|
349
|
+
const { result } = await COMMAND_EXECUTORS.next({ target, packageRoot, options });
|
|
350
|
+
renderJsonOr(options, result, formatNextActionResult);
|
|
440
351
|
return 0;
|
|
441
352
|
},
|
|
442
353
|
continuity: async ({ target, packageRoot, options }) => {
|
|
443
|
-
const result = await
|
|
444
|
-
|
|
354
|
+
const { result } = await COMMAND_EXECUTORS.continuity({ target, packageRoot, options });
|
|
355
|
+
renderJsonOr(options, result, formatContinuityResult);
|
|
445
356
|
return 0;
|
|
446
357
|
},
|
|
447
358
|
"record-continuity": async ({ target, packageRoot, options }) => {
|
|
448
|
-
const result = await
|
|
449
|
-
|
|
450
|
-
focusId: options.continuityFocusId,
|
|
451
|
-
focusSummary: options.continuityFocusSummary,
|
|
452
|
-
remaining: options.continuityRemaining,
|
|
453
|
-
knownIssues: options.continuityKnownIssues,
|
|
454
|
-
changedAreas: options.continuityChangedAreas,
|
|
455
|
-
inspectFirst: options.continuityInspectFirst,
|
|
456
|
-
resumeNote: options.continuityResumeNote,
|
|
457
|
-
taskId: options.task,
|
|
458
|
-
});
|
|
459
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatRecordContinuityResult(result));
|
|
359
|
+
const { result } = await COMMAND_EXECUTORS["record-continuity"]({ target, packageRoot, options });
|
|
360
|
+
renderJsonOr(options, result, formatRecordContinuityResult);
|
|
460
361
|
return 0;
|
|
461
362
|
},
|
|
462
363
|
"reconcile-continuity": async ({ target, packageRoot, options }) => {
|
|
463
|
-
const result = await
|
|
464
|
-
|
|
364
|
+
const { result } = await COMMAND_EXECUTORS["reconcile-continuity"]({ target, packageRoot, options });
|
|
365
|
+
renderJsonOr(options, result, formatReconcileContinuityResult);
|
|
465
366
|
return 0;
|
|
466
367
|
},
|
|
467
368
|
"clear-continuity": async ({ target, options }) => {
|
|
468
|
-
const result = await
|
|
469
|
-
|
|
369
|
+
const { result } = await COMMAND_EXECUTORS["clear-continuity"]({ target, options });
|
|
370
|
+
renderJsonOr(options, result, formatClearContinuityResult);
|
|
470
371
|
return 0;
|
|
471
372
|
},
|
|
472
373
|
"prepare-completion": async ({ target, packageRoot, options }) => {
|
|
473
|
-
const result = await
|
|
474
|
-
|
|
374
|
+
const { result } = await COMMAND_EXECUTORS["prepare-completion"]({ target, packageRoot, options });
|
|
375
|
+
renderJsonOr(options, result, formatPrepareCompletionResult);
|
|
475
376
|
return 0;
|
|
476
377
|
},
|
|
477
378
|
"run-check": async ({ target, packageRoot, options }) => {
|
|
478
|
-
const result = await
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
id: options.checkId,
|
|
482
|
-
requirement: options.checkRequirement,
|
|
483
|
-
argv: options.commandArgv,
|
|
484
|
-
details: options.checkDetails ?? undefined,
|
|
485
|
-
taskId: options.task,
|
|
486
|
-
});
|
|
487
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatRunCheckResult(result));
|
|
488
|
-
return result.check.status === "passed" ? 0 : 1;
|
|
379
|
+
const { result, exitCode } = await COMMAND_EXECUTORS["run-check"]({ target, packageRoot, options });
|
|
380
|
+
renderJsonOr(options, result, formatRunCheckResult);
|
|
381
|
+
return exitCode;
|
|
489
382
|
},
|
|
490
383
|
"record-check": async ({ target, packageRoot, options }) => {
|
|
491
|
-
const result = await
|
|
492
|
-
|
|
493
|
-
packageRoot,
|
|
494
|
-
id: options.checkId,
|
|
495
|
-
kind: options.checkKind ?? "command",
|
|
496
|
-
requirement: options.checkRequirement,
|
|
497
|
-
status: options.checkStatus,
|
|
498
|
-
evidenceKind: options.checkEvidenceKind,
|
|
499
|
-
command: options.checkCommand ?? undefined,
|
|
500
|
-
result: options.checkResult ?? undefined,
|
|
501
|
-
...(options.checkExitCode === null ? {} : { exitCode: options.checkExitCode }),
|
|
502
|
-
details: options.checkDetails ?? undefined,
|
|
503
|
-
executionRef: options.checkExecutionRef ?? undefined,
|
|
504
|
-
provenance: options.checkProvenance ?? undefined,
|
|
505
|
-
taskId: options.task,
|
|
506
|
-
});
|
|
507
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatRecordCheckResult(result));
|
|
384
|
+
const { result } = await COMMAND_EXECUTORS["record-check"]({ target, packageRoot, options });
|
|
385
|
+
renderJsonOr(options, result, formatRecordCheckResult);
|
|
508
386
|
return 0;
|
|
509
387
|
},
|
|
510
388
|
"record-terminal-result": async ({ target, packageRoot, options }) => {
|
|
511
|
-
const result = await
|
|
512
|
-
|
|
513
|
-
packageRoot,
|
|
514
|
-
requirement: options.checkRequirement,
|
|
515
|
-
type: options.checkType,
|
|
516
|
-
status: options.checkStatus,
|
|
517
|
-
source: options.checkSource ?? options.checkCommand,
|
|
518
|
-
result: options.checkResult,
|
|
519
|
-
details: options.checkDetails ?? undefined,
|
|
520
|
-
taskId: options.task,
|
|
521
|
-
});
|
|
522
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatRecordTerminalResult(result));
|
|
389
|
+
const { result } = await COMMAND_EXECUTORS["record-terminal-result"]({ target, packageRoot, options });
|
|
390
|
+
renderJsonOr(options, result, formatRecordTerminalResult);
|
|
523
391
|
return 0;
|
|
524
392
|
},
|
|
525
393
|
"record-diagnosis": async ({ target, packageRoot, options }) => {
|
|
526
|
-
const result = await
|
|
527
|
-
|
|
528
|
-
packageRoot,
|
|
529
|
-
hypothesis: options.hypothesis,
|
|
530
|
-
failureClass: options.failureClass,
|
|
531
|
-
evidenceRefs: options.evidenceRefs,
|
|
532
|
-
settledBy: options.settledBy,
|
|
533
|
-
nextSafeAction: options.nextSafeAction,
|
|
534
|
-
taskId: options.task,
|
|
535
|
-
});
|
|
536
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatRecordDiagnosisResult(result));
|
|
394
|
+
const { result } = await COMMAND_EXECUTORS["record-diagnosis"]({ target, packageRoot, options });
|
|
395
|
+
renderJsonOr(options, result, formatRecordDiagnosisResult);
|
|
537
396
|
return 0;
|
|
538
397
|
},
|
|
539
398
|
progress: async ({ target, packageRoot, options }) => {
|
|
540
|
-
const result = await
|
|
541
|
-
|
|
542
|
-
return
|
|
399
|
+
const { result, exitCode } = await COMMAND_EXECUTORS.progress({ target, packageRoot, options });
|
|
400
|
+
renderJsonOr(options, result, formatProgressResult);
|
|
401
|
+
return exitCode;
|
|
543
402
|
},
|
|
544
403
|
"record-decision-criterion": async ({ target, packageRoot, options }) => {
|
|
545
|
-
const result = await
|
|
546
|
-
|
|
547
|
-
packageRoot,
|
|
548
|
-
decision: options.decision,
|
|
549
|
-
settledBy: options.settledBy,
|
|
550
|
-
taskId: options.task,
|
|
551
|
-
});
|
|
552
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatRecordDecisionCriterionResult(result));
|
|
404
|
+
const { result } = await COMMAND_EXECUTORS["record-decision-criterion"]({ target, packageRoot, options });
|
|
405
|
+
renderJsonOr(options, result, formatRecordDecisionCriterionResult);
|
|
553
406
|
return 0;
|
|
554
407
|
},
|
|
555
408
|
complete: async ({ target, packageRoot, options }) => {
|
|
556
|
-
const result = await
|
|
557
|
-
|
|
558
|
-
return
|
|
409
|
+
const { result, exitCode } = await COMMAND_EXECUTORS.complete({ target, packageRoot, options });
|
|
410
|
+
renderJsonOr(options, result, formatCompleteResult);
|
|
411
|
+
return exitCode;
|
|
559
412
|
},
|
|
560
413
|
audit: async ({ target, packageRoot, options }) => {
|
|
561
|
-
const result = await
|
|
562
|
-
|
|
563
|
-
return
|
|
414
|
+
const { result, exitCode } = await COMMAND_EXECUTORS.audit({ target, packageRoot, options });
|
|
415
|
+
renderJsonOr(options, result, formatAuditResult);
|
|
416
|
+
return exitCode;
|
|
564
417
|
},
|
|
565
418
|
report: async ({ target, packageRoot, options }) => {
|
|
566
|
-
const result = await
|
|
567
|
-
|
|
568
|
-
return
|
|
419
|
+
const { result, exitCode } = await COMMAND_EXECUTORS.report({ target, packageRoot, options });
|
|
420
|
+
renderJsonOr(options, result, formatReportResult);
|
|
421
|
+
return exitCode;
|
|
569
422
|
},
|
|
570
423
|
policy: async ({ target, packageRoot, options }) => {
|
|
571
|
-
const result = await
|
|
572
|
-
|
|
424
|
+
const { result } = await COMMAND_EXECUTORS.policy({ target, packageRoot, options });
|
|
425
|
+
renderJsonOr(options, result, formatPolicyResult);
|
|
573
426
|
return 0;
|
|
574
427
|
},
|
|
575
428
|
"policy-discover": async ({ target, packageRoot, options }) => {
|
|
576
|
-
const result = await
|
|
577
|
-
|
|
429
|
+
const { result } = await COMMAND_EXECUTORS["policy-discover"]({ target, packageRoot, options });
|
|
430
|
+
renderJsonOr(options, result, formatPolicyDiscoverResult);
|
|
578
431
|
return 0;
|
|
579
432
|
},
|
|
580
433
|
"policy-status": async ({ target, packageRoot, options }) => {
|
|
581
|
-
const result = await
|
|
582
|
-
|
|
583
|
-
return
|
|
434
|
+
const { result, exitCode } = await COMMAND_EXECUTORS["policy-status"]({ target, packageRoot, options });
|
|
435
|
+
renderJsonOr(options, result, formatPolicyStatusResult);
|
|
436
|
+
return exitCode;
|
|
584
437
|
},
|
|
585
438
|
"policy-diff": async ({ target, packageRoot, options }) => {
|
|
586
|
-
const result = await
|
|
587
|
-
|
|
439
|
+
const { result } = await COMMAND_EXECUTORS["policy-diff"]({ target, packageRoot, options });
|
|
440
|
+
renderJsonOr(options, result, formatPolicyDiffResult);
|
|
588
441
|
return 0;
|
|
589
442
|
},
|
|
590
443
|
"rule-verify": async ({ target, packageRoot, options }) => {
|
|
591
|
-
const result = await
|
|
592
|
-
|
|
593
|
-
return
|
|
444
|
+
const { result, exitCode } = await COMMAND_EXECUTORS["rule-verify"]({ target, packageRoot, options });
|
|
445
|
+
renderJsonOr(options, result, formatRuleVerifyResult);
|
|
446
|
+
return exitCode;
|
|
594
447
|
},
|
|
595
448
|
baseline: async ({ target, packageRoot, options }) => {
|
|
596
|
-
const result = await
|
|
597
|
-
|
|
598
|
-
packageRoot,
|
|
599
|
-
record: options.record,
|
|
600
|
-
update: options.update,
|
|
601
|
-
policyResetAuthorized: options.policyResetAuthorized,
|
|
602
|
-
});
|
|
603
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatBaselineResult(result));
|
|
449
|
+
const { result } = await COMMAND_EXECUTORS.baseline({ target, packageRoot, options });
|
|
450
|
+
renderJsonOr(options, result, formatBaselineResult);
|
|
604
451
|
return 0;
|
|
605
452
|
},
|
|
606
453
|
"profile-interview": async ({ target, packageRoot, options }) => {
|
|
607
|
-
const result = await
|
|
608
|
-
|
|
454
|
+
const { result } = await COMMAND_EXECUTORS["profile-interview"]({ target, packageRoot, options });
|
|
455
|
+
renderJsonOr(options, result, formatProfileInterviewResult);
|
|
609
456
|
return 0;
|
|
610
457
|
},
|
|
611
458
|
bundle: async ({ target, packageRoot, options }) => {
|
|
612
|
-
const result = await
|
|
613
|
-
|
|
459
|
+
const { result } = await COMMAND_EXECUTORS.bundle({ target, packageRoot, options });
|
|
460
|
+
renderJsonOr(options, result, formatBundleResult);
|
|
614
461
|
return 0;
|
|
615
462
|
},
|
|
616
463
|
inspect: async ({ target, packageRoot, options }) => {
|
|
617
|
-
const result = await
|
|
618
|
-
|
|
619
|
-
return
|
|
464
|
+
const { result, exitCode } = await COMMAND_EXECUTORS.inspect({ target, packageRoot, options });
|
|
465
|
+
renderJsonOr(options, result, formatInspectResult);
|
|
466
|
+
return exitCode;
|
|
620
467
|
},
|
|
621
468
|
"validate-receipt": async ({ target, packageRoot, options }) => {
|
|
622
|
-
const result = await
|
|
469
|
+
const { result } = await COMMAND_EXECUTORS["validate-receipt"]({ target, packageRoot, options });
|
|
623
470
|
console.log(options.json ? JSON.stringify(result, null, 2) : "valid: execution receipt");
|
|
624
471
|
return 0;
|
|
625
472
|
},
|
|
626
473
|
"validate-protocol": async ({ target, packageRoot, options }) => {
|
|
627
|
-
const result = await
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
stateFile: options.stateFile,
|
|
631
|
-
receiptFile: options.receiptFile,
|
|
632
|
-
routeFile: options.routeFile,
|
|
633
|
-
contractFile: options.contractFile,
|
|
634
|
-
continuityFile: options.continuityFile,
|
|
635
|
-
taskBriefFiles: options.taskBriefFiles,
|
|
636
|
-
delegatedResultFiles: options.delegatedResultFiles,
|
|
637
|
-
taskId: options.task,
|
|
638
|
-
});
|
|
639
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatValidateProtocolResult(result));
|
|
640
|
-
return result.status === "VALID" ? 0 : 1;
|
|
474
|
+
const { result, exitCode } = await COMMAND_EXECUTORS["validate-protocol"]({ target, packageRoot, options });
|
|
475
|
+
renderJsonOr(options, result, formatValidateProtocolResult);
|
|
476
|
+
return exitCode;
|
|
641
477
|
},
|
|
642
478
|
status: async ({ target, packageRoot, options }) => {
|
|
643
|
-
const result = await
|
|
644
|
-
|
|
479
|
+
const { result } = await COMMAND_EXECUTORS.status({ target, packageRoot, options });
|
|
480
|
+
renderJsonOr(options, result, formatStatusResult);
|
|
645
481
|
return 0;
|
|
646
482
|
},
|
|
647
483
|
"validate-state": async ({ target, packageRoot, options }) => {
|
|
648
|
-
const result = await
|
|
649
|
-
|
|
650
|
-
return
|
|
484
|
+
const { result, exitCode } = await COMMAND_EXECUTORS["validate-state"]({ target, packageRoot, options });
|
|
485
|
+
renderJsonOr(options, result, formatValidateStateResult);
|
|
486
|
+
return exitCode;
|
|
651
487
|
},
|
|
652
488
|
"clear-state": async ({ target, options }) => {
|
|
653
|
-
const result = await
|
|
654
|
-
|
|
489
|
+
const { result } = await COMMAND_EXECUTORS["clear-state"]({ target, options });
|
|
490
|
+
renderJsonOr(options, result, formatClearStateResult);
|
|
655
491
|
return 0;
|
|
656
492
|
},
|
|
657
493
|
"task-create": async ({ target, packageRoot, options }) => {
|
|
658
|
-
const result = await
|
|
659
|
-
|
|
660
|
-
packageRoot,
|
|
661
|
-
taskId: options.task,
|
|
662
|
-
claims: options.claims,
|
|
663
|
-
contractFile: options.contractFile,
|
|
664
|
-
});
|
|
665
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatTaskCreateResult(result));
|
|
494
|
+
const { result } = await COMMAND_EXECUTORS["task-create"]({ target, packageRoot, options });
|
|
495
|
+
renderJsonOr(options, result, formatTaskCreateResult);
|
|
666
496
|
return 0;
|
|
667
497
|
},
|
|
668
498
|
"task-list": async ({ target, packageRoot, options }) => {
|
|
669
|
-
const result = await
|
|
670
|
-
|
|
499
|
+
const { result } = await COMMAND_EXECUTORS["task-list"]({ target, packageRoot, options });
|
|
500
|
+
renderJsonOr(options, result, formatTaskListResult);
|
|
671
501
|
return 0;
|
|
672
502
|
},
|
|
673
503
|
"task-show": async ({ target, packageRoot, options }) => {
|
|
674
|
-
const result = await
|
|
675
|
-
|
|
504
|
+
const { result } = await COMMAND_EXECUTORS["task-show"]({ target, packageRoot, options });
|
|
505
|
+
renderJsonOr(options, result, formatTaskShowResult);
|
|
506
|
+
return 0;
|
|
507
|
+
},
|
|
508
|
+
"task-lock-status": async ({ target, packageRoot, options }) => {
|
|
509
|
+
const { result } = await COMMAND_EXECUTORS["task-lock-status"]({ target, packageRoot, options });
|
|
510
|
+
renderJsonOr(options, result, formatTaskLockStatusResult);
|
|
676
511
|
return 0;
|
|
677
512
|
},
|
|
678
513
|
"task-scope": async ({ target, packageRoot, options }) => {
|
|
679
|
-
const result = await
|
|
680
|
-
|
|
681
|
-
packageRoot,
|
|
682
|
-
taskId: options.task,
|
|
683
|
-
claims: options.claims,
|
|
684
|
-
});
|
|
685
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatTaskScopeResult(result));
|
|
514
|
+
const { result } = await COMMAND_EXECUTORS["task-scope"]({ target, packageRoot, options });
|
|
515
|
+
renderJsonOr(options, result, formatTaskScopeResult);
|
|
686
516
|
return 0;
|
|
687
517
|
},
|
|
688
518
|
"task-migrate": async ({ target, packageRoot, options }) => {
|
|
689
|
-
const result = await
|
|
690
|
-
|
|
519
|
+
const { result } = await COMMAND_EXECUTORS["task-migrate"]({ target, packageRoot, options });
|
|
520
|
+
renderJsonOr(options, result, formatTaskMigrateResult);
|
|
521
|
+
return 0;
|
|
522
|
+
},
|
|
523
|
+
"migrate-protocol": async ({ target, packageRoot, options }) => {
|
|
524
|
+
const { result } = await COMMAND_EXECUTORS["migrate-protocol"]({ target, packageRoot, options });
|
|
525
|
+
renderJsonOr(options, result, formatMigrateProtocolResult);
|
|
691
526
|
return 0;
|
|
692
527
|
},
|
|
693
528
|
"task-unlock": async ({ target, packageRoot, options }) => {
|
|
694
|
-
const result = await
|
|
695
|
-
|
|
529
|
+
const { result } = await COMMAND_EXECUTORS["task-unlock"]({ target, packageRoot, options });
|
|
530
|
+
renderJsonOr(options, result, formatTaskUnlockResult);
|
|
531
|
+
return 0;
|
|
532
|
+
},
|
|
533
|
+
"task-recover": async ({ target, packageRoot, options }) => {
|
|
534
|
+
if (options.operatorAuthorized && !options.acknowledgeRecovery) {
|
|
535
|
+
console.error("DEPRECATION: --operator-authorized is caller acknowledgement, not host attestation; use --acknowledge-recovery.");
|
|
536
|
+
}
|
|
537
|
+
const { result } = await COMMAND_EXECUTORS["task-recover"]({ target, packageRoot, options });
|
|
538
|
+
renderJsonOr(options, result, formatTaskRecoverResult);
|
|
539
|
+
return 0;
|
|
540
|
+
},
|
|
541
|
+
"task-resume": async ({ target, packageRoot, options }) => {
|
|
542
|
+
const { result } = await COMMAND_EXECUTORS["task-resume"]({ target, packageRoot, options });
|
|
543
|
+
renderJsonOr(options, result, formatTaskResumeResult);
|
|
544
|
+
return 0;
|
|
545
|
+
},
|
|
546
|
+
"task-repair-legacy-recovery": async ({ target, packageRoot, options }) => {
|
|
547
|
+
const { result } = await COMMAND_EXECUTORS["task-repair-legacy-recovery"]({ target, packageRoot, options });
|
|
548
|
+
renderJsonOr(options, result, formatTaskRepairLegacyRecoveryResult);
|
|
696
549
|
return 0;
|
|
697
550
|
},
|
|
698
551
|
"reconcile-closure": async ({ target, packageRoot, options }) => {
|
|
699
|
-
const result = await
|
|
700
|
-
|
|
701
|
-
packageRoot,
|
|
702
|
-
taskId: options.task,
|
|
703
|
-
checkId: options.checkId,
|
|
704
|
-
checkRequirement: options.checkRequirement,
|
|
705
|
-
checkDetails: options.checkDetails,
|
|
706
|
-
commandArgv: options.commandArgv,
|
|
707
|
-
});
|
|
708
|
-
console.log(options.json ? JSON.stringify(result, null, 2) : formatReconcileClosureResult(result));
|
|
552
|
+
const { result } = await COMMAND_EXECUTORS["reconcile-closure"]({ target, packageRoot, options });
|
|
553
|
+
renderJsonOr(options, result, formatReconcileClosureResult);
|
|
709
554
|
return 0;
|
|
710
555
|
},
|
|
711
556
|
update: async ({ target, packageRoot, packageVersion, options }) => {
|
|
712
|
-
const result = await
|
|
557
|
+
const { result, exitCode } = await COMMAND_EXECUTORS.update({ target, packageRoot, packageVersion, options });
|
|
713
558
|
printActions(result.actions);
|
|
714
559
|
for (const conflict of result.conflicts) {
|
|
715
560
|
const code = conflict.code ? `${conflict.code}: ` : "";
|
|
716
561
|
console.log(`conflict: ${code}${conflict.path} - ${conflict.message}`);
|
|
717
562
|
}
|
|
718
|
-
return
|
|
563
|
+
return exitCode;
|
|
719
564
|
},
|
|
720
565
|
});
|
|
721
566
|
|