cool-workflow 0.2.2 → 0.2.3

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 (136) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/apps/architecture-review/app.json +1 -1
  4. package/apps/architecture-review-fast/app.json +1 -1
  5. package/apps/end-to-end-golden-path/app.json +1 -1
  6. package/apps/pr-review-fix-ci/app.json +1 -1
  7. package/apps/release-cut/app.json +1 -1
  8. package/apps/research-synthesis/app.json +1 -1
  9. package/dist/cli/dispatch.js +11 -5
  10. package/dist/cli/entry.js +41 -1
  11. package/dist/cli/io.js +6 -2
  12. package/dist/cli/parseargv.js +1 -0
  13. package/dist/core/capability-data.js +1 -0
  14. package/dist/core/format/completion.js +68 -0
  15. package/dist/core/format/help.js +25 -6
  16. package/dist/core/format/safe-json.js +73 -0
  17. package/dist/core/format/state-explosion-text.js +1 -1
  18. package/dist/core/multi-agent/candidate-scoring.js +5 -1
  19. package/dist/core/multi-agent/collaboration.js +3 -3
  20. package/dist/core/multi-agent/coordinator.js +5 -5
  21. package/dist/core/multi-agent/runtime.js +4 -4
  22. package/dist/core/multi-agent/topology.js +3 -3
  23. package/dist/core/pipeline/dispatch.js +18 -4
  24. package/dist/core/pipeline/drive-decide.js +2 -1
  25. package/dist/core/state/migrations.js +16 -1
  26. package/dist/core/state/state-explosion/digest.js +13 -13
  27. package/dist/core/state/state-explosion/graph.js +17 -11
  28. package/dist/core/state/state-explosion/report.js +6 -6
  29. package/dist/core/util/numeric-flag.js +40 -0
  30. package/dist/core/version.js +1 -1
  31. package/dist/mcp/server.js +99 -11
  32. package/dist/shell/audit-cli.js +57 -25
  33. package/dist/shell/coordinator-io.js +73 -13
  34. package/dist/shell/dispatch.js +1 -1
  35. package/dist/shell/doctor.js +80 -1
  36. package/dist/shell/drive.js +243 -49
  37. package/dist/shell/eval-text.js +2 -2
  38. package/dist/shell/evidence-reasoning.js +4 -4
  39. package/dist/shell/execution-backend/agent.js +20 -1
  40. package/dist/shell/execution-backend/container.js +4 -1
  41. package/dist/shell/execution-backend/local.js +4 -1
  42. package/dist/shell/feedback-cli.js +6 -6
  43. package/dist/shell/fs-atomic.js +218 -29
  44. package/dist/shell/man-cli.js +6 -0
  45. package/dist/shell/metrics-cli.js +2 -1
  46. package/dist/shell/multi-agent-cli.js +367 -323
  47. package/dist/shell/multi-agent-host.js +9 -9
  48. package/dist/shell/multi-agent-operator-ux.js +80 -38
  49. package/dist/shell/node-store.js +10 -4
  50. package/dist/shell/observability.js +1 -1
  51. package/dist/shell/operator-ux-text.js +22 -22
  52. package/dist/shell/operator-ux.js +15 -14
  53. package/dist/shell/orchestrator.js +49 -38
  54. package/dist/shell/pipeline-cli.js +87 -40
  55. package/dist/shell/reclamation-io.js +14 -4
  56. package/dist/shell/registry-cli.js +19 -17
  57. package/dist/shell/remote-source.js +13 -8
  58. package/dist/shell/report-cli.js +45 -0
  59. package/dist/shell/report.js +2 -1
  60. package/dist/shell/run-registry-io.js +77 -19
  61. package/dist/shell/run-store.js +74 -2
  62. package/dist/shell/scheduling-io.js +12 -13
  63. package/dist/shell/state-cli.js +2 -7
  64. package/dist/shell/state-explosion-cli.js +17 -9
  65. package/dist/shell/topology-io.js +36 -5
  66. package/dist/shell/trust-audit.js +224 -22
  67. package/dist/shell/trust-policy-io.js +1 -1
  68. package/dist/shell/worker-cli.js +35 -31
  69. package/dist/wiring/capability-table/basics.js +33 -8
  70. package/dist/wiring/capability-table/exec-backend.js +20 -11
  71. package/dist/wiring/capability-table/multi-agent.js +172 -165
  72. package/dist/wiring/capability-table/parity.js +1 -0
  73. package/dist/wiring/capability-table/pipeline.js +54 -42
  74. package/dist/wiring/capability-table/registry-core.js +29 -10
  75. package/dist/wiring/capability-table/reporting.js +137 -96
  76. package/dist/wiring/capability-table/scheduling-registry.js +195 -161
  77. package/dist/wiring/capability-table/state.js +36 -28
  78. package/dist/wiring/capability-table/trust-ledger.js +46 -22
  79. package/dist/wiring/capability-table/workflow-apps.js +83 -68
  80. package/docs/agent-delegation-drive.7.md +2 -0
  81. package/docs/candidate-scoring.7.md +1 -1
  82. package/docs/canonical-workflow-apps.7.md +7 -7
  83. package/docs/cli-mcp-parity.7.md +8 -3
  84. package/docs/contract-migration-tooling.7.md +2 -0
  85. package/docs/control-plane-scheduling.7.md +2 -0
  86. package/docs/coordinator-blackboard.7.md +17 -17
  87. package/docs/dogfood-one-real-repo.7.md +11 -11
  88. package/docs/durable-state-and-locking.7.md +2 -0
  89. package/docs/end-to-end-golden-path.7.md +14 -14
  90. package/docs/evidence-adoption-reasoning-chain.7.md +2 -0
  91. package/docs/execution-backends.7.md +2 -0
  92. package/docs/getting-started.md +37 -37
  93. package/docs/multi-agent-cli-mcp-surface.7.md +19 -17
  94. package/docs/multi-agent-eval-replay-harness.7.md +15 -13
  95. package/docs/multi-agent-operator-ux.7.md +21 -19
  96. package/docs/multi-agent-runtime-core.7.md +22 -22
  97. package/docs/multi-agent-topologies.7.md +6 -6
  98. package/docs/multi-agent-trust-policy-audit.7.md +11 -11
  99. package/docs/node-snapshot-diff-replay.7.md +2 -0
  100. package/docs/observability-cost-accounting.7.md +2 -0
  101. package/docs/operator-ux.7.md +34 -34
  102. package/docs/pipeline-runner.7.md +4 -4
  103. package/docs/project-index.md +27 -4
  104. package/docs/real-execution-backends.7.md +2 -0
  105. package/docs/release-and-migration.7.md +3 -1
  106. package/docs/release-tooling.7.md +2 -0
  107. package/docs/routines.md +4 -4
  108. package/docs/run-registry-control-plane.7.md +21 -19
  109. package/docs/run-retention-reclamation.7.md +2 -0
  110. package/docs/scheduled-tasks.md +14 -14
  111. package/docs/security-trust-hardening.7.md +15 -15
  112. package/docs/state-explosion-management.7.md +12 -10
  113. package/docs/team-collaboration.7.md +2 -0
  114. package/docs/trust-audit-anchor.7.md +2 -0
  115. package/docs/unix-principles.md +3 -1
  116. package/docs/verifier-gated-commit.7.md +1 -1
  117. package/docs/web-desktop-workbench.7.md +2 -0
  118. package/docs/workflow-app-framework.7.md +13 -13
  119. package/manifest/plugin.manifest.json +1 -1
  120. package/package.json +2 -2
  121. package/scripts/agents/claude-p-agent.js +2 -2
  122. package/scripts/block-unapproved-tag.sh +23 -2
  123. package/scripts/canonical-apps.js +4 -4
  124. package/scripts/children/batch-delegate-child.js +52 -2
  125. package/scripts/dogfood-release.js +1 -1
  126. package/scripts/fake-date-for-reproduction.js +44 -0
  127. package/scripts/golden-path.js +4 -4
  128. package/scripts/purity-baseline.json +3 -0
  129. package/scripts/release-flow.js +57 -1
  130. package/scripts/verdict-keygen.js +83 -0
  131. package/scripts/verify-bump-reproduction.sh +148 -0
  132. package/scripts/verify-verdict-signature.js +61 -0
  133. package/skills/cool-workflow/SKILL.md +9 -9
  134. package/skills/cool-workflow/references/commands.md +89 -88
  135. package/ui/workbench/app.css +37 -1
  136. package/ui/workbench/app.js +124 -6
