cool-workflow 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/.gemini-plugin/mcp.json +10 -0
  4. package/.gemini-plugin/plugin.json +40 -0
  5. package/.opencode-plugin/mcp.json +10 -0
  6. package/.opencode-plugin/plugin.json +40 -0
  7. package/README.md +202 -48
  8. package/apps/architecture-review/app.json +1 -1
  9. package/apps/architecture-review-fast/app.json +1 -1
  10. package/apps/end-to-end-golden-path/app.json +1 -1
  11. package/apps/pr-review-fix-ci/app.json +1 -1
  12. package/apps/release-cut/app.json +1 -1
  13. package/apps/research-synthesis/app.json +1 -1
  14. package/dist/cli/dispatch.js +33 -4
  15. package/dist/cli/entry.js +11 -19
  16. package/dist/cli/global-flags.js +113 -0
  17. package/dist/cli/io.js +6 -20
  18. package/dist/cli/parseargv.js +7 -1
  19. package/dist/core/capability-data.js +339 -10
  20. package/dist/core/format/help.js +80 -4
  21. package/dist/core/format/recovery-hint.js +32 -0
  22. package/dist/core/multi-agent/collaboration.js +35 -6
  23. package/dist/core/multi-agent/runtime.js +7 -0
  24. package/dist/core/multi-agent/trust-policy.js +7 -1
  25. package/dist/core/pipeline/contract.js +7 -0
  26. package/dist/core/pipeline/error-feedback.js +2 -2
  27. package/dist/core/trust/evidence-grounding.js +13 -1
  28. package/dist/core/util/cli-args.js +55 -0
  29. package/dist/core/version.js +1 -1
  30. package/dist/mcp/dispatch.js +22 -2
  31. package/dist/mcp/server.js +124 -13
  32. package/dist/mcp-server.js +20 -0
  33. package/dist/shell/commit.js +8 -2
  34. package/dist/shell/coordinator-io.js +73 -1
  35. package/dist/shell/drive.js +129 -64
  36. package/dist/shell/error-feedback-io.js +6 -0
  37. package/dist/shell/execution-backend/agent.js +205 -24
  38. package/dist/shell/execution-backend/container.js +44 -10
  39. package/dist/shell/execution-backend/local.js +47 -10
  40. package/dist/shell/fs-atomic.js +93 -12
  41. package/dist/shell/ledger-cli.js +9 -2
  42. package/dist/shell/multi-agent-cli.js +5 -1
  43. package/dist/shell/onramp.js +48 -5
  44. package/dist/shell/pipeline-cli.js +20 -2
  45. package/dist/shell/pipeline.js +2 -1
  46. package/dist/shell/reclamation-io.js +76 -7
  47. package/dist/shell/registry-cli.js +4 -0
  48. package/dist/shell/run-export.js +52 -4
  49. package/dist/shell/run-registry-io.js +1 -0
  50. package/dist/shell/run-store.js +156 -0
  51. package/dist/shell/scheduler-io.js +101 -10
  52. package/dist/shell/telemetry-ledger-io.js +36 -24
  53. package/dist/shell/trust-audit.js +104 -10
  54. package/dist/shell/workbench-host.js +121 -10
  55. package/dist/shell/workbench.js +79 -5
  56. package/dist/shell/worker-isolation.js +1 -1
  57. package/dist/shell/workflow-app-loader.js +67 -1
  58. package/dist/wiring/capability-table/basics.js +7 -2
  59. package/dist/wiring/capability-table/exec-backend.js +42 -24
  60. package/dist/wiring/capability-table/multi-agent.js +69 -69
  61. package/dist/wiring/capability-table/pipeline.js +60 -28
  62. package/dist/wiring/capability-table/registry-core.js +29 -6
  63. package/dist/wiring/capability-table/reporting.js +45 -39
  64. package/dist/wiring/capability-table/scheduling-registry.js +66 -60
  65. package/dist/wiring/capability-table/state.js +34 -34
  66. package/dist/wiring/capability-table/trust-ledger.js +66 -24
  67. package/dist/wiring/capability-table/workflow-apps.js +15 -15
  68. package/docs/agent-delegation-drive.7.md +17 -0
  69. package/docs/cli-mcp-parity.7.md +43 -13
  70. package/docs/contract-migration-tooling.7.md +4 -0
  71. package/docs/control-plane-scheduling.7.md +38 -0
  72. package/docs/cross-agent-ledger.7.md +20 -8
  73. package/docs/durable-state-and-locking.7.md +4 -0
  74. package/docs/evidence-adoption-reasoning-chain.7.md +4 -0
  75. package/docs/execution-backends.7.md +4 -0
  76. package/docs/fix.7.md +4 -4
  77. package/docs/getting-started.md +40 -32
  78. package/docs/index.md +17 -0
  79. package/docs/launch/demo.tape +4 -3
  80. package/docs/mcp-app-surface.7.md +6 -0
  81. package/docs/multi-agent-cli-mcp-surface.7.md +4 -0
  82. package/docs/multi-agent-eval-replay-harness.7.md +4 -0
  83. package/docs/multi-agent-operator-ux.7.md +4 -0
  84. package/docs/node-snapshot-diff-replay.7.md +4 -0
  85. package/docs/observability-cost-accounting.7.md +4 -0
  86. package/docs/project-index.md +43 -9
  87. package/docs/real-execution-backends.7.md +4 -0
  88. package/docs/release-and-migration.7.md +4 -0
  89. package/docs/release-tooling.7.md +22 -0
  90. package/docs/routine.7.md +22 -0
  91. package/docs/run-registry-control-plane.7.md +4 -0
  92. package/docs/run-retention-reclamation.7.md +28 -3
  93. package/docs/state-explosion-management.7.md +4 -0
  94. package/docs/team-collaboration.7.md +4 -0
  95. package/docs/trust-audit-anchor.7.md +4 -0
  96. package/docs/web-desktop-workbench.7.md +26 -2
  97. package/docs/workflow-app-framework.7.md +31 -0
  98. package/manifest/plugin.manifest.json +1 -1
  99. package/manifest/source-context-profiles.json +4 -3
  100. package/package.json +5 -2
  101. package/scripts/agents/agent-adapter-core.js +26 -0
  102. package/scripts/agents/claude-p-agent.js +4 -1
  103. package/scripts/agents/codex-agent.js +4 -0
  104. package/scripts/agents/cw-attest-wrap.js +1 -1
  105. package/scripts/agents/gemini-agent.js +4 -0
  106. package/scripts/agents/opencode-agent.js +5 -0
  107. package/scripts/block-unapproved-tag.js +160 -0
  108. package/scripts/bump-version.js +27 -10
  109. package/scripts/canonical-apps.js +4 -4
  110. package/scripts/children/batch-delegate-child.js +72 -4
  111. package/scripts/children/http-batch-delegate-child.js +132 -0
  112. package/scripts/children/http-delegate-child.js +8 -0
  113. package/scripts/dogfood-release.js +2 -2
  114. package/scripts/fake-date-for-reproduction.js +1 -1
  115. package/scripts/golden-path.js +4 -4
  116. package/scripts/lang-policy-check.js +82 -0
  117. package/scripts/purity-baseline.json +0 -30
  118. package/scripts/purity-gate.js +16 -3
  119. package/scripts/release-check.js +2 -1
  120. package/scripts/release-flow.js +264 -41
  121. package/scripts/release-gate.js +184 -0
  122. package/scripts/release-oneclick.js +438 -0
  123. package/scripts/release-tags.js +47 -0
  124. package/scripts/verdict-keygen.js +2 -2
  125. package/scripts/verify-bump-reproduction.js +193 -0
  126. package/scripts/verify-verdict-signature.js +1 -1
  127. package/scripts/version-sync-check.js +39 -22
  128. package/ui/workbench/app.css +41 -9
  129. package/ui/workbench/app.js +160 -27
  130. package/ui/workbench/index.html +2 -2
  131. package/docs/agent-framework.md +0 -177
  132. package/docs/designs/handoff-ledger.md +0 -145
  133. package/docs/dogfood/resume-drive-real-agent-2026-06-14.md +0 -40
  134. package/docs/launch/launch-kit.md +0 -195
  135. package/docs/launch/pre-launch-checklist.md +0 -53
  136. package/docs/readme-v0.1.87-full.md +0 -301
  137. package/docs/routines.md +0 -101
  138. package/docs/scheduled-tasks.md +0 -80
  139. package/scripts/agents/claude-p-agent.sh +0 -9
  140. package/scripts/block-unapproved-tag.sh +0 -60
  141. package/scripts/release-gate.sh +0 -94
  142. package/scripts/verify-bump-reproduction.sh +0 -148
  143. package/scripts/verify-container-selfref.js +0 -64
