cool-workflow 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/apps/architecture-review/app.json +1 -1
- package/apps/architecture-review-fast/app.json +1 -1
- package/apps/end-to-end-golden-path/app.json +1 -1
- package/apps/pr-review-fix-ci/app.json +1 -1
- package/apps/release-cut/app.json +1 -1
- package/apps/research-synthesis/app.json +1 -1
- package/dist/cli/dispatch.js +18 -86
- package/dist/cli/parseargv.js +5 -2
- package/dist/core/capability-data.js +270 -0
- package/dist/core/capability-table.js +16 -3504
- package/dist/core/format/help.js +28 -5
- package/dist/core/multi-agent/collaboration.js +3 -2
- package/dist/core/multi-agent/coordinator.js +4 -3
- package/dist/core/pipeline/commit-gate.js +2 -1
- package/dist/core/state/state-explosion/digest.js +3 -2
- package/dist/core/state/state-explosion/graph.js +9 -8
- package/dist/core/state/state-explosion/helpers.js +2 -1
- package/dist/core/trust/ledger.js +2 -1
- package/dist/core/types/execution-backend.js +18 -0
- package/dist/core/types/observability.js +7 -0
- package/dist/core/util/collate.js +23 -0
- package/dist/core/version.js +1 -1
- package/dist/shell/audit-cli.js +46 -2
- package/dist/shell/commit-summary.js +2 -1
- package/dist/shell/drive.js +26 -10
- package/dist/shell/evidence-reasoning.js +4 -3
- package/dist/shell/execution-backend/registry.js +2 -1
- package/dist/shell/execution-backend/types.js +0 -9
- package/dist/shell/fs-atomic.js +14 -1
- package/dist/shell/multi-agent-operator-ux.js +4 -3
- package/dist/shell/observability.js +12 -11
- package/dist/shell/onramp.js +17 -1
- package/dist/shell/operator-ux-text.js +2 -1
- package/dist/shell/operator-ux.js +7 -6
- package/dist/shell/pipeline-cli.js +82 -72
- package/dist/shell/reclamation-io.js +2 -1
- package/dist/shell/report.js +2 -1
- package/dist/shell/run-store.js +17 -0
- package/dist/shell/state-explosion-cli.js +2 -1
- package/dist/shell/topology-io.js +2 -1
- package/dist/shell/trust-audit.js +41 -2
- package/dist/shell/worker-cli.js +9 -1
- package/dist/shell/worker-isolation.js +34 -9
- package/dist/shell/workflow-app-loader.js +3 -2
- package/dist/wiring/capability-table/basics.js +66 -0
- package/dist/wiring/capability-table/exec-backend.js +162 -0
- package/dist/wiring/capability-table/index.js +42 -0
- package/dist/wiring/capability-table/multi-agent.js +623 -0
- package/dist/wiring/capability-table/parity.js +466 -0
- package/dist/wiring/capability-table/pipeline.js +280 -0
- package/dist/wiring/capability-table/registry-core.js +189 -0
- package/dist/wiring/capability-table/reporting.js +394 -0
- package/dist/wiring/capability-table/scheduling-registry.js +558 -0
- package/dist/wiring/capability-table/state.js +173 -0
- package/dist/wiring/capability-table/trust-ledger.js +134 -0
- package/dist/wiring/capability-table/workflow-apps.js +366 -0
- package/docs/agent-delegation-drive.7.md +2 -0
- package/docs/cli-mcp-parity.7.md +7 -2
- package/docs/contract-migration-tooling.7.md +2 -0
- package/docs/control-plane-scheduling.7.md +2 -0
- package/docs/durable-state-and-locking.7.md +22 -0
- package/docs/evidence-adoption-reasoning-chain.7.md +2 -0
- package/docs/execution-backends.7.md +2 -0
- package/docs/index.md +1 -0
- package/docs/multi-agent-cli-mcp-surface.7.md +2 -0
- package/docs/multi-agent-eval-replay-harness.7.md +2 -0
- package/docs/multi-agent-operator-ux.7.md +2 -0
- package/docs/node-snapshot-diff-replay.7.md +2 -0
- package/docs/observability-cost-accounting.7.md +2 -0
- package/docs/project-index.md +25 -5
- package/docs/real-execution-backends.7.md +2 -0
- package/docs/release-and-migration.7.md +2 -0
- package/docs/release-tooling.7.md +2 -0
- package/docs/run-registry-control-plane.7.md +2 -0
- package/docs/run-retention-reclamation.7.md +2 -0
- package/docs/security-trust-hardening.7.md +30 -0
- package/docs/state-explosion-management.7.md +2 -0
- package/docs/team-collaboration.7.md +2 -0
- package/docs/trust-audit-anchor.7.md +69 -0
- package/docs/web-desktop-workbench.7.md +2 -0
- package/manifest/plugin.manifest.json +1 -1
- package/package.json +3 -1
- package/scripts/bump-version.js +24 -2
- package/scripts/canonical-apps.js +4 -4
- package/scripts/dogfood-release.js +1 -1
- package/scripts/golden-path.js +4 -4
- package/scripts/purity-baseline.json +68 -0
- package/scripts/purity-gate.js +239 -0
- package/scripts/release-check.js +8 -1
- package/scripts/version-sync-check.js +33 -12
- package/workflows/README.md +19 -0
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// wiring/capability-table/scheduling-registry.ts — MILESTONE 10
|
|
3
|
+
// (scheduling, registry, gc/reclamation, orphans, clones) CLI bindings:
|
|
4
|
+
// schedule *, cw loop, routine *, sched *, registry *, queue *, run *
|
|
5
|
+
// (list/show/search/rerun/resume/archive), history, gc *, orphans *,
|
|
6
|
+
// clones *. Split out of core/capability-table.ts, byte-for-byte
|
|
7
|
+
// (extracted with sed, not retyped).
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const registry_core_1 = require("./registry-core");
|
|
10
|
+
const io_1 = require("../../cli/io");
|
|
11
|
+
// MILESTONE 10 (scheduling, registry, gc/reclamation, orphans, clones)
|
|
12
|
+
// CLI bindings: schedule *, cw loop, routine *, sched *, registry *,
|
|
13
|
+
// queue *, gc *, orphans *, clones *, run search|list|show|resume|
|
|
14
|
+
// archive|rerun, history. Handler BODIES live in shell/registry-cli.ts,
|
|
15
|
+
// shell/scheduler-io.ts, shell/scheduling-io.ts, shell/reclamation-io.ts,
|
|
16
|
+
// shell/run-registry-io.ts (impure — disk-scanning IO); this table only
|
|
17
|
+
// wires argv shape -> handler call, per cli/dispatch.ts's generic
|
|
18
|
+
// executor contract. Usage-error strings are copied byte-for-byte from
|
|
19
|
+
// the old build's handlers/{scheduling,registry,maintenance,orphans,
|
|
20
|
+
// clones}.ts.
|
|
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");
|
|
26
|
+
function firstPositionalArg(args, index = 0) {
|
|
27
|
+
return args.positionals[index];
|
|
28
|
+
}
|
|
29
|
+
// ---- schedule (+ cw loop) ----------------------------------------------
|
|
30
|
+
(0, registry_core_1.addCliOnlyCapability)("loop", 'cw loop — sugar for "schedule create --kind loop".', {
|
|
31
|
+
path: ["loop"],
|
|
32
|
+
jsonMode: "default",
|
|
33
|
+
handler: (args) => ({ json: (0, registry_cli_1.scheduleCreateCli)({ ...args.options, kind: "loop" }) }),
|
|
34
|
+
}, "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
|
+
(0, registry_core_1.addCliOnlyCapability)("schedule", "cw schedule create|list|delete|due|complete|pause|resume|run-now|history|daemon — the wall-clock scheduler.", {
|
|
36
|
+
path: ["schedule"],
|
|
37
|
+
jsonMode: "default",
|
|
38
|
+
hiddenFromHelp: true,
|
|
39
|
+
handler: (args) => {
|
|
40
|
+
const [subcommand, id] = args.positionals;
|
|
41
|
+
switch (subcommand) {
|
|
42
|
+
case "create":
|
|
43
|
+
return { json: (0, registry_cli_1.scheduleCreateCli)(args.options) };
|
|
44
|
+
case "list":
|
|
45
|
+
return { json: (0, registry_cli_1.scheduleListCli)(args.options) };
|
|
46
|
+
case "delete":
|
|
47
|
+
return { json: (0, registry_cli_1.scheduleDeleteCli)((0, io_1.required)(id, "schedule id"), args.options) };
|
|
48
|
+
case "due":
|
|
49
|
+
return { json: (0, registry_cli_1.scheduleDueCli)(args.options) };
|
|
50
|
+
case "complete":
|
|
51
|
+
return { json: (0, registry_cli_1.scheduleCompleteCli)((0, io_1.required)(id, "schedule id"), args.options) };
|
|
52
|
+
case "pause":
|
|
53
|
+
return { json: (0, registry_cli_1.schedulePauseCli)((0, io_1.required)(id, "schedule id"), args.options) };
|
|
54
|
+
case "resume":
|
|
55
|
+
return { json: (0, registry_cli_1.scheduleResumeCli)((0, io_1.required)(id, "schedule id"), args.options) };
|
|
56
|
+
case "run-now":
|
|
57
|
+
return { json: (0, registry_cli_1.scheduleRunNowCli)((0, io_1.required)(id, "schedule id"), args.options) };
|
|
58
|
+
case "history":
|
|
59
|
+
return { json: (0, registry_cli_1.scheduleHistoryCli)(id, args.options) };
|
|
60
|
+
case "daemon": {
|
|
61
|
+
if (args.options.once)
|
|
62
|
+
return { json: (0, registry_cli_1.scheduleDaemonTickCli)(args.options) };
|
|
63
|
+
// Never returns (matches the old build's forever daemon loop);
|
|
64
|
+
// the process stays alive via the DesktopSchedulerDaemon's own
|
|
65
|
+
// setInterval, printing one tick line per interval.
|
|
66
|
+
void (0, registry_cli_1.scheduleDaemonRunForever)(args.options);
|
|
67
|
+
return {};
|
|
68
|
+
}
|
|
69
|
+
default:
|
|
70
|
+
throw new Error("Usage: cw.js schedule create|list|delete|due|complete|pause|resume|run-now|history|daemon");
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
}, "cw schedule is the desktop wall-clock scheduler; SPEC/mcp.md declares its MCP peers per verb (cw_schedule_*), each wired below.");
|
|
74
|
+
// GAP #24: the cw_schedule_* MCP peers were declared but left on the
|
|
75
|
+
// notYetImplemented placeholder (the "each wired below" comment was never
|
|
76
|
+
// satisfied). Mirror the CLI switch's shell fns; arg-name reads (id/status)
|
|
77
|
+
// 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);
|
|
87
|
+
// Each `schedule <verb>` sub-action is its own two-token cli row (found
|
|
88
|
+
// before the ["schedule"] catch-all per the reversed candidate order), so
|
|
89
|
+
// each capability is a real both-surface dual-bound row. Same shell fns and
|
|
90
|
+
// [subcommand, id] positional mapping as the catch-all switch above.
|
|
91
|
+
// `hiddenFromHelp` keeps `cw help schedule`'s rows coming from the single
|
|
92
|
+
// 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) }) });
|
|
102
|
+
// ---- routine ------------------------------------------------------------
|
|
103
|
+
(0, registry_core_1.addCliOnlyCapability)("routine", "cw routine create|list|delete|fire|events — API/GitHub-style triggers.", {
|
|
104
|
+
path: ["routine"],
|
|
105
|
+
jsonMode: "default",
|
|
106
|
+
hiddenFromHelp: true,
|
|
107
|
+
handler: (args) => {
|
|
108
|
+
const [subcommand, idOrKind, payloadPath] = args.positionals;
|
|
109
|
+
switch (subcommand) {
|
|
110
|
+
case "create":
|
|
111
|
+
return { json: (0, registry_cli_1.routineCreateCli)(args.options) };
|
|
112
|
+
case "list":
|
|
113
|
+
return { json: (0, registry_cli_1.routineListCli)(args.options) };
|
|
114
|
+
case "delete":
|
|
115
|
+
return { json: (0, registry_cli_1.routineDeleteCli)((0, io_1.required)(idOrKind, "trigger id"), args.options) };
|
|
116
|
+
case "fire": {
|
|
117
|
+
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) };
|
|
120
|
+
}
|
|
121
|
+
case "events":
|
|
122
|
+
return { json: (0, registry_cli_1.routineEventsCli)(idOrKind, args.options) };
|
|
123
|
+
default:
|
|
124
|
+
throw new Error("Usage: cw.js routine create|list|delete|fire|events");
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
}, "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);
|
|
133
|
+
// Each `routine <verb>` sub-action is its own two-token cli row. The
|
|
134
|
+
// catch-all read [subcommand, idOrKind, payloadPath], so after the
|
|
135
|
+
// dispatcher consumes the sub-verb positionals[0]=idOrKind,
|
|
136
|
+
// positionals[1]=payloadPath. `hiddenFromHelp` keeps `cw help routine`'s
|
|
137
|
+
// 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) }) });
|
|
141
|
+
(0, registry_core_1.attachCliBinding)("routine.fire", {
|
|
142
|
+
path: ["routine", "fire"],
|
|
143
|
+
jsonMode: "default",
|
|
144
|
+
hiddenFromHelp: true,
|
|
145
|
+
handler: (args) => {
|
|
146
|
+
const kind = (0, io_1.required)(args.positionals[0], "trigger kind");
|
|
147
|
+
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) };
|
|
150
|
+
},
|
|
151
|
+
});
|
|
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) }) });
|
|
153
|
+
// ---- sched (control-plane leases over the durable queue) ---------------
|
|
154
|
+
(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
|
+
path: ["sched"],
|
|
156
|
+
jsonMode: "default",
|
|
157
|
+
hiddenFromHelp: true,
|
|
158
|
+
handler: (args) => {
|
|
159
|
+
const [subcommand, idArg] = args.positionals;
|
|
160
|
+
switch (subcommand) {
|
|
161
|
+
case "plan":
|
|
162
|
+
return { json: (0, scheduling_io_1.schedPlanCli)(args.options) };
|
|
163
|
+
case "lease":
|
|
164
|
+
return { json: (0, scheduling_io_1.schedLeaseCli)(args.options) };
|
|
165
|
+
case "release":
|
|
166
|
+
return { json: (0, scheduling_io_1.schedReleaseCli)(String(args.options.leaseId || idArg || ""), args.options) };
|
|
167
|
+
case "complete":
|
|
168
|
+
return { json: (0, scheduling_io_1.schedCompleteCli)(String(args.options.leaseId || idArg || ""), args.options) };
|
|
169
|
+
case "reclaim":
|
|
170
|
+
return { json: (0, scheduling_io_1.schedReclaimCli)(args.options) };
|
|
171
|
+
case "reset":
|
|
172
|
+
return { json: (0, scheduling_io_1.schedResetCli)(String(args.options.id || idArg || ""), args.options) };
|
|
173
|
+
case "policy": {
|
|
174
|
+
const action = args.positionals[1];
|
|
175
|
+
if (action === "set")
|
|
176
|
+
return { json: (0, scheduling_io_1.schedPolicySetCli)(args.options) };
|
|
177
|
+
return { json: (0, scheduling_io_1.schedPolicyShowCli)(args.options) };
|
|
178
|
+
}
|
|
179
|
+
default:
|
|
180
|
+
throw new Error("Usage: cw.js sched plan|lease|release|complete|reclaim|reset|policy [show|set] [id] [--maxConcurrent N --maxAttempts N ...]");
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
}, "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);
|
|
192
|
+
// Each `sched <verb>` sub-action is its own two-token cli row. The
|
|
193
|
+
// catch-all read [subcommand, idArg]; after the dispatcher consumes the
|
|
194
|
+
// sub-verb, positionals[0]=idArg (release/complete read --leaseId or that
|
|
195
|
+
// positional; reset reads --id or that positional). `sched.policy.show`/
|
|
196
|
+
// `.set` share the ["sched","policy"] path with the [show|set] action read
|
|
197
|
+
// from the first positional (like blackboard.message.post/list).
|
|
198
|
+
// `hiddenFromHelp` keeps `cw help sched`'s rows coming from the single
|
|
199
|
+
// 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) }) });
|
|
206
|
+
function schedPolicyHandler(args) {
|
|
207
|
+
const action = args.positionals[0];
|
|
208
|
+
if (action === "set")
|
|
209
|
+
return { json: (0, scheduling_io_1.schedPolicySetCli)(args.options) };
|
|
210
|
+
return { json: (0, scheduling_io_1.schedPolicyShowCli)(args.options) };
|
|
211
|
+
}
|
|
212
|
+
(0, registry_core_1.attachCliBinding)("sched.policy.show", { path: ["sched", "policy"], helpPath: ["sched", "policy"], jsonMode: "default", hiddenFromHelp: true, handler: schedPolicyHandler });
|
|
213
|
+
(0, registry_core_1.attachCliBinding)("sched.policy.set", { path: ["sched", "policy"], helpPath: ["sched", "policy"], jsonMode: "default", hiddenFromHelp: true, handler: schedPolicyHandler });
|
|
214
|
+
// ---- registry (refresh|show) --------------------------------------------
|
|
215
|
+
(0, registry_core_1.addCliOnlyCapability)("registry", "cw registry refresh|show [--scope repo|home] [--json] — the derived run registry index.", {
|
|
216
|
+
path: ["registry"],
|
|
217
|
+
jsonMode: "flag",
|
|
218
|
+
hiddenFromHelp: true,
|
|
219
|
+
handler: (args) => {
|
|
220
|
+
const subcommand = firstPositionalArg(args);
|
|
221
|
+
let report;
|
|
222
|
+
if (subcommand === "refresh")
|
|
223
|
+
report = (0, registry_cli_1.registryRefreshCli)(args.options);
|
|
224
|
+
else if (subcommand === "show")
|
|
225
|
+
report = (0, registry_cli_1.registryShowCli)(args.options);
|
|
226
|
+
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) };
|
|
229
|
+
},
|
|
230
|
+
}, "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);
|
|
233
|
+
// `registry.refresh`/`registry.show` each carry their own two-token
|
|
234
|
+
// cli.path (found before the ["registry"] catch-all). `hiddenFromHelp`
|
|
235
|
+
// keeps `cw help registry`'s rows coming from the single literal
|
|
236
|
+
// COMMAND_HELP_ROWS.registry block. Both are read/derive verbs, so they
|
|
237
|
+
// stay in the payload-identity probe (classified deferred until a
|
|
238
|
+
// bootstrap fixture seeds a registry index).
|
|
239
|
+
(0, registry_core_1.attachCliBinding)("registry.refresh", {
|
|
240
|
+
path: ["registry", "refresh"],
|
|
241
|
+
jsonMode: "flag",
|
|
242
|
+
hiddenFromHelp: true,
|
|
243
|
+
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) };
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
(0, registry_core_1.attachCliBinding)("registry.show", {
|
|
249
|
+
path: ["registry", "show"],
|
|
250
|
+
jsonMode: "flag",
|
|
251
|
+
hiddenFromHelp: true,
|
|
252
|
+
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) };
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
// ---- queue (add|list|drain|show) ----------------------------------------
|
|
258
|
+
(0, registry_core_1.addCliOnlyCapability)("queue", "cw queue add|list|drain|show [queue-id] [--repo PATH] [--priority N] — the durable run queue.", {
|
|
259
|
+
path: ["queue"],
|
|
260
|
+
jsonMode: "flag",
|
|
261
|
+
hiddenFromHelp: true,
|
|
262
|
+
handler: (args) => {
|
|
263
|
+
const [subcommand, id] = args.positionals;
|
|
264
|
+
switch (subcommand) {
|
|
265
|
+
case "add":
|
|
266
|
+
return { json: (0, registry_cli_1.queueAddCli)(args.options) };
|
|
267
|
+
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) };
|
|
270
|
+
}
|
|
271
|
+
case "drain":
|
|
272
|
+
return { json: (0, registry_cli_1.queueDrainCli)(args.options) };
|
|
273
|
+
case "show":
|
|
274
|
+
return { json: (0, registry_cli_1.queueShowCli)((0, io_1.required)(id, "queue id"), args.options) };
|
|
275
|
+
default:
|
|
276
|
+
throw new Error("Usage: cw.js queue add|list|drain|show [queue-id] [--repo PATH] [--priority N]");
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
}, "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);
|
|
284
|
+
// `queue add|list|drain|show` each carry their own two-token cli.path
|
|
285
|
+
// (found before the ["queue"] catch-all). `hiddenFromHelp` keeps `cw help
|
|
286
|
+
// queue`'s rows coming from the single literal COMMAND_HELP_ROWS.queue
|
|
287
|
+
// block. `queue.list` is jsonMode "flag" (human table by default); the
|
|
288
|
+
// others are always-JSON "default", matching the old build's registry.
|
|
289
|
+
(0, registry_core_1.attachCliBinding)("queue.add", {
|
|
290
|
+
path: ["queue", "add"],
|
|
291
|
+
jsonMode: "default",
|
|
292
|
+
hiddenFromHelp: true,
|
|
293
|
+
handler: (args) => ({ json: (0, registry_cli_1.queueAddCli)(args.options) }),
|
|
294
|
+
});
|
|
295
|
+
(0, registry_core_1.attachCliBinding)("queue.list", {
|
|
296
|
+
path: ["queue", "list"],
|
|
297
|
+
jsonMode: "flag",
|
|
298
|
+
hiddenFromHelp: true,
|
|
299
|
+
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) };
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
(0, registry_core_1.attachCliBinding)("queue.drain", {
|
|
305
|
+
path: ["queue", "drain"],
|
|
306
|
+
jsonMode: "default",
|
|
307
|
+
hiddenFromHelp: true,
|
|
308
|
+
handler: (args) => ({ json: (0, registry_cli_1.queueDrainCli)(args.options) }),
|
|
309
|
+
});
|
|
310
|
+
(0, registry_core_1.attachCliBinding)("queue.show", {
|
|
311
|
+
path: ["queue", "show"],
|
|
312
|
+
jsonMode: "default",
|
|
313
|
+
hiddenFromHelp: true,
|
|
314
|
+
handler: (args) => ({ json: (0, registry_cli_1.queueShowCli)((0, io_1.required)(args.positionals[0], "queue id"), args.options) }),
|
|
315
|
+
});
|
|
316
|
+
// ---- gc (plan|run|verify) ------------------------------------------------
|
|
317
|
+
(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.", {
|
|
318
|
+
path: ["gc"],
|
|
319
|
+
jsonMode: "flag",
|
|
320
|
+
hiddenFromHelp: true,
|
|
321
|
+
handler: (args) => {
|
|
322
|
+
const [subcommand, id] = args.positionals;
|
|
323
|
+
switch (subcommand) {
|
|
324
|
+
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) };
|
|
327
|
+
}
|
|
328
|
+
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) };
|
|
331
|
+
}
|
|
332
|
+
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);
|
|
335
|
+
return { json: result, text, exitCode: result.reclaimed && !result.verified ? 1 : undefined };
|
|
336
|
+
}
|
|
337
|
+
default:
|
|
338
|
+
throw new Error("Usage: cw.js gc plan|run|verify [run-id] [--reclaimAfterArchiveDays N] [--keep-scratch] [--keep-snapshots] [--limit N] [--json]");
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
}, "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);
|
|
345
|
+
// PARITY: `gc.run` frees disk and appends a tombstone; both surfaces run
|
|
346
|
+
// the identical transaction but the payload reports now-derived
|
|
347
|
+
// bytesFreed/tombstone, so it is a documented opt-out, not drift.
|
|
348
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").payloadIdentical = false;
|
|
349
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("gc.run").reason =
|
|
350
|
+
"Mutating: frees disk and appends a tombstone; both surfaces perform the identical transaction but the payload reports now-derived bytesFreed/tombstone.";
|
|
351
|
+
// PARITY: `gc.plan`/`gc.verify` now ALSO carry their own two-token
|
|
352
|
+
// cli.path ["gc","plan"]/["gc","verify"], same as the old build's
|
|
353
|
+
// registry rows and the same reversed-candidate-order pattern used for
|
|
354
|
+
// run.drive/run.search above: findCapabilityByCliPath tries the 2-token
|
|
355
|
+
// candidate before the 1-token ["gc"] catch-all row, so these rows — not
|
|
356
|
+
// the "gc" capability's combined switch — now serve `cw gc plan`/`cw gc
|
|
357
|
+
// verify`. Same functions, same output; only which row answers the
|
|
358
|
+
// dispatch changes, so both become real both-surface, dual-bound
|
|
359
|
+
// capabilities for the payload-identity probe. `gc.run` stays reachable
|
|
360
|
+
// only via the ["gc"] catch-all (it is a documented payload-probe
|
|
361
|
+
// opt-out above, so it does not need its own dual-bound row).
|
|
362
|
+
(0, registry_core_1.attachCliBinding)("gc.plan", {
|
|
363
|
+
path: ["gc", "plan"],
|
|
364
|
+
jsonMode: "flag",
|
|
365
|
+
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) };
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
(0, registry_core_1.attachCliBinding)("gc.verify", {
|
|
371
|
+
path: ["gc", "verify"],
|
|
372
|
+
jsonMode: "flag",
|
|
373
|
+
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);
|
|
376
|
+
return { json: result, text, exitCode: result.reclaimed && !result.verified ? 1 : undefined };
|
|
377
|
+
},
|
|
378
|
+
});
|
|
379
|
+
// `gc.run` also carries its own two-token cli.path ["gc","run"], same
|
|
380
|
+
// reversed-candidate-order pattern as gc.plan/gc.verify. It stays a
|
|
381
|
+
// documented payload-probe opt-out (mutating reclamation), so this row
|
|
382
|
+
// only satisfies the both-surface "cli + mcp" pairing — it does not join
|
|
383
|
+
// the payload-identity probe. `hiddenFromHelp` keeps `cw help gc`'s row
|
|
384
|
+
// coming from the single literal COMMAND_HELP_ROWS.gc entry.
|
|
385
|
+
(0, registry_core_1.attachCliBinding)("gc.run", {
|
|
386
|
+
path: ["gc", "run"],
|
|
387
|
+
jsonMode: "flag",
|
|
388
|
+
hiddenFromHelp: true,
|
|
389
|
+
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) };
|
|
392
|
+
},
|
|
393
|
+
});
|
|
394
|
+
// ---- orphans (list|gc) ---------------------------------------------------
|
|
395
|
+
(0, registry_core_1.addCliOnlyCapability)("orphans", "cw orphans list|gc — reclaim run directories a killed process never registered (no state.json).", {
|
|
396
|
+
path: ["orphans"],
|
|
397
|
+
jsonMode: "flag",
|
|
398
|
+
hiddenFromHelp: true,
|
|
399
|
+
handler: (args) => {
|
|
400
|
+
const subcommand = firstPositionalArg(args);
|
|
401
|
+
switch (subcommand) {
|
|
402
|
+
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) };
|
|
405
|
+
}
|
|
406
|
+
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) };
|
|
409
|
+
}
|
|
410
|
+
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)");
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
}, "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);
|
|
417
|
+
// `orphans.list`/`orphans.gc` each carry their own two-token cli.path
|
|
418
|
+
// (found before the ["orphans"] catch-all per the reversed-candidate
|
|
419
|
+
// order), so both are real both-surface dual-bound rows. `hiddenFromHelp`
|
|
420
|
+
// keeps `cw help orphans`'s rows coming from the single literal
|
|
421
|
+
// COMMAND_HELP_ROWS.orphans block. `orphans.gc` is a documented
|
|
422
|
+
// payload-probe opt-out (mutating sweep, now-derived freedBytes/removed),
|
|
423
|
+
// same as gc.run/clones.gc.
|
|
424
|
+
(0, registry_core_1.attachCliBinding)("orphans.list", {
|
|
425
|
+
path: ["orphans", "list"],
|
|
426
|
+
jsonMode: "flag",
|
|
427
|
+
hiddenFromHelp: true,
|
|
428
|
+
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) };
|
|
431
|
+
},
|
|
432
|
+
});
|
|
433
|
+
(0, registry_core_1.attachCliBinding)("orphans.gc", {
|
|
434
|
+
path: ["orphans", "gc"],
|
|
435
|
+
jsonMode: "flag",
|
|
436
|
+
hiddenFromHelp: true,
|
|
437
|
+
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) };
|
|
440
|
+
},
|
|
441
|
+
});
|
|
442
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").payloadIdentical = false;
|
|
443
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("orphans.gc").reason =
|
|
444
|
+
"Mutating: removes orphan run directories and reports now-derived freedBytes/removed; both surfaces perform the identical sweep.";
|
|
445
|
+
// ---- clones (list|gc) ------------------------------------------------------
|
|
446
|
+
(0, registry_core_1.addCliOnlyCapability)("clones", "cw clones list|gc [--older-than-days N] [--all] — the cached remote-source checkout cache.", {
|
|
447
|
+
path: ["clones"],
|
|
448
|
+
jsonMode: "flag",
|
|
449
|
+
hiddenFromHelp: true,
|
|
450
|
+
handler: (args) => {
|
|
451
|
+
const subcommand = firstPositionalArg(args);
|
|
452
|
+
switch (subcommand) {
|
|
453
|
+
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) };
|
|
456
|
+
}
|
|
457
|
+
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) };
|
|
460
|
+
}
|
|
461
|
+
default:
|
|
462
|
+
throw new Error("Usage: cw.js clones list [--json] | clones gc [--older-than-days N] [--all] [--json]");
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
}, "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);
|
|
468
|
+
// `clones.list`/`clones.gc` each carry their own two-token cli.path (found
|
|
469
|
+
// before the ["clones"] catch-all). `hiddenFromHelp` keeps the byte-pinned
|
|
470
|
+
// `cw help clones` fixture's rows coming from the single literal
|
|
471
|
+
// COMMAND_HELP_ROWS.clones block. `clones.gc` is a documented payload-probe
|
|
472
|
+
// opt-out (mutating sweep), same as gc.run/orphans.gc.
|
|
473
|
+
(0, registry_core_1.attachCliBinding)("clones.list", {
|
|
474
|
+
path: ["clones", "list"],
|
|
475
|
+
jsonMode: "flag",
|
|
476
|
+
hiddenFromHelp: true,
|
|
477
|
+
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) };
|
|
480
|
+
},
|
|
481
|
+
});
|
|
482
|
+
(0, registry_core_1.attachCliBinding)("clones.gc", {
|
|
483
|
+
path: ["clones", "gc"],
|
|
484
|
+
jsonMode: "flag",
|
|
485
|
+
hiddenFromHelp: true,
|
|
486
|
+
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) };
|
|
489
|
+
},
|
|
490
|
+
});
|
|
491
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").payloadIdentical = false;
|
|
492
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("clones.gc").reason =
|
|
493
|
+
"Mutating: removes cache directories and reports now-derived freedBytes/removed; both surfaces perform the identical reclamation.";
|
|
494
|
+
// ---- run search|list|show|resume|archive|rerun (2-token rows, found
|
|
495
|
+
// BEFORE the 1-token run.drive.step row per dispatchTable's reversed
|
|
496
|
+
// candidate order — see that row's own comment for why the run-registry
|
|
497
|
+
// keyword guard set still lists these words) --------------------------
|
|
498
|
+
(0, registry_core_1.attachCliBinding)("run.search", {
|
|
499
|
+
path: ["run", "search"],
|
|
500
|
+
jsonMode: "flag",
|
|
501
|
+
handler: (args) => {
|
|
502
|
+
const result = (0, registry_cli_1.runSearchCli)(args.options);
|
|
503
|
+
return { json: result, text: (0, run_registry_io_1.formatRunSearch)(result) };
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("run.search").mcp.handler = (args) => (0, registry_cli_1.runSearchCli)(args);
|
|
507
|
+
(0, registry_core_1.attachCliBinding)("run.list", {
|
|
508
|
+
path: ["run", "list"],
|
|
509
|
+
jsonMode: "flag",
|
|
510
|
+
handler: (args) => {
|
|
511
|
+
const result = (0, registry_cli_1.runListCli)(args.options);
|
|
512
|
+
return { json: result, text: (0, run_registry_io_1.formatRunSearch)(result) };
|
|
513
|
+
},
|
|
514
|
+
});
|
|
515
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("run.list").mcp.handler = (args) => (0, registry_cli_1.runListCli)(args);
|
|
516
|
+
(0, registry_core_1.attachCliBinding)("run.show", {
|
|
517
|
+
path: ["run", "show"],
|
|
518
|
+
jsonMode: "flag",
|
|
519
|
+
handler: (args) => {
|
|
520
|
+
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) };
|
|
523
|
+
},
|
|
524
|
+
});
|
|
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);
|
|
526
|
+
(0, registry_core_1.attachCliBinding)("run.resume", {
|
|
527
|
+
path: ["run", "resume"],
|
|
528
|
+
jsonMode: "flag",
|
|
529
|
+
handler: (args) => {
|
|
530
|
+
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) };
|
|
533
|
+
},
|
|
534
|
+
});
|
|
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);
|
|
536
|
+
(0, registry_core_1.attachCliBinding)("run.archive", {
|
|
537
|
+
path: ["run", "archive"],
|
|
538
|
+
jsonMode: "default",
|
|
539
|
+
handler: (args) => ({ json: (0, registry_cli_1.runArchiveCli)((0, io_1.optionalArg)(args.positionals[0]), args.options) }),
|
|
540
|
+
});
|
|
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);
|
|
542
|
+
(0, registry_core_1.attachCliBinding)("run.rerun", {
|
|
543
|
+
path: ["run", "rerun"],
|
|
544
|
+
jsonMode: "default",
|
|
545
|
+
handler: (args) => ({ json: (0, registry_cli_1.runRerunCli)((0, io_1.required)(args.positionals[0], "run id"), args.options) }),
|
|
546
|
+
});
|
|
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);
|
|
548
|
+
// ---- history ---------------------------------------------------------
|
|
549
|
+
(0, registry_core_1.attachCliBinding)("history", {
|
|
550
|
+
path: ["history"],
|
|
551
|
+
jsonMode: "flag",
|
|
552
|
+
handler: (args) => {
|
|
553
|
+
const result = (0, registry_cli_1.historyCli)(args.options);
|
|
554
|
+
return { json: result, text: (0, run_registry_io_1.formatHistory)(result) };
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
registry_core_1.REGISTRY_BY_CAPABILITY.get("history").mcp.handler = (args) => (0, registry_cli_1.historyCli)(args);
|
|
558
|
+
// ---------------------------------------------------------------------
|