@@ -19,10 +19,23 @@ const io_1 = require("../../cli/io");
19
19
  // the old build's handlers/{scheduling,registry,maintenance,orphans,
20
20
  // clones}.ts.
21
21
  // ---------------------------------------------------------------------
22
- const registry_cli_1 = require("../../shell/registry-cli");
23
- const reclamation_io_1 = require("../../shell/reclamation-io");
24
- const run_registry_io_1 = require("../../shell/run-registry-io");
25
- const scheduling_io_1 = require("../../shell/scheduling-io");
22
+ // This whole module is required unconditionally at CLI/MCP startup for
23
+ // EVERY command; loading these 4 shell modules lazily (only inside the
24
+ // handler that actually calls into them) keeps that load cost off every
25
+ // invocation that never touches schedule/routine/sched/registry/queue/
26
+ // gc/orphans/clones/run/history.
27
+ function loadRegistryCli() {
28
+ return require("../../shell/registry-cli");
29
+ }
30
+ function loadReclamationIo() {
31
+ return require("../../shell/reclamation-io");
32
+ }
33
+ function loadRunRegistryIo() {
34
+ return require("../../shell/run-registry-io");
35
+ }
36
+ function loadSchedulingIo() {
37
+ return require("../../shell/scheduling-io");
38
+ }
26
39
  function firstPositionalArg(args, index = 0) {
27
40
  return args.positionals[index];
28
41
  }
@@ -30,7 +43,7 @@ function firstPositionalArg(args, index = 0) {
30
43
  (0, registry_core_1.addCliOnlyCapability)("loop", 'cw loop — sugar for "schedule create --kind loop".', {
31
44
  path: ["loop"],
32
45
  jsonMode: "default",
33
- handler: (args) => ({ json: (0, registry_cli_1.scheduleCreateCli)({ ...args.options, kind: "loop" }) }),
46
+ handler: (args) => ({ json: loadRegistryCli().scheduleCreateCli({ ...args.options, kind: "loop" }) }),
34
47
  }, "loop is CLI-only sugar over schedule.create; the old build never gave it an MCP tool of its own (SPEC/scheduling-registry.md section I).");
35
48
  (0, registry_core_1.addCliOnlyCapability)("schedule", "cw schedule create|list|delete|due|complete|pause|resume|run-now|history|daemon — the wall-clock scheduler.", {
36
49
  path: ["schedule"],
@@ -38,36 +51,37 @@ function firstPositionalArg(args, index = 0) {
38
51
  hiddenFromHelp: true,
39
52
  handler: (args) => {
40
53
  const [subcommand, id] = args.positionals;
54
+ const registryCli = loadRegistryCli();
41
55
  switch (subcommand) {
42
56
  case "create":
43
- return { json: (0, registry_cli_1.scheduleCreateCli)(args.options) };
57
+ return { json: registryCli.scheduleCreateCli(args.options) };
44
58
  case "list":
45
- return { json: (0, registry_cli_1.scheduleListCli)(args.options) };
59
+ return { json: registryCli.scheduleListCli(args.options) };
46
60
  case "delete":
47
- return { json: (0, registry_cli_1.scheduleDeleteCli)((0, io_1.required)(id, "schedule id"), args.options) };
61
+ return { json: registryCli.scheduleDeleteCli((0, io_1.required)(id, "schedule id"), args.options) };
48
62
  case "due":
49
- return { json: (0, registry_cli_1.scheduleDueCli)(args.options) };
63
+ return { json: registryCli.scheduleDueCli(args.options) };
50
64
  case "complete":
51
- return { json: (0, registry_cli_1.scheduleCompleteCli)((0, io_1.required)(id, "schedule id"), args.options) };
65
+ return { json: registryCli.scheduleCompleteCli((0, io_1.required)(id, "schedule id"), args.options) };
52
66
  case "pause":
53
- return { json: (0, registry_cli_1.schedulePauseCli)((0, io_1.required)(id, "schedule id"), args.options) };
67
+ return { json: registryCli.schedulePauseCli((0, io_1.required)(id, "schedule id"), args.options) };
54
68
  case "resume":
55
- return { json: (0, registry_cli_1.scheduleResumeCli)((0, io_1.required)(id, "schedule id"), args.options) };
69
+ return { json: registryCli.scheduleResumeCli((0, io_1.required)(id, "schedule id"), args.options) };
56
70
  case "run-now":
57
- return { json: (0, registry_cli_1.scheduleRunNowCli)((0, io_1.required)(id, "schedule id"), args.options) };
71
+ return { json: registryCli.scheduleRunNowCli((0, io_1.required)(id, "schedule id"), args.options) };
58
72
  case "history":
59
- return { json: (0, registry_cli_1.scheduleHistoryCli)(id, args.options) };
73
+ return { json: registryCli.scheduleHistoryCli(id, args.options) };
60
74
  case "daemon": {
61
75
  if (args.options.once)
62
- return { json: (0, registry_cli_1.scheduleDaemonTickCli)(args.options) };
76
+ return { json: registryCli.scheduleDaemonTickCli(args.options) };
63
77
  // Never returns (matches the old build's forever daemon loop);
64
78
  // the process stays alive via the DesktopSchedulerDaemon's own
65
79
  // setInterval, printing one tick line per interval.
66
- void (0, registry_cli_1.scheduleDaemonRunForever)(args.options);
80
+ void registryCli.scheduleDaemonRunForever(args.options);
67
81
  return {};
68
82
  }
69
83
  default:
70
- throw new Error("Usage: cw.js schedule create|list|delete|due|complete|pause|resume|run-now|history|daemon");
84
+ throw new Error("Usage: cw schedule create|list|delete|due|complete|pause|resume|run-now|history|daemon");
71
85
  }
72
86
  },
73
87
  }, "cw schedule is the desktop wall-clock scheduler; SPEC/mcp.md declares its MCP peers per verb (cw_schedule_*), each wired below.");
@@ -75,30 +89,30 @@ function firstPositionalArg(args, index = 0) {
75
89
  // notYetImplemented placeholder (the "each wired below" comment was never
76
90
  // satisfied). Mirror the CLI switch's shell fns; arg-name reads (id/status)
77
91
  // copied from the old build's mcp/tool-call.ts scheduler arms.
78
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.create").mcp.handler = (args) => (0, registry_cli_1.scheduleCreateCli)(args);
79
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.list").mcp.handler = (args) => (0, registry_cli_1.scheduleListCli)(args);
80
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.due").mcp.handler = (args) => (0, registry_cli_1.scheduleDueCli)(args);
81
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.complete").mcp.handler = (args) => (0, registry_cli_1.scheduleCompleteCli)((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
82
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.pause").mcp.handler = (args) => (0, registry_cli_1.schedulePauseCli)((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
83
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.resume").mcp.handler = (args) => (0, registry_cli_1.scheduleResumeCli)((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
84
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.run-now").mcp.handler = (args) => (0, registry_cli_1.scheduleRunNowCli)((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
85
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.history").mcp.handler = (args) => (0, registry_cli_1.scheduleHistoryCli)((0, io_1.optionalArg)(args.id), args);
86
- registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.delete").mcp.handler = (args) => (0, registry_cli_1.scheduleDeleteCli)((0, io_1.required)((0, io_1.optionalArg)(args.id), "schedule id"), args);
92
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.create").mcp.handler = (args) => loadRegistryCli().scheduleCreateCli(args);
93
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.list").mcp.handler = (args) => loadRegistryCli().scheduleListCli(args);
94
+ 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);
87
101
  // Each `schedule <verb>` sub-action is its own two-token cli row (found
88
102
  // before the ["schedule"] catch-all per the reversed candidate order), so
89
103
  // each capability is a real both-surface dual-bound row. Same shell fns and
90
104
  // [subcommand, id] positional mapping as the catch-all switch above.
91
105
  // `hiddenFromHelp` keeps `cw help schedule`'s rows coming from the single
92
106
  // literal COMMAND_HELP_ROWS.schedule block.
93
- (0, registry_core_1.attachCliBinding)("schedule.create", { path: ["schedule", "create"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.scheduleCreateCli)(args.options) }) });
94
- (0, registry_core_1.attachCliBinding)("schedule.list", { path: ["schedule", "list"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.scheduleListCli)(args.options) }) });
95
- (0, registry_core_1.attachCliBinding)("schedule.delete", { path: ["schedule", "delete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.scheduleDeleteCli)((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
96
- (0, registry_core_1.attachCliBinding)("schedule.due", { path: ["schedule", "due"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.scheduleDueCli)(args.options) }) });
97
- (0, registry_core_1.attachCliBinding)("schedule.complete", { path: ["schedule", "complete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.scheduleCompleteCli)((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
98
- (0, registry_core_1.attachCliBinding)("schedule.pause", { path: ["schedule", "pause"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.schedulePauseCli)((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
99
- (0, registry_core_1.attachCliBinding)("schedule.resume", { path: ["schedule", "resume"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.scheduleResumeCli)((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
100
- (0, registry_core_1.attachCliBinding)("schedule.run-now", { path: ["schedule", "run-now"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.scheduleRunNowCli)((0, io_1.required)(args.positionals[0], "schedule id"), args.options) }) });
101
- (0, registry_core_1.attachCliBinding)("schedule.history", { path: ["schedule", "history"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.scheduleHistoryCli)(args.positionals[0], args.options) }) });
107
+ (0, registry_core_1.attachCliBinding)("schedule.create", { path: ["schedule", "create"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleCreateCli(args.options) }) });
108
+ (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) }) });
110
+ (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) }) });
115
+ (0, registry_core_1.attachCliBinding)("schedule.history", { path: ["schedule", "history"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().scheduleHistoryCli(args.positionals[0], args.options) }) });
102
116
  // ---- routine ------------------------------------------------------------