@@ -7,7 +7,7 @@
7
7
  // (extracted with sed, not retyped).
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const registry_core_1 = require("./registry-core");
10
- const io_1 = require("../../cli/io");
10
+ const cli_args_1 = require("../../core/util/cli-args");
11
11
  // MILESTONE 10 (scheduling, registry, gc/reclamation, orphans, clones)
12
12
  // CLI bindings: schedule *, cw loop, routine *, sched *, registry *,
13
13
  // queue *, gc *, orphans *, clones *, run search|list|show|resume|
@@ -58,17 +58,17 @@ function firstPositionalArg(args, index = 0) {
58
58
  case "list":
59
59
  return { json: registryCli.scheduleListCli(args.options) };
60
60
  case "delete":
61
- return { json: registryCli.scheduleDeleteCli((0, io_1.required)(id, "schedule id"), args.options) };
61
+ return { json: registryCli.scheduleDeleteCli((0, cli_args_1.required)(id, "schedule id"), args.options) };
62
62
  case "due":
63
63
  return { json: registryCli.scheduleDueCli(args.options) };
64
64
  case "complete":
65
- return { json: registryCli.scheduleCompleteCli((0, io_1.required)(id, "schedule id"), args.options) };
65
+ return { json: registryCli.scheduleCompleteCli((0, cli_args_1.required)(id, "schedule id"), args.options) };
66
66
  case "pause":
67
- return { json: registryCli.schedulePauseCli((0, io_1.required)(id, "schedule id"), args.options) };
67
+ return { json: registryCli.schedulePauseCli((0, cli_args_1.required)(id, "schedule id"), args.options) };
68
68
  case "resume":
69
- return { json: registryCli.scheduleResumeCli((0, io_1.required)(id, "schedule id"), args.options) };
69
+ return { json: registryCli.scheduleResumeCli((0, cli_args_1.required)(id, "schedule id"), args.options) };
70
70
  case "run-now":
71
- return { json: registryCli.scheduleRunNowCli((0, io_1.required)(id, "schedule id"), args.options) };
71
+ return { json: registryCli.scheduleRunNowCli((0, cli_args_1.required)(id, "schedule id"), args.options) };
72
72
  case "history":
73
73
  return { json: registryCli.scheduleHistoryCli(id, args.options) };
74
74
  case "daemon": {
@@ -76,8 +76,14 @@ function firstPositionalArg(args, index = 0) {
76
76
  return { json: registryCli.scheduleDaemonTickCli(args.options) };
77
77
  // Never returns (matches the old build's forever daemon loop);
78
78
  // the process stays alive via the DesktopSchedulerDaemon's own
79
- // setInterval, printing one tick line per interval.
80
- void registryCli.scheduleDaemonRunForever(args.options);
79
+ // setInterval, printing one tick line per interval. The daemon's
80
+ // run() already guards each tick and fails closed with a `cw:`
81
+ // line; this .catch is a backstop against any unguarded throw so
82
+ // it can never surface as an unhandled-rejection stack dump.
83
+ void registryCli.scheduleDaemonRunForever(args.options).catch((error) => {
84
+ process.stderr.write(`cw: ${error instanceof Error ? error.message : String(error)}\n`);
85
+ process.exitCode = 1;
86
+ });
81
87
  return {};
82
88
  }
83
89
  default:
@@ -92,12 +98,12 @@ function firstPositionalArg(args, index = 0) {
92
98
  registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.create").mcp.handler = (args) => loadRegistryCli().scheduleCreateCli(args);
93
99
  registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.list").mcp.handler = (args) => loadRegistryCli().scheduleListCli(args);
94
100
  registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.due").mcp.handler = (args) => loadRegistryCli().scheduleDueCli(args);
95
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.complete").mcp.handler = (args) => loadRegistryCli().scheduleCompleteCli((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
96
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.pause").mcp.handler = (args) => loadRegistryCli().schedulePauseCli((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
97
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.resume").mcp.handler = (args) => loadRegistryCli().scheduleResumeCli((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
98
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.run-now").mcp.handler = (args) => loadRegistryCli().scheduleRunNowCli((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
99
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.history").mcp.handler = (args) => loadRegistryCli().scheduleHistoryCli((0, io_1.optionalArg)(args.id), args);
100
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.delete").mcp.handler = (args) => loadRegistryCli().scheduleDeleteCli((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
101
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.complete").mcp.handler = (args) => loadRegistryCli().scheduleCompleteCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.id), "schedule id"), args);
102
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.pause").mcp.handler = (args) => loadRegistryCli().schedulePauseCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.id), "schedule id"), args);
103
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.resume").mcp.handler = (args) => loadRegistryCli().scheduleResumeCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.id), "schedule id"), args);
104
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.run-now").mcp.handler = (args) => loadRegistryCli().scheduleRunNowCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.id), "schedule id"), args);
105
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.history").mcp.handler = (args) => loadRegistryCli().scheduleHistoryCli((0, cli_args_1.optionalArg)(args.id), args);
106
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.delete").mcp.handler = (args) => loadRegistryCli().scheduleDeleteCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.id), "schedule id"), args);
101
107
  // Each `schedule <verb>` sub-action is its own two-token cli row (found
102
108
  // before the ["schedule"] catch-all per the reversed candidate order), so
103
109
  // each capability is a real both-surface dual-bound row. Same shell fns and
@@ -106,12 +112,12 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.delete").mcp.handler = (arg
106
112
  // literal COMMAND_HELP_ROWS.schedule block.
107
113
  (0, registry_core_1.attachCliBinding)("schedule.create", { path: ["schedule", "create"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleCreateCli(args.options) }) });
108
114
  (0, registry_core_1.attachCliBinding)("schedule.list", { path: ["schedule", "list"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleListCli(args.options) }) });
109
- (0, registry_core_1.attachCliBinding)("schedule.delete", { path: ["schedule", "delete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleDeleteCli((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
115
+ (0, registry_core_1.attachCliBinding)("schedule.delete", { path: ["schedule", "delete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleDeleteCli((0, cli_args_1.required)(args.positionals[0], "schedule id"), args.options) }) });
110
116
  (0, registry_core_1.attachCliBinding)("schedule.due", { path: ["schedule", "due"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleDueCli(args.options) }) });
111
- (0, registry_core_1.attachCliBinding)("schedule.complete", { path: ["schedule", "complete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleCompleteCli((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
112
- (0, registry_core_1.attachCliBinding)("schedule.pause", { path: ["schedule", "pause"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().schedulePauseCli((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
113
- (0, registry_core_1.attachCliBinding)("schedule.resume", { path: ["schedule", "resume"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleResumeCli((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
114
- (0, registry_core_1.attachCliBinding)("schedule.run-now", { path: ["schedule", "run-now"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleRunNowCli((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
117
+ (0, registry_core_1.attachCliBinding)("schedule.complete", { path: ["schedule", "complete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleCompleteCli((0, cli_args_1.required)(args.positionals[0], "schedule id"), args.options) }) });
118
+ (0, registry_core_1.attachCliBinding)("schedule.pause", { path: ["schedule", "pause"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().schedulePauseCli((0, cli_args_1.required)(args.positionals[0], "schedule id"), args.options) }) });
119
+ (0, registry_core_1.attachCliBinding)("schedule.resume", { path: ["schedule", "resume"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleResumeCli((0, cli_args_1.required)(args.positionals[0], "schedule id"), args.options) }) });
120
+ (0, registry_core_1.attachCliBinding)("schedule.run-now", { path: ["schedule", "run-now"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleRunNowCli((0, cli_args_1.required)(args.positionals[0], "schedule id"), args.options) }) });
115
121
  (0, registry_core_1.attachCliBinding)("schedule.history", { path: ["schedule", "history"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleHistoryCli(args.positionals[0], args.options) }) });
116
122
  // ---- routine ------------------------------------------------------------
117
123
  (0, registry_core_1.addCliOnlyCapability)("routine", "cw routine create|list|delete|fire|events — API/GitHub-style triggers.", {
@@ -127,9 +133,9 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.delete").mcp.handler = (arg
127
133
  case "list":
128
134
  return { json: registryCli.routineListCli(args.options) };
129
135
  case "delete":
130
- return { json: registryCli.routineDeleteCli((0, io_1.required)(idOrKind, "trigger id"), args.options) };
136
+ return { json: registryCli.routineDeleteCli((0, cli_args_1.required)(idOrKind, "trigger id"), args.options) };
131
137
  case "fire": {
132
- const kind = (0, io_1.required)(idOrKind, "trigger kind");
138
+ const kind = (0, cli_args_1.required)(idOrKind, "trigger kind");
133
139
  const payload = registryCli.resolveRoutineFirePayload(payloadPath, args.options);
134
140
  return { json: registryCli.routineFireCli(kind, payload, args.options) };
135
141
  }
@@ -142,9 +148,9 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.delete").mcp.handler = (arg
142
148
  }, "cw routine is the API/GitHub-style trigger bridge; SPEC/mcp.md declares its MCP peers per verb (cw_routine_*), each wired below.");
143
149
  registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.create").mcp.handler = (args) => loadRegistryCli().routineCreateCli(args);
144
150
  registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.list").mcp.handler = (args) => loadRegistryCli().routineListCli(args);
145
- registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.delete").mcp.handler = (args) => loadRegistryCli().routineDeleteCli((0, io_1.required)((0, io_1.optionalArg)(args.id), "trigger id"), args);
146
- registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.fire").mcp.handler = (args) => loadRegistryCli().routineFireCli((0, io_1.required)((0, io_1.optionalArg)(args.kind), "trigger kind"), args.payload, args);
147
- registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.events").mcp.handler = (args) => loadRegistryCli().routineEventsCli((0, io_1.optionalArg)(args.id), args);
151
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.delete").mcp.handler = (args) => loadRegistryCli().routineDeleteCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.id), "trigger id"), args);
152
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.fire").mcp.handler = (args) => loadRegistryCli().routineFireCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.kind), "trigger kind"), args.payload, args);
153
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.events").mcp.handler = (args) => loadRegistryCli().routineEventsCli((0, cli_args_1.optionalArg)(args.id), args);
148
154
  // Each `routine <verb>` sub-action is its own two-token cli row. The
149
155
  // catch-all read [subcommand, idOrKind, payloadPath], so after the
150
156
  // dispatcher consumes the sub-verb positionals[0]=idOrKind,
@@ -152,13 +158,13 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.events").mcp.handler = (args
152
158
  // rows coming from the single literal COMMAND_HELP_ROWS.routine block.
153
159
  (0, registry_core_1.attachCliBinding)("routine.create", { path: ["routine", "create"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().routineCreateCli(args.options) }) });
154
160
  (0, registry_core_1.attachCliBinding)("routine.list", { path: ["routine", "list"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().routineListCli(args.options) }) });
155
- (0, registry_core_1.attachCliBinding)("routine.delete", { path: ["routine", "delete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().routineDeleteCli((0, io_1.required)(args.positionals[0], "trigger id"), args.options) }) });
161
+ (0, registry_core_1.attachCliBinding)("routine.delete", { path: ["routine", "delete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().routineDeleteCli((0, cli_args_1.required)(args.positionals[0], "trigger id"), args.options) }) });
156
162
  (0, registry_core_1.attachCliBinding)("routine.fire", {
157
163
  path: ["routine", "fire"],
158
164
  jsonMode: "default",
159
165
  hiddenFromHelp: true,
160
166
  handler: (args) => {
161
- const kind = (0, io_1.required)(args.positionals[0], "trigger kind");
167
+ const kind = (0, cli_args_1.required)(args.positionals[0], "trigger kind");
162
168
  const payloadPath = args.positionals[1];
163
169
  const registryCli = loadRegistryCli();
164
170
  const payload = registryCli.resolveRoutineFirePayload(payloadPath, args.options);
@@ -261,7 +267,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args)
261
267
  hiddenFromHelp: true,
262
268
  handler: (args) => {
263
269
  const report = loadRegistryCli().registryRefreshCli(args.options);
264
- return (0, io_1.wantsJson)(args.options) ? { json: report } : { json: report, text: loadRunRegistryIo().formatRegistryReport(report) };
270
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: report } : { json: report, text: loadRunRegistryIo().formatRegistryReport(report) };
265
271
  },
266
272
  });
267
273
  (0, registry_core_1.attachCliBinding)("registry.show", {
@@ -270,7 +276,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args)
270
276
  hiddenFromHelp: true,
271
277
  handler: (args) => {
272
278
  const report = loadRegistryCli().registryShowCli(args.options);
273
- return (0, io_1.wantsJson)(args.options) ? { json: report } : { json: report, text: loadRunRegistryIo().formatRegistryReport(report) };
279
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: report } : { json: report, text: loadRunRegistryIo().formatRegistryReport(report) };
274
280
  },
275
281
  });
276
282
  // ---- queue (add|list|drain|show) ----------------------------------------
@@ -286,12 +292,12 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args)
286
292
  return { json: registryCli.queueAddCli(args.options) };
287
293
  case "list": {
288
294
  const result = registryCli.queueListCli(args.options);
289
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadRunRegistryIo().formatQueueList(result) };
295
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadRunRegistryIo().formatQueueList(result) };
290
296
  }
291
297
  case "drain":
292
298
  return { json: registryCli.queueDrainCli(args.options) };
293
299
  case "show":
294
- return { json: registryCli.queueShowCli((0, io_1.required)(id, "queue id"), args.options) };
300
+ return { json: registryCli.queueShowCli((0, cli_args_1.required)(id, "queue id"), args.options) };
295
301
  default:
296
302
  throw new Error("Usage: cw queue add|list|drain|show [queue-id] [--repo PATH] [--priority N]");
297
303
  }
@@ -300,7 +306,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args)
300
306
  registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.add").mcp.handler = (args) => loadRegistryCli().queueAddCli(args);
301
307
  registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.list").mcp.handler = (args) => loadRegistryCli().queueListCli(args);
302
308
  registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.drain").mcp.handler = (args) => loadRegistryCli().queueDrainCli(args);
303
- registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.show").mcp.handler = (args) => loadRegistryCli().queueShowCli((0, io_1.required)((0, io_1.optionalArg)(args.id), "queue id"), args);
309
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.show").mcp.handler = (args) => loadRegistryCli().queueShowCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.id), "queue id"), args);
304
310
  // `queue add|list|drain|show` each carry their own two-token cli.path
305
311
  // (found before the ["queue"] catch-all). `hiddenFromHelp` keeps `cw help
306
312
  // queue`'s rows coming from the single literal COMMAND_HELP_ROWS.queue
@@ -318,7 +324,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.show").mcp.handler = (args) =>
318
324
  hiddenFromHelp: true,
319
325
  handler: (args) => {
320
326
  const result = loadRegistryCli().queueListCli(args.options);
321
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadRunRegistryIo().formatQueueList(result) };
327
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadRunRegistryIo().formatQueueList(result) };
322
328
  },
323
329
  });
324
330
  (0, registry_core_1.attachCliBinding)("queue.drain", {
@@ -331,10 +337,10 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.show").mcp.handler = (args) =>
331
337
  path: ["queue", "show"],
332
338
  jsonMode: "default",
333
339
  hiddenFromHelp: true,
334
- handler: (args) => ({ json: loadRegistryCli().queueShowCli((0, io_1.required)(args.positionals[0], "queue id"), args.options) }),
340
+ handler: (args) => ({ json: loadRegistryCli().queueShowCli((0, cli_args_1.required)(args.positionals[0], "queue id"), args.options) }),
335
341
  });
336
342
  // ---- gc (plan|run|verify) ------------------------------------------------
337
- (0, registry_core_1.addCliOnlyCapability)("gc", "cw gc plan|run|verify [run-id] [--reclaimAfterArchiveDays N] [--keep-scratch] [--keep-snapshots] [--limit N] [--json] — run retention & provable reclamation.", {
343
+ (0, registry_core_1.addCliOnlyCapability)("gc", "cw gc plan|run|verify [run-id] [--reclaimAfterArchiveDays N] [--keep-scratch] [--keep-snapshots] [--keep-commits] [--limit N] [--json] — run retention & provable reclamation.", {
338
344
  path: ["gc"],
339
345
  jsonMode: "flag",
340
346
  hiddenFromHelp: true,
@@ -345,25 +351,25 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.show").mcp.handler = (args) =>
345
351
  switch (subcommand) {
346
352
  case "plan": {
347
353
  const result = registryCli.gcPlanCli(id, args.options);
348
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatGcPlan(result) };
354
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatGcPlan(result) };
349
355
  }
350
356
  case "run": {
351
357
  const result = registryCli.gcRunCli(id, args.options);
352
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatGcRun(result) };
358
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatGcRun(result) };
353
359
  }
354
360
  case "verify": {
355
- const result = registryCli.gcVerifyCli((0, io_1.required)(id, "run id"), args.options);
361
+ const result = registryCli.gcVerifyCli((0, cli_args_1.required)(id, "run id"), args.options);
356
362
  const text = reclamationIo.formatGcVerify(result);
357
363
  return { json: result, text, exitCode: result.reclaimed && !result.verified ? 1 : undefined };
358
364
  }
359
365
  default:
360
- throw new Error("Usage: cw gc plan|run|verify [run-id] [--reclaimAfterArchiveDays N] [--keep-scratch] [--keep-snapshots] [--limit N] [--json]");
366
+ throw new Error("Usage: cw gc plan|run|verify [run-id] [--reclaimAfterArchiveDays N] [--keep-scratch] [--keep-snapshots] [--keep-commits] [--limit N] [--json]");
361
367
  }
362
368
  },
363
369
  }, "cw gc is run retention & provable reclamation; SPEC/mcp.md declares its MCP peers (cw_gc_plan|run|verify), each wired below.");
364
- registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.plan").mcp.handler = (args) => loadRegistryCli().gcPlanCli((0, io_1.optionalArg)(args.runId), args);
365
- registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").mcp.handler = (args) => loadRegistryCli().gcRunCli((0, io_1.optionalArg)(args.runId), args);
366
- registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.verify").mcp.handler = (args) => loadRegistryCli().gcVerifyCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
370
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.plan").mcp.handler = (args) => loadRegistryCli().gcPlanCli((0, cli_args_1.optionalArg)(args.runId), args);
371
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").mcp.handler = (args) => loadRegistryCli().gcRunCli((0, cli_args_1.optionalArg)(args.runId), args);
372
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.verify").mcp.handler = (args) => loadRegistryCli().gcVerifyCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
367
373
  // PARITY: `gc.run` frees disk and appends a tombstone; both surfaces run
368
374
  // the identical transaction but the payload reports now-derived
369
375
  // bytesFreed/tombstone, so it is a documented opt-out, not drift.
@@ -392,7 +398,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").reason =
392
398
  hiddenFromHelp: true,
393
399
  handler: (args) => {
394
400
  const result = loadRegistryCli().gcPlanCli(args.positionals[0], args.options);
395
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatGcPlan(result) };
401
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatGcPlan(result) };
396
402
  },
397
403
  });
398
404
  (0, registry_core_1.attachCliBinding)("gc.verify", {
@@ -400,7 +406,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").reason =
400
406
  jsonMode: "flag",
401
407
  hiddenFromHelp: true,
402
408
  handler: (args) => {
403
- const result = loadRegistryCli().gcVerifyCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
409
+ const result = loadRegistryCli().gcVerifyCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options);
404
410
  const text = loadReclamationIo().formatGcVerify(result);
405
411
  return { json: result, text, exitCode: result.reclaimed && !result.verified ? 1 : undefined };
406
412
  },
@@ -417,7 +423,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").reason =
417
423
  hiddenFromHelp: true,
418
424
  handler: (args) => {
419
425
  const result = loadRegistryCli().gcRunCli(args.positionals[0], args.options);
420
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatGcRun(result) };
426
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatGcRun(result) };
421
427
  },
422
428
  });
423
429
  // ---- orphans (list|gc) ---------------------------------------------------
@@ -432,11 +438,11 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").reason =
432
438
  switch (subcommand) {
433
439
  case "list": {
434
440
  const result = registryCli.orphansListCli(args.options);
435
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatOrphanRunsList(result) };
441
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatOrphanRunsList(result) };
436
442
  }
437
443
  case "gc": {
438
444
  const result = registryCli.orphansGcCli(args.options);
439
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatOrphanRunsGc(result) };
445
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatOrphanRunsGc(result) };
440
446
  }
441
447
  default:
442
448
  throw new Error("Usage: cw orphans list [--scope repo|home] [--json] | orphans gc [--scope repo|home] [--min-age-minutes N] [--all] [--json] (scope defaults to home: every registered repo)");
@@ -458,7 +464,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").mcp.handler = (args) =>
458
464
  hiddenFromHelp: true,
459
465
  handler: (args) => {
460
466
  const result = loadRegistryCli().orphansListCli(args.options);
461
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatOrphanRunsList(result) };
467
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatOrphanRunsList(result) };
462
468
  },