103
117
  (0, registry_core_1.addCliOnlyCapability)("routine", "cw routine create|list|delete|fire|events — API/GitHub-style triggers.", {
104
118
  path: ["routine"],
@@ -106,38 +120,39 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("schedule.delete").mcp.handler = (arg
106
120
  hiddenFromHelp: true,
107
121
  handler: (args) => {
108
122
  const [subcommand, idOrKind, payloadPath] = args.positionals;
123
+ const registryCli = loadRegistryCli();
109
124
  switch (subcommand) {
110
125
  case "create":
111
- return { json: (0, registry_cli_1.routineCreateCli)(args.options) };
126
+ return { json: registryCli.routineCreateCli(args.options) };
112
127
  case "list":
113
- return { json: (0, registry_cli_1.routineListCli)(args.options) };
128
+ return { json: registryCli.routineListCli(args.options) };
114
129
  case "delete":
115
- return { json: (0, registry_cli_1.routineDeleteCli)((0, io_1.required)(idOrKind, "trigger id"), args.options) };
130
+ return { json: registryCli.routineDeleteCli((0, io_1.required)(idOrKind, "trigger id"), args.options) };
116
131
  case "fire": {
117
132
  const kind = (0, io_1.required)(idOrKind, "trigger kind");
118
- const payload = (0, registry_cli_1.resolveRoutineFirePayload)(payloadPath, args.options);
119
- return { json: (0, registry_cli_1.routineFireCli)(kind, payload, args.options) };
133
+ const payload = registryCli.resolveRoutineFirePayload(payloadPath, args.options);
134
+ return { json: registryCli.routineFireCli(kind, payload, args.options) };
120
135
  }
121
136
  case "events":
122
- return { json: (0, registry_cli_1.routineEventsCli)(idOrKind, args.options) };
137
+ return { json: registryCli.routineEventsCli(idOrKind, args.options) };
123
138
  default:
124
- throw new Error("Usage: cw.js routine create|list|delete|fire|events");
139
+ throw new Error("Usage: cw routine create|list|delete|fire|events");
125
140
  }
126
141
  },
127
142
  }, "cw routine is the API/GitHub-style trigger bridge; SPEC/mcp.md declares its MCP peers per verb (cw_routine_*), each wired below.");
128
- registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.create").mcp.handler = (args) => (0, registry_cli_1.routineCreateCli)(args);
129
- registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.list").mcp.handler = (args) => (0, registry_cli_1.routineListCli)(args);
130
- registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.delete").mcp.handler = (args) => (0, registry_cli_1.routineDeleteCli)((0, io_1.required)((0, io_1.optionalArg)(args.id), "trigger id"), args);
131
- registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.fire").mcp.handler = (args) => (0, registry_cli_1.routineFireCli)((0, io_1.required)((0, io_1.optionalArg)(args.kind), "trigger kind"), args.payload, args);
132
- registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.events").mcp.handler = (args) => (0, registry_cli_1.routineEventsCli)((0, io_1.optionalArg)(args.id), args);
143
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.create").mcp.handler = (args) => loadRegistryCli().routineCreateCli(args);
144
+ 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);
133
148
  // Each `routine <verb>` sub-action is its own two-token cli row. The