463
469
  });
464
470
  (0, registry_core_1.attachCliBinding)("orphans.gc", {
@@ -467,7 +473,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").mcp.handler = (args) =>
467
473
  hiddenFromHelp: true,
468
474
  handler: (args) => {
469
475
  const result = loadRegistryCli().orphansGcCli(args.options);
470
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatOrphanRunsGc(result) };
476
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatOrphanRunsGc(result) };
471
477
  },
472
478
  });
473
479
  registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").payloadIdentical = false;
@@ -485,11 +491,11 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").reason =
485
491
  switch (subcommand) {
486
492
  case "list": {
487
493
  const result = registryCli.clonesListCli();
488
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatClonesList(result) };
494
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatClonesList(result) };
489
495
  }
490
496
  case "gc": {
491
497
  const result = registryCli.clonesGcCli(args.options);
492
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatClonesGc(result) };
498
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatClonesGc(result) };
493
499
  }
494
500
  default:
495
501
  throw new Error("Usage: cw clones list [--json] | clones gc [--older-than-days N] [--all] [--json]");
@@ -509,7 +515,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").mcp.handler = (args) =>
509
515
  hiddenFromHelp: true,
510
516
  handler: (args) => {
511
517
  const result = loadRegistryCli().clonesListCli();
512
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatClonesList(result) };
518
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatClonesList(result) };
513
519
  },