134
149
  // catch-all read [subcommand, idOrKind, payloadPath], so after the
135
150
  // dispatcher consumes the sub-verb positionals[0]=idOrKind,
136
151
  // positionals[1]=payloadPath. `hiddenFromHelp` keeps `cw help routine`'s
137
152
  // rows coming from the single literal COMMAND_HELP_ROWS.routine block.
138
- (0, registry_core_1.attachCliBinding)("routine.create", { path: ["routine", "create"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.routineCreateCli)(args.options) }) });
139
- (0, registry_core_1.attachCliBinding)("routine.list", { path: ["routine", "list"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.routineListCli)(args.options) }) });
140
- (0, registry_core_1.attachCliBinding)("routine.delete", { path: ["routine", "delete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.routineDeleteCli)((0, io_1.required)(args.positionals[0], "trigger id"), args.options) }) });
153
+ (0, registry_core_1.attachCliBinding)("routine.create", { path: ["routine", "create"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().routineCreateCli(args.options) }) });
154
+ (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) }) });
141
156
  (0, registry_core_1.attachCliBinding)("routine.fire", {
142
157
  path: ["routine", "fire"],
143
158
  jsonMode: "default",
@@ -145,11 +160,12 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.events").mcp.handler = (args
145
160
  handler: (args) => {
146
161
  const kind = (0, io_1.required)(args.positionals[0], "trigger kind");
147
162
  const payloadPath = args.positionals[1];
148
- const payload = (0, registry_cli_1.resolveRoutineFirePayload)(payloadPath, args.options);
149
- return { json: (0, registry_cli_1.routineFireCli)(kind, payload, args.options) };
163
+ const registryCli = loadRegistryCli();
164
+ const payload = registryCli.resolveRoutineFirePayload(payloadPath, args.options);
165
+ return { json: registryCli.routineFireCli(kind, payload, args.options) };
150
166
  },
151
167
  });
152
- (0, registry_core_1.attachCliBinding)("routine.events", { path: ["routine", "events"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, registry_cli_1.routineEventsCli)(args.positionals[0], args.options) }) });
168
+ (0, registry_core_1.attachCliBinding)("routine.events", { path: ["routine", "events"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadRegistryCli().routineEventsCli(args.positionals[0], args.options) }) });
153
169
  // ---- sched (control-plane leases over the durable queue) ---------------
154
170
  (0, registry_core_1.addCliOnlyCapability)("sched", "cw sched plan|lease|release|complete|reclaim|reset|policy [show|set] — control-plane lease scheduling over the durable queue.", {
155
171
  path: ["sched"],
@@ -157,38 +173,39 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("routine.events").mcp.handler = (args
157
173
  hiddenFromHelp: true,
158
174
  handler: (args) => {
159
175
  const [subcommand, idArg] = args.positionals;
176
+ const schedulingIo = loadSchedulingIo();
160
177
  switch (subcommand) {
161
178
  case "plan":
162
- return { json: (0, scheduling_io_1.schedPlanCli)(args.options) };
179
+ return { json: schedulingIo.schedPlanCli(args.options) };
163
180
  case "lease":
164
- return { json: (0, scheduling_io_1.schedLeaseCli)(args.options) };
181
+ return { json: schedulingIo.schedLeaseCli(args.options) };
165
182
  case "release":
166
- return { json: (0, scheduling_io_1.schedReleaseCli)(String(args.options.leaseId || idArg || ""), args.options) };
183
+ return { json: schedulingIo.schedReleaseCli(String(args.options.leaseId || idArg || ""), args.options) };
167
184
  case "complete":
168
- return { json: (0, scheduling_io_1.schedCompleteCli)(String(args.options.leaseId || idArg || ""), args.options) };
185
+ return { json: schedulingIo.schedCompleteCli(String(args.options.leaseId || idArg || ""), args.options) };
169
186
  case "reclaim":
170
- return { json: (0, scheduling_io_1.schedReclaimCli)(args.options) };
187
+ return { json: schedulingIo.schedReclaimCli(args.options) };
171
188
  case "reset":
172
- return { json: (0, scheduling_io_1.schedResetCli)(String(args.options.id || idArg || ""), args.options) };
189
+ return { json: schedulingIo.schedResetCli(String(args.options.id || idArg || ""), args.options) };
173
190
  case "policy": {
174
191
  const action = args.positionals[1];
175
192
  if (action === "set")
176
- return { json: (0, scheduling_io_1.schedPolicySetCli)(args.options) };
177
- return { json: (0, scheduling_io_1.schedPolicyShowCli)(args.options) };
193
+ return { json: schedulingIo.schedPolicySetCli(args.options) };
194
+ return { json: schedulingIo.schedPolicyShowCli(args.options) };
178
195
  }
179
196
  default:
180
- throw new Error("Usage: cw.js sched plan|lease|release|complete|reclaim|reset|policy [show|set] [id] [--maxConcurrent N --maxAttempts N ...]");
197
+ throw new Error("Usage: cw sched plan|lease|release|complete|reclaim|reset|policy [show|set] [id] [--maxConcurrent N --maxAttempts N ...]");
181
198
  }
182
199
  },
183
200
  }, "cw sched is the durable-queue lease scheduler; SPEC/mcp.md declares its MCP peers per verb (cw_sched_*), each wired below.");
184
- registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.plan").mcp.handler = (args) => (0, scheduling_io_1.schedPlanCli)(args);
185
- registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.lease").mcp.handler = (args) => (0, scheduling_io_1.schedLeaseCli)(args);
186
- registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.release").mcp.handler = (args) => (0, scheduling_io_1.schedReleaseCli)(String(args.leaseId || ""), args);
187
- registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.complete").mcp.handler = (args) => (0, scheduling_io_1.schedCompleteCli)(String(args.leaseId || ""), args);
188
- registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.reclaim").mcp.handler = (args) => (0, scheduling_io_1.schedReclaimCli)(args);
189
- registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.reset").mcp.handler = (args) => (0, scheduling_io_1.schedResetCli)(String(args.id || ""), args);
190
- registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.policy.show").mcp.handler = (args) => (0, scheduling_io_1.schedPolicyShowCli)(args);
191
- registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.policy.set").mcp.handler = (args) => (0, scheduling_io_1.schedPolicySetCli)(args);
201
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.plan").mcp.handler = (args) => loadSchedulingIo().schedPlanCli(args);
202
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.lease").mcp.handler = (args) => loadSchedulingIo().schedLeaseCli(args);
203
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.release").mcp.handler = (args) => loadSchedulingIo().schedReleaseCli(String(args.leaseId || ""), args);
204
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.complete").mcp.handler = (args) => loadSchedulingIo().schedCompleteCli(String(args.leaseId || ""), args);
205
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.reclaim").mcp.handler = (args) => loadSchedulingIo().schedReclaimCli(args);
206
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.reset").mcp.handler = (args) => loadSchedulingIo().schedResetCli(String(args.id || ""), args);
207
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.policy.show").mcp.handler = (args) => loadSchedulingIo().schedPolicyShowCli(args);
208
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.policy.set").mcp.handler = (args) => loadSchedulingIo().schedPolicySetCli(args);
192
209
  // Each `sched <verb>` sub-action is its own two-token cli row. The
193
210
  // catch-all read [subcommand, idArg]; after the dispatcher consumes the
194
211
  // sub-verb, positionals[0]=idArg (release/complete read --leaseId or that
@@ -197,17 +214,18 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("sched.policy.set").mcp.handler = (ar
197
214
  // from the first positional (like blackboard.message.post/list).
198
215
  // `hiddenFromHelp` keeps `cw help sched`'s rows coming from the single
199
216
  // literal COMMAND_HELP_ROWS.sched block.
200
- (0, registry_core_1.attachCliBinding)("sched.plan", { path: ["sched", "plan"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, scheduling_io_1.schedPlanCli)(args.options) }) });
201
- (0, registry_core_1.attachCliBinding)("sched.lease", { path: ["sched", "lease"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, scheduling_io_1.schedLeaseCli)(args.options) }) });
202
- (0, registry_core_1.attachCliBinding)("sched.release", { path: ["sched", "release"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, scheduling_io_1.schedReleaseCli)(String(args.options.leaseId || args.positionals[0] || ""), args.options) }) });
203
- (0, registry_core_1.attachCliBinding)("sched.complete", { path: ["sched", "complete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, scheduling_io_1.schedCompleteCli)(String(args.options.leaseId || args.positionals[0] || ""), args.options) }) });
204
- (0, registry_core_1.attachCliBinding)("sched.reclaim", { path: ["sched", "reclaim"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, scheduling_io_1.schedReclaimCli)(args.options) }) });
205
- (0, registry_core_1.attachCliBinding)("sched.reset", { path: ["sched", "reset"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: (0, scheduling_io_1.schedResetCli)(String(args.options.id || args.positionals[0] || ""), args.options) }) });
217
+ (0, registry_core_1.attachCliBinding)("sched.plan", { path: ["sched", "plan"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadSchedulingIo().schedPlanCli(args.options) }) });
218
+ (0, registry_core_1.attachCliBinding)("sched.lease", { path: ["sched", "lease"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadSchedulingIo().schedLeaseCli(args.options) }) });
219
+ (0, registry_core_1.attachCliBinding)("sched.release", { path: ["sched", "release"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadSchedulingIo().schedReleaseCli(String(args.options.leaseId || args.positionals[0] || ""), args.options) }) });
220
+ (0, registry_core_1.attachCliBinding)("sched.complete", { path: ["sched", "complete"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadSchedulingIo().schedCompleteCli(String(args.options.leaseId || args.positionals[0] || ""), args.options) }) });
221
+ (0, registry_core_1.attachCliBinding)("sched.reclaim", { path: ["sched", "reclaim"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadSchedulingIo().schedReclaimCli(args.options) }) });
222
+ (0, registry_core_1.attachCliBinding)("sched.reset", { path: ["sched", "reset"], jsonMode: "default", hiddenFromHelp: true, handler: (args) => ({ json: loadSchedulingIo().schedResetCli(String(args.options.id || args.positionals[0] || ""), args.options) }) });
206
223
  function schedPolicyHandler(args) {
207
224
  const action = args.positionals[0];
225
+ const schedulingIo = loadSchedulingIo();
208
226
  if (action === "set")
209
- return { json: (0, scheduling_io_1.schedPolicySetCli)(args.options) };
210
- return { json: (0, scheduling_io_1.schedPolicyShowCli)(args.options) };
227
+ return { json: schedulingIo.schedPolicySetCli(args.options) };
228
+ return { json: schedulingIo.schedPolicyShowCli(args.options) };
211
229
  }
212
230
  (0, registry_core_1.attachCliBinding)("sched.policy.show", { path: ["sched", "policy"], helpPath: ["sched", "policy"], jsonMode: "default", hiddenFromHelp: true, handler: schedPolicyHandler });
213
231
  (0, registry_core_1.attachCliBinding)("sched.policy.set", { path: ["sched", "policy"], helpPath: ["sched", "policy"], jsonMode: "default", hiddenFromHelp: true, handler: schedPolicyHandler });
@@ -218,18 +236,19 @@ function schedPolicyHandler(args) {
218
236
  hiddenFromHelp: true,
219
237
  handler: (args) => {
220
238
  const subcommand = firstPositionalArg(args);
239
+ const registryCli = loadRegistryCli();
221
240
  let report;
222
241
  if (subcommand === "refresh")
223
- report = (0, registry_cli_1.registryRefreshCli)(args.options);
242
+ report = registryCli.registryRefreshCli(args.options);
224
243
  else if (subcommand === "show")
225
- report = (0, registry_cli_1.registryShowCli)(args.options);
244
+ report = registryCli.registryShowCli(args.options);
226
245
  else
227
- throw new Error("Usage: cw.js registry refresh|show [--scope repo|home] [--json]");
228
- return { json: report, text: (0, run_registry_io_1.formatRegistryReport)(report) };
246
+ throw new Error("Usage: cw registry refresh|show [--scope repo|home] [--json]");
247
+ return { json: report, text: loadRunRegistryIo().formatRegistryReport(report) };
229
248
  },
230
249
  }, "cw registry is the derived run-registry index; SPEC/mcp.md declares its MCP peers (cw_registry_refresh|show), each wired below.");
231
- registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.refresh").mcp.handler = (args) => (0, registry_cli_1.registryRefreshCli)(args);
232
- registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args) => (0, registry_cli_1.registryShowCli)(args);
250
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.refresh").mcp.handler = (args) => loadRegistryCli().registryRefreshCli(args);
251
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args) => loadRegistryCli().registryShowCli(args);
233
252
  // `registry.refresh`/`registry.show` each carry their own two-token
234
253
  // cli.path (found before the ["registry"] catch-all). `hiddenFromHelp`
235
254
  // keeps `cw help registry`'s rows coming from the single literal
@@ -241,8 +260,8 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args)
241
260
  jsonMode: "flag",
242
261
  hiddenFromHelp: true,
243
262
  handler: (args) => {
244
- const report = (0, registry_cli_1.registryRefreshCli)(args.options);
245
- return (0, io_1.wantsJson)(args.options) ? { json: report } : { json: report, text: (0, run_registry_io_1.formatRegistryReport)(report) };
263
+ const report = loadRegistryCli().registryRefreshCli(args.options);
264
+ return (0, io_1.wantsJson)(args.options) ? { json: report } : { json: report, text: loadRunRegistryIo().formatRegistryReport(report) };
246
265
  },
247
266
  });