514
520
  });
515
521
  (0, registry_core_1.attachCliBinding)("clones.gc", {
@@ -518,7 +524,7 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").mcp.handler = (args) =>
518
524
  hiddenFromHelp: true,
519
525
  handler: (args) => {
520
526
  const result = loadRegistryCli().clonesGcCli(args.options);
521
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatClonesGc(result) };
527
+ return (0, cli_args_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatClonesGc(result) };
522
528
  },
523
529
  });
524
530
  registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").payloadIdentical = false;
@@ -550,35 +556,35 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.list").mcp.handler = (args) => l
550
556
  path: ["run", "show"],
551
557
  jsonMode: "flag",
552
558
  handler: (args) => {
553
- const runId = (0, io_1.required)(args.positionals[0], "run id");
559
+ const runId = (0, cli_args_1.required)(args.positionals[0], "run id");
554
560
  const result = loadRegistryCli().runShowCli(runId, args.options);
555
561
  return { json: result, text: loadRunRegistryIo().formatRunShow(result) };
556
562
  },
557
563
  });
558
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.show").mcp.handler = (args) => loadRegistryCli().runShowCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
564
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.show").mcp.handler = (args) => loadRegistryCli().runShowCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
559
565
  (0, registry_core_1.attachCliBinding)("run.resume", {
560
566
  path: ["run", "resume"],
561
567
  jsonMode: "flag",
562
568
  handler: async (args) => {
563
- const runId = (0, io_1.required)(args.positionals[0], "run id");
569
+ const runId = (0, cli_args_1.required)(args.positionals[0], "run id");
564
570
  const runRegistryIo = loadRunRegistryIo();
565
571
  const result = await loadRegistryCli().runResumeCli(runId, args.options);
566
572
  return { json: result, text: runRegistryIo.formatResume(result) };
567
573
  },
568
574
  });