248
267
  (0, registry_core_1.attachCliBinding)("registry.show", {
@@ -250,8 +269,8 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args)
250
269
  jsonMode: "flag",
251
270
  hiddenFromHelp: true,
252
271
  handler: (args) => {
253
- const report = (0, registry_cli_1.registryShowCli)(args.options);
254
- return (0, io_1.wantsJson)(args.options) ? { json: report } : { json: report, text: (0, run_registry_io_1.formatRegistryReport)(report) };
272
+ const report = loadRegistryCli().registryShowCli(args.options);
273
+ return (0, io_1.wantsJson)(args.options) ? { json: report } : { json: report, text: loadRunRegistryIo().formatRegistryReport(report) };
255
274
  },
256
275
  });
257
276
  // ---- queue (add|list|drain|show) ----------------------------------------
@@ -261,26 +280,27 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("registry.show").mcp.handler = (args)
261
280
  hiddenFromHelp: true,
262
281
  handler: (args) => {
263
282
  const [subcommand, id] = args.positionals;
283
+ const registryCli = loadRegistryCli();
264
284
  switch (subcommand) {
265
285
  case "add":
266
- return { json: (0, registry_cli_1.queueAddCli)(args.options) };
286
+ return { json: registryCli.queueAddCli(args.options) };
267
287
  case "list": {
268
- const result = (0, registry_cli_1.queueListCli)(args.options);
269
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, run_registry_io_1.formatQueueList)(result) };
288
+ const result = registryCli.queueListCli(args.options);
289
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadRunRegistryIo().formatQueueList(result) };
270
290
  }
271
291
  case "drain":
272
- return { json: (0, registry_cli_1.queueDrainCli)(args.options) };
292
+ return { json: registryCli.queueDrainCli(args.options) };
273
293
  case "show":
274
- return { json: (0, registry_cli_1.queueShowCli)((0, io_1.required)(id, "queue id"), args.options) };
294
+ return { json: registryCli.queueShowCli((0, io_1.required)(id, "queue id"), args.options) };
275
295
  default:
276
- throw new Error("Usage: cw.js queue add|list|drain|show [queue-id] [--repo PATH] [--priority N]");
296
+ throw new Error("Usage: cw queue add|list|drain|show [queue-id] [--repo PATH] [--priority N]");
277
297
  }
278
298
  },
279
299
  }, "cw queue is the durable run queue; SPEC/mcp.md declares its MCP peers (cw_queue_add|list|drain|show), each wired below.");
280
- registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.add").mcp.handler = (args) => (0, registry_cli_1.queueAddCli)(args);
281
- registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.list").mcp.handler = (args) => (0, registry_cli_1.queueListCli)(args);
282
- registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.drain").mcp.handler = (args) => (0, registry_cli_1.queueDrainCli)(args);
283
- registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.show").mcp.handler = (args) => (0, registry_cli_1.queueShowCli)((0, io_1.required)((0, io_1.optionalArg)(args.id), "queue id"), args);
300
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.add").mcp.handler = (args) => loadRegistryCli().queueAddCli(args);
301
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.list").mcp.handler = (args) => loadRegistryCli().queueListCli(args);
302
+ 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);
284
304
  // `queue add|list|drain|show` each carry their own two-token cli.path
285
305
  // (found before the ["queue"] catch-all). `hiddenFromHelp` keeps `cw help
286
306
  // queue`'s rows coming from the single literal COMMAND_HELP_ROWS.queue
@@ -290,28 +310,28 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.show").mcp.handler = (args) =>
290
310
  path: ["queue", "add"],
291
311
  jsonMode: "default",
292
312
  hiddenFromHelp: true,
293
- handler: (args) => ({ json: (0, registry_cli_1.queueAddCli)(args.options) }),
313
+ handler: (args) => ({ json: loadRegistryCli().queueAddCli(args.options) }),
294
314
  });
295
315
  (0, registry_core_1.attachCliBinding)("queue.list", {
296
316
  path: ["queue", "list"],
297
317
  jsonMode: "flag",
298
318
  hiddenFromHelp: true,
299
319
  handler: (args) => {
300
- const result = (0, registry_cli_1.queueListCli)(args.options);
301
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, run_registry_io_1.formatQueueList)(result) };
320
+ const result = loadRegistryCli().queueListCli(args.options);
321
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadRunRegistryIo().formatQueueList(result) };
302
322
  },
303
323
  });
304
324
  (0, registry_core_1.attachCliBinding)("queue.drain", {
305
325
  path: ["queue", "drain"],
306
326
  jsonMode: "default",
307
327
  hiddenFromHelp: true,
308
- handler: (args) => ({ json: (0, registry_cli_1.queueDrainCli)(args.options) }),
328
+ handler: (args) => ({ json: loadRegistryCli().queueDrainCli(args.options) }),
309
329
  });
310
330
  (0, registry_core_1.attachCliBinding)("queue.show", {
311
331
  path: ["queue", "show"],
312
332
  jsonMode: "default",
313
333
  hiddenFromHelp: true,
314
- handler: (args) => ({ json: (0, registry_cli_1.queueShowCli)((0, io_1.required)(args.positionals[0], "queue id"), args.options) }),
334
+ handler: (args) => ({ json: loadRegistryCli().queueShowCli((0, io_1.required)(args.positionals[0], "queue id"), args.options) }),
315
335
  });
316
336
  // ---- gc (plan|run|verify) ------------------------------------------------
317
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.", {
@@ -320,28 +340,30 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("queue.show").mcp.handler = (args) =>
320
340
  hiddenFromHelp: true,
321
341
  handler: (args) => {
322
342
  const [subcommand, id] = args.positionals;
343
+ const registryCli = loadRegistryCli();
344
+ const reclamationIo = loadReclamationIo();
323
345
  switch (subcommand) {
324
346
  case "plan": {
325
- const result = (0, registry_cli_1.gcPlanCli)(id, args.options);
326
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatGcPlan)(result) };
347
+ const result = registryCli.gcPlanCli(id, args.options);
348
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatGcPlan(result) };
327
349
  }
328
350
  case "run": {
329
- const result = (0, registry_cli_1.gcRunCli)(id, args.options);
330
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatGcRun)(result) };
351
+ const result = registryCli.gcRunCli(id, args.options);
352
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatGcRun(result) };
331
353
  }
332
354
  case "verify": {
333
- const result = (0, registry_cli_1.gcVerifyCli)((0, io_1.required)(id, "run id"), args.options);
334
- const text = (0, reclamation_io_1.formatGcVerify)(result);
355
+ const result = registryCli.gcVerifyCli((0, io_1.required)(id, "run id"), args.options);
356
+ const text = reclamationIo.formatGcVerify(result);
335
357
  return { json: result, text, exitCode: result.reclaimed && !result.verified ? 1 : undefined };
336
358
  }
337
359
  default:
338
- throw new Error("Usage: cw.js gc plan|run|verify [run-id] [--reclaimAfterArchiveDays N] [--keep-scratch] [--keep-snapshots] [--limit N] [--json]");
360
+ throw new Error("Usage: cw gc plan|run|verify [run-id] [--reclaimAfterArchiveDays N] [--keep-scratch] [--keep-snapshots] [--limit N] [--json]");
339
361
  }
340
362
  },
341
363
  }, "cw gc is run retention & provable reclamation; SPEC/mcp.md declares its MCP peers (cw_gc_plan|run|verify), each wired below.");
342
- registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.plan").mcp.handler = (args) => (0, registry_cli_1.gcPlanCli)((0, io_1.optionalArg)(args.runId), args);
343
- registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").mcp.handler = (args) => (0, registry_cli_1.gcRunCli)((0, io_1.optionalArg)(args.runId), args);
344
- registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.verify").mcp.handler = (args) => (0, registry_cli_1.gcVerifyCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
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);
345
367
  // PARITY: `gc.run` frees disk and appends a tombstone; both surfaces run
346
368
  // the identical transaction but the payload reports now-derived
347
369
  // bytesFreed/tombstone, so it is a documented opt-out, not drift.
@@ -359,20 +381,27 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").reason =
359
381
  // capabilities for the payload-identity probe. `gc.run` stays reachable
360
382
  // only via the ["gc"] catch-all (it is a documented payload-probe
361
383
  // opt-out above, so it does not need its own dual-bound row).
384
+ // `hiddenFromHelp` keeps `cw help gc`'s rows coming from the single
385
+ // literal COMMAND_HELP_ROWS.gc entries, same as `gc.run` below — without
386
+ // it these rows double-print alongside those literal rows (a rebuild
387
+ // regression the old build's `docs/rebuild/SPEC/cli-help/gc.txt` ground
388
+ // truth does not show; fixed here to match `gc.run`'s existing pattern).
362
389
  (0, registry_core_1.attachCliBinding)("gc.plan", {
363
390
  path: ["gc", "plan"],
364
391
  jsonMode: "flag",
392
+ hiddenFromHelp: true,
365
393
  handler: (args) => {
366
- const result = (0, registry_cli_1.gcPlanCli)(args.positionals[0], args.options);
367
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatGcPlan)(result) };
394
+ 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) };
368
396
  },
369
397
  });
370
398
  (0, registry_core_1.attachCliBinding)("gc.verify", {
371
399
  path: ["gc", "verify"],
372
400
  jsonMode: "flag",
401
+ hiddenFromHelp: true,
373
402
  handler: (args) => {
374
- const result = (0, registry_cli_1.gcVerifyCli)((0, io_1.required)(args.positionals[0], "run id"), args.options);
375
- const text = (0, reclamation_io_1.formatGcVerify)(result);
403
+ const result = loadRegistryCli().gcVerifyCli((0, io_1.required)(args.positionals[0], "run id"), args.options);
404
+ const text = loadReclamationIo().formatGcVerify(result);
376
405
  return { json: result, text, exitCode: result.reclaimed && !result.verified ? 1 : undefined };
377
406
  },
378
407
  });
@@ -387,8 +416,8 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").reason =
387
416
  jsonMode: "flag",
388
417
  hiddenFromHelp: true,
389
418
  handler: (args) => {
390
- const result = (0, registry_cli_1.gcRunCli)(args.positionals[0], args.options);
391
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatGcRun)(result) };
419
+ 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) };
392
421
  },
393
422
  });
394
423
  // ---- orphans (list|gc) ---------------------------------------------------
@@ -398,22 +427,24 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").reason =
398
427
  hiddenFromHelp: true,
399
428
  handler: (args) => {
400
429
  const subcommand = firstPositionalArg(args);
430
+ const registryCli = loadRegistryCli();
431
+ const reclamationIo = loadReclamationIo();
401
432
  switch (subcommand) {
402
433
  case "list": {
403
- const result = (0, registry_cli_1.orphansListCli)(args.options);
404
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatOrphanRunsList)(result) };
434
+ const result = registryCli.orphansListCli(args.options);
435
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatOrphanRunsList(result) };
405
436
  }
406
437
  case "gc": {
407
- const result = (0, registry_cli_1.orphansGcCli)(args.options);
408
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatOrphanRunsGc)(result) };
438
+ const result = registryCli.orphansGcCli(args.options);
439
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatOrphanRunsGc(result) };
409
440
  }
410
441
  default:
411
- throw new Error("Usage: cw.js orphans list [--scope repo|home] [--json] | orphans gc [--scope repo|home] [--min-age-minutes N] [--all] [--json] (scope defaults to home: every registered repo)");
442
+ 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)");
412
443
  }
413
444
  },
414
445
  }, "cw orphans reclaims killed-process run dirs with no state.json; SPEC/mcp.md declares its MCP peers (cw_orphans_list|gc), each wired below.");
415
- registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.list").mcp.handler = (args) => (0, registry_cli_1.orphansListCli)(args);
416
- registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").mcp.handler = (args) => (0, registry_cli_1.orphansGcCli)(args);
446
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.list").mcp.handler = (args) => loadRegistryCli().orphansListCli(args);
447
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").mcp.handler = (args) => loadRegistryCli().orphansGcCli(args);
417
448
  // `orphans.list`/`orphans.gc` each carry their own two-token cli.path
418
449
  // (found before the ["orphans"] catch-all per the reversed-candidate
419
450
  // order), so both are real both-surface dual-bound rows. `hiddenFromHelp`
@@ -426,8 +457,8 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").mcp.handler = (args) =>
426
457
  jsonMode: "flag",
427
458
  hiddenFromHelp: true,
428
459
  handler: (args) => {
429
- const result = (0, registry_cli_1.orphansListCli)(args.options);
430
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatOrphanRunsList)(result) };
460
+ const result = loadRegistryCli().orphansListCli(args.options);
461
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatOrphanRunsList(result) };
431
462
  },
432
463
  });
433
464
  (0, registry_core_1.attachCliBinding)("orphans.gc", {
@@ -435,8 +466,8 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").mcp.handler = (args) =>
435
466
  jsonMode: "flag",
436
467
  hiddenFromHelp: true,
437
468
  handler: (args) => {
438
- const result = (0, registry_cli_1.orphansGcCli)(args.options);
439
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatOrphanRunsGc)(result) };
469
+ const result = loadRegistryCli().orphansGcCli(args.options);
470
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatOrphanRunsGc(result) };
440
471
  },
441
472
  });
442
473
  registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").payloadIdentical = false;
@@ -449,22 +480,24 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").reason =
449
480
  hiddenFromHelp: true,
450
481
  handler: (args) => {
451
482
  const subcommand = firstPositionalArg(args);
483
+ const registryCli = loadRegistryCli();
484
+ const reclamationIo = loadReclamationIo();
452
485
  switch (subcommand) {
453
486
  case "list": {
454
- const result = (0, registry_cli_1.clonesListCli)();
455
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatClonesList)(result) };
487
+ const result = registryCli.clonesListCli();
488
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatClonesList(result) };
456
489
  }
457
490
  case "gc": {
458
- const result = (0, registry_cli_1.clonesGcCli)(args.options);
459
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatClonesGc)(result) };
491
+ const result = registryCli.clonesGcCli(args.options);
492
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: reclamationIo.formatClonesGc(result) };
460
493
  }
461
494
  default:
462
- throw new Error("Usage: cw.js clones list [--json] | clones gc [--older-than-days N] [--all] [--json]");
495
+ throw new Error("Usage: cw clones list [--json] | clones gc [--older-than-days N] [--all] [--json]");
463
496
  }