569
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.resume").mcp.handler = (args) => loadRegistryCli().runResumeCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
575
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.resume").mcp.handler = (args) => loadRegistryCli().runResumeCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
570
576
  (0, registry_core_1.attachCliBinding)("run.archive", {
571
577
  path: ["run", "archive"],
572
578
  jsonMode: "default",
573
- handler: (args) => ({ json: loadRegistryCli().runArchiveCli((0, io_1.optionalArg)(args.positionals[0]), args.options) }),
579
+ handler: (args) => ({ json: loadRegistryCli().runArchiveCli((0, cli_args_1.optionalArg)(args.positionals[0]), args.options) }),
574
580
  });
575
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.archive").mcp.handler = (args) => loadRegistryCli().runArchiveCli((0, io_1.optionalArg)(args.runId), args);
581
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.archive").mcp.handler = (args) => loadRegistryCli().runArchiveCli((0, cli_args_1.optionalArg)(args.runId), args);
576
582
  (0, registry_core_1.attachCliBinding)("run.rerun", {
577
583
  path: ["run", "rerun"],
578
584
  jsonMode: "default",
579
- handler: (args) => ({ json: loadRegistryCli().runRerunCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
585
+ handler: (args) => ({ json: loadRegistryCli().runRerunCli((0, cli_args_1.required)(args.positionals[0], "run id"), args.options) }),
580
586
  });
581
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.rerun").mcp.handler = (args) => loadRegistryCli().runRerunCli((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
587
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.rerun").mcp.handler = (args) => loadRegistryCli().runRerunCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
582
588
  // ---- history ---------------------------------------------------------
583
589
  (0, registry_core_1.attachCliBinding)("history", {
584
590
  path: ["history"],
@@ -6,7 +6,7 @@
6
6
  // (extracted with sed, not retyped).
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const registry_core_1 = require("./registry-core");
9
- const io_1 = require("../../cli/io");
9
+ const cli_args_1 = require("../../core/util/cli-args");
10
10
  // This slice is required unconditionally at startup for every command;
11
11
  // load these shell modules only when a handler that actually needs them runs.
12
12
  function loadReportViewCli() {
@@ -23,17 +23,17 @@ function loadStateExplosionCli() {
23
23
  // Handler BODIES live in shell/state-cli.ts (impure — they read/write
24
24
  // run state on disk); this table only wires argv shape -> handler call
25
25
  // and the row's own exit-code rule, per cli/dispatch.ts's generic
26
- // executor contract. `required`/`optionalArg` are cli/io.ts's shared
27
- // coercion helpers, imported here so the wiring stays a thin adapter
26
+ // executor contract. `required`/`optionalArg` are core/util/cli-args.ts's
27
+ // shared coercion helpers, imported here so the wiring stays a thin adapter
28
28
  // (Usage-error strings copied byte-for-byte from the old build's
29
29
  // handlers/*.ts).
30
30
  // ---------------------------------------------------------------------
31
- const io_2 = require("../../cli/io");
31
+ const cli_args_2 = require("../../core/util/cli-args");
32
32
  (0, registry_core_1.attachCliBinding)("state.check", {
33
33
  path: ["state", "check"],
34
34
  jsonMode: "default",
35
35
  handler: (args) => {
36
- const runId = (0, io_2.required)(args.positionals[0], "run id");
36
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
37
37
  const report = loadStateCli().checkState(runId, args.options);
38
38
  return { json: report, exitCode: report.status === "unsupported" ? 1 : undefined };
39
39
  },
@@ -47,7 +47,7 @@ const io_2 = require("../../cli/io");
47
47
  path: ["migration", "check"],
48
48
  jsonMode: "default",
49
49
  handler: (args) => {
50
- const target = (0, io_2.required)(args.positionals[0], "target (run-id or state/app file)");
50
+ const target = (0, cli_args_2.required)(args.positionals[0], "target (run-id or state/app file)");
51
51
  const report = loadStateCli().migrationCheck(target, args.options);
52
52
  return { json: report, exitCode: report.status === "unsupported" ? 1 : undefined };
53
53
  },
@@ -56,7 +56,7 @@ const io_2 = require("../../cli/io");
56
56
  path: ["migration", "prove"],
57
57
  jsonMode: "default",
58
58
  handler: (args) => {
59
- const target = (0, io_2.required)(args.positionals[0], "target (run-id or state/app file)");
59
+ const target = (0, cli_args_2.required)(args.positionals[0], "target (run-id or state/app file)");
60
60
  const proof = loadStateCli().migrationProve(target, args.options);
61
61
  return { json: proof, exitCode: proof.pass ? undefined : 1 };
62
62
  },
@@ -64,14 +64,14 @@ const io_2 = require("../../cli/io");
64
64
  (0, registry_core_1.attachCliBinding)("node.list", {
65
65
  path: ["node", "list"],
66
66
  jsonMode: "default",
67
- handler: (args) => ({ json: loadStateCli().listNodes((0, io_2.required)(args.positionals[0], "run id"), args.options) }),
67
+ handler: (args) => ({ json: loadStateCli().listNodes((0, cli_args_2.required)(args.positionals[0], "run id"), args.options) }),
68
68
  });
69
69
  (0, registry_core_1.attachCliBinding)("node.show", {
70
70
  path: ["node", "show"],
71
71
  jsonMode: "default",
72
72
  handler: (args) => {
73
- const runId = (0, io_2.required)(args.positionals[0], "run id");
74
- const nodeId = (0, io_2.required)(args.positionals[1], "node id");
73
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
74
+ const nodeId = (0, cli_args_2.required)(args.positionals[1], "node id");
75
75
  return { json: loadStateCli().showNode(runId, nodeId, args.options) };
76
76
  },
77
77
  });
@@ -82,7 +82,7 @@ const io_2 = require("../../cli/io");
82
82
  path: ["node", "graph"],
83
83
  jsonMode: "flag",
84
84
  handler: (args) => {
85
- const runId = (0, io_2.required)(args.positionals[0], "run id");
85
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
86
86
  return { json: loadStateCli().graphNodes(runId, args.options), text: `${loadReportViewCli().graphText(runId, args.options)}\n` };
87
87
  },
88
88
  });
@@ -90,8 +90,8 @@ const io_2 = require("../../cli/io");
90
90
  path: ["node", "snapshot"],
91
91
  jsonMode: "default",
92
92
  handler: (args) => {
93
- const runId = (0, io_2.required)(args.positionals[0], "run id");
94
- const nodeId = (0, io_2.required)(args.positionals[1], "node id");
93
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
94
+ const nodeId = (0, cli_args_2.required)(args.positionals[1], "node id");
95
95
  return { json: loadStateCli().nodeSnapshotCli(runId, nodeId, args.options) };
96
96
  },
97
97
  });
@@ -99,9 +99,9 @@ const io_2 = require("../../cli/io");
99
99
  path: ["node", "diff"],
100
100
  jsonMode: "default",
101
101
  handler: (args) => {
102
- const runId = (0, io_2.required)(args.positionals[0], "run id");
103
- const baselineSnapshotId = (0, io_2.required)(args.positionals[1], "baseline snapshot id");
104
- const candidateSnapshotId = (0, io_2.required)(args.positionals[2], "candidate snapshot id");
102
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
103
+ const baselineSnapshotId = (0, cli_args_2.required)(args.positionals[1], "baseline snapshot id");
104
+ const candidateSnapshotId = (0, cli_args_2.required)(args.positionals[2], "candidate snapshot id");
105
105
  return { json: loadStateCli().nodeDiffCli(runId, baselineSnapshotId, candidateSnapshotId, args.options) };
106
106
  },
107
107
  });
@@ -109,8 +109,8 @@ const io_2 = require("../../cli/io");
109
109
  path: ["node", "replay"],
110
110
  jsonMode: "default",
111
111
  handler: (args) => {
112
- const runId = (0, io_2.required)(args.positionals[0], "run id");
113
- const snapshotId = (0, io_2.required)(args.positionals[1], "snapshot id");
112
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
113
+ const snapshotId = (0, cli_args_2.required)(args.positionals[1], "snapshot id");
114
114
  return { json: loadStateCli().nodeReplayCli(runId, snapshotId, args.options) };
115
115
  },
116
116
  });