464
497
  },
465
498
  }, "cw clones is the cached remote-source checkout cache; SPEC/mcp.md declares its MCP peers (cw_clones_list|gc), each wired below.");
466
- registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.list").mcp.handler = () => (0, registry_cli_1.clonesListCli)();
467
- registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").mcp.handler = (args) => (0, registry_cli_1.clonesGcCli)(args);
499
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.list").mcp.handler = () => loadRegistryCli().clonesListCli();
500
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").mcp.handler = (args) => loadRegistryCli().clonesGcCli(args);
468
501
  // `clones.list`/`clones.gc` each carry their own two-token cli.path (found
469
502
  // before the ["clones"] catch-all). `hiddenFromHelp` keeps the byte-pinned
470
503
  // `cw help clones` fixture's rows coming from the single literal
@@ -475,8 +508,8 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").mcp.handler = (args) =>
475
508
  jsonMode: "flag",
476
509
  hiddenFromHelp: true,
477
510
  handler: (args) => {
478
- const result = (0, registry_cli_1.clonesListCli)();
479
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatClonesList)(result) };
511
+ const result = loadRegistryCli().clonesListCli();
512
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatClonesList(result) };
480
513
  },
481
514
  });
482
515
  (0, registry_core_1.attachCliBinding)("clones.gc", {
@@ -484,8 +517,8 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").mcp.handler = (args) =>
484
517
  jsonMode: "flag",
485
518
  hiddenFromHelp: true,
486
519
  handler: (args) => {
487
- const result = (0, registry_cli_1.clonesGcCli)(args.options);
488
- return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: (0, reclamation_io_1.formatClonesGc)(result) };
520
+ const result = loadRegistryCli().clonesGcCli(args.options);
521
+ return (0, io_1.wantsJson)(args.options) ? { json: result } : { json: result, text: loadReclamationIo().formatClonesGc(result) };
489
522
  },
490
523
  });
491
524
  registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").payloadIdentical = false;
@@ -499,60 +532,61 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").reason =
499
532
  path: ["run", "search"],
500
533
  jsonMode: "flag",
501
534
  handler: (args) => {
502
- const result = (0, registry_cli_1.runSearchCli)(args.options);
503
- return { json: result, text: (0, run_registry_io_1.formatRunSearch)(result) };
535
+ const result = loadRegistryCli().runSearchCli(args.options);
536
+ return { json: result, text: loadRunRegistryIo().formatRunSearch(result) };
504
537
  },
505
538
  });
506
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.search").mcp.handler = (args) => (0, registry_cli_1.runSearchCli)(args);
539
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.search").mcp.handler = (args) => loadRegistryCli().runSearchCli(args);
507
540
  (0, registry_core_1.attachCliBinding)("run.list", {
508
541
  path: ["run", "list"],
509
542
  jsonMode: "flag",
510
543
  handler: (args) => {
511
- const result = (0, registry_cli_1.runListCli)(args.options);
512
- return { json: result, text: (0, run_registry_io_1.formatRunSearch)(result) };
544
+ const result = loadRegistryCli().runListCli(args.options);
545
+ return { json: result, text: loadRunRegistryIo().formatRunSearch(result) };
513
546
  },
514
547
  });
515
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.list").mcp.handler = (args) => (0, registry_cli_1.runListCli)(args);
548
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.list").mcp.handler = (args) => loadRegistryCli().runListCli(args);
516
549
  (0, registry_core_1.attachCliBinding)("run.show", {
517
550
  path: ["run", "show"],
518
551
  jsonMode: "flag",
519
552
  handler: (args) => {
520
553
  const runId = (0, io_1.required)(args.positionals[0], "run id");
521
- const result = (0, registry_cli_1.runShowCli)(runId, args.options);
522
- return { json: result, text: (0, run_registry_io_1.formatRunShow)(result) };
554
+ const result = loadRegistryCli().runShowCli(runId, args.options);
555
+ return { json: result, text: loadRunRegistryIo().formatRunShow(result) };
523
556
  },
524
557
  });
525
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.show").mcp.handler = (args) => (0, registry_cli_1.runShowCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
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);
526
559
  (0, registry_core_1.attachCliBinding)("run.resume", {
527
560
  path: ["run", "resume"],
528
561
  jsonMode: "flag",
529
- handler: (args) => {
562
+ handler: async (args) => {
530
563
  const runId = (0, io_1.required)(args.positionals[0], "run id");
531
- const result = (0, registry_cli_1.runResumeCli)(runId, args.options);
532
- return { json: result, text: (0, run_registry_io_1.formatResume)(result) };
564
+ const runRegistryIo = loadRunRegistryIo();
565
+ const result = await loadRegistryCli().runResumeCli(runId, args.options);
566
+ return { json: result, text: runRegistryIo.formatResume(result) };
533
567
  },
534
568
  });
535
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.resume").mcp.handler = (args) => (0, registry_cli_1.runResumeCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
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);
536
570
  (0, registry_core_1.attachCliBinding)("run.archive", {
537
571
  path: ["run", "archive"],
538
572
  jsonMode: "default",
539
- handler: (args) => ({ json: (0, registry_cli_1.runArchiveCli)((0, io_1.optionalArg)(args.positionals[0]), args.options) }),
573
+ handler: (args) => ({ json: loadRegistryCli().runArchiveCli((0, io_1.optionalArg)(args.positionals[0]), args.options) }),
540
574
  });
541
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.archive").mcp.handler = (args) => (0, registry_cli_1.runArchiveCli)((0, io_1.optionalArg)(args.runId), args);
575
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("run.archive").mcp.handler = (args) => loadRegistryCli().runArchiveCli((0, io_1.optionalArg)(args.runId), args);
542
576
  (0, registry_core_1.attachCliBinding)("run.rerun", {
543
577
  path: ["run", "rerun"],
544
578
  jsonMode: "default",
545
- handler: (args) => ({ json: (0, registry_cli_1.runRerunCli)((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
579
+ handler: (args) => ({ json: loadRegistryCli().runRerunCli((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
546
580
  });
547
- registry_core_1.REGISTRY_BY_CAPABILITY.get("run.rerun").mcp.handler = (args) => (0, registry_cli_1.runRerunCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
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);
548
582
  // ---- history ---------------------------------------------------------
549
583
  (0, registry_core_1.attachCliBinding)("history", {
550
584
  path: ["history"],
551
585
  jsonMode: "flag",
552
586
  handler: (args) => {
553
- const result = (0, registry_cli_1.historyCli)(args.options);
554
- return { json: result, text: (0, run_registry_io_1.formatHistory)(result) };
587
+ const result = loadRegistryCli().historyCli(args.options);
588
+ return { json: result, text: loadRunRegistryIo().formatHistory(result) };
555
589
  },
556
590
  });
557
- registry_core_1.REGISTRY_BY_CAPABILITY.get("history").mcp.handler = (args) => (0, registry_cli_1.historyCli)(args);
591
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("history").mcp.handler = (args) => loadRegistryCli().historyCli(args);
558
592
  // ---------------------------------------------------------------------