@@ -118,8 +118,8 @@ const io_2 = require("../../cli/io");
118
118
  path: ["node", "verify"],
119
119
  jsonMode: "default",
120
120
  handler: (args) => {
121
- const runId = (0, io_2.required)(args.positionals[0], "run id");
122
- const replayId = (0, io_2.required)(args.positionals[1], "replay id");
121
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
122
+ const replayId = (0, cli_args_2.required)(args.positionals[1], "replay id");
123
123
  const verdict = loadStateCli().nodeReplayVerifyCli(runId, replayId, args.options);
124
124
  return { json: verdict, exitCode: verdict.pass ? undefined : 1 };
125
125
  },
@@ -127,17 +127,17 @@ const io_2 = require("../../cli/io");
127
127
  // GAP #24: mirror the state-kernel CLI shell fns as MCP handlers (they were
128
128
  // declared MCP tool rows but left on notYetImplemented). Arg-name reads copied
129
129
  // byte-for-byte from the old build's mcp/tool-call.ts switch arms.
130
- registry_core_1.REGISTRY_BY_CAPABILITY.get("state.check").mcp.handler = (args) => loadStateCli().checkState((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
130
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("state.check").mcp.handler = (args) => loadStateCli().checkState((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
131
131
  registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.list").mcp.handler = () => loadStateCli().migrationList();
132
- registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.check").mcp.handler = (args) => loadStateCli().migrationCheck((0, io_2.required)((0, io_1.optionalArg)(args.target ?? args.runId), "target (run-id or state/app file)"), args);
133
- registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.prove").mcp.handler = (args) => loadStateCli().migrationProve((0, io_2.required)((0, io_1.optionalArg)(args.target ?? args.runId), "target (run-id or state/app file)"), args);
134
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.list").mcp.handler = (args) => loadStateCli().listNodes((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
135
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.show").mcp.handler = (args) => loadStateCli().showNode((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.nodeId), "node id"), args);
136
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.graph").mcp.handler = (args) => loadStateCli().graphNodes((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
137
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.snapshot").mcp.handler = (args) => loadStateCli().nodeSnapshotCli((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.nodeId), "node id"), args);
138
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.diff").mcp.handler = (args) => loadStateCli().nodeDiffCli((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.baselineSnapshotId ?? args.baseline), "baseline snapshot id"), (0, io_2.required)((0, io_1.optionalArg)(args.candidateSnapshotId ?? args.candidate), "candidate snapshot id"), args);
139
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay").mcp.handler = (args) => loadStateCli().nodeReplayCli((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.snapshotId), "snapshot id"), args);
140
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay.verify").mcp.handler = (args) => loadStateCli().nodeReplayVerifyCli((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.replayId), "replay id"), args);
132
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.check").mcp.handler = (args) => loadStateCli().migrationCheck((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.target ?? args.runId), "target (run-id or state/app file)"), args);
133
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.prove").mcp.handler = (args) => loadStateCli().migrationProve((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.target ?? args.runId), "target (run-id or state/app file)"), args);
134
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.list").mcp.handler = (args) => loadStateCli().listNodes((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
135
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.show").mcp.handler = (args) => loadStateCli().showNode((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.nodeId), "node id"), args);
136
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.graph").mcp.handler = (args) => loadStateCli().graphNodes((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
137
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.snapshot").mcp.handler = (args) => loadStateCli().nodeSnapshotCli((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.nodeId), "node id"), args);
138
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.diff").mcp.handler = (args) => loadStateCli().nodeDiffCli((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.baselineSnapshotId ?? args.baseline), "baseline snapshot id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.candidateSnapshotId ?? args.candidate), "candidate snapshot id"), args);
139
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay").mcp.handler = (args) => loadStateCli().nodeReplayCli((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.snapshotId), "snapshot id"), args);
140
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay.verify").mcp.handler = (args) => loadStateCli().nodeReplayVerifyCli((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.replayId), "replay id"), args);
141
141
  // `contract.show` is not yet a declared MCP_TOOL_DATA row with a CLI peer
142
142
  // wired here (it IS in MCP_TOOL_DATA already); no milestone-3 conformance
143
143
  // case reaches it, so it is intentionally left on its placeholder handler
@@ -152,19 +152,19 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay.verify").mcp.handler = (
152
152
  // "flag" — text by default, JSON under --json/--format json).
153
153
  // ---------------------------------------------------------------------
154
154
  const state_explosion_text_1 = require("../../core/format/state-explosion-text");
155
- const io_3 = require("../../cli/io");
155
+ const cli_args_3 = require("../../core/util/cli-args");
156
156
  (0, registry_core_1.attachCliBinding)("summary.refresh", {
157
157
  path: ["summary", "refresh"],
158
158
  jsonMode: "flag",
159
159
  handler: (args) => {
160
- const runId = (0, io_2.required)(args.positionals[0], "run id");
160
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
161
161
  const index = loadStateExplosionCli().summaryRefreshCli(runId, args.options);
162
162
  // Byte-exact port of the old build's handleSummary "refresh": the
163
163
  // human-text branch re-reads via a fresh summaryShow call rather than
164
164
  // formatting the refresh's own index record (src/cli/handlers/
165
165
  // operator.ts:118-127); only computed when actually needed, so a
166
166
  // --json call does exactly the one read the old build's if/else did.
167
- if ((0, io_3.wantsJson)(args.options))
167
+ if ((0, cli_args_3.wantsJson)(args.options))
168
168
  return { json: index };
169
169
  return { json: index, text: (0, state_explosion_text_1.formatStateExplosionReport)(loadStateExplosionCli().summaryShowCli(runId, args.options)) };
170
170
  },
@@ -173,7 +173,7 @@ const io_3 = require("../../cli/io");
173
173
  path: ["summary", "show"],
174
174
  jsonMode: "flag",
175
175
  handler: (args) => {
176
- const runId = (0, io_2.required)(args.positionals[0], "run id");
176
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
177
177
  const report = loadStateExplosionCli().summaryShowCli(runId, args.options);
178
178
  return { json: report, text: (0, state_explosion_text_1.formatStateExplosionReport)(report) };
179
179
  },