cool-workflow 0.2.0 → 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.
Files changed (141) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/README.md +7 -5
  4. package/apps/architecture-review/app.json +2 -2
  5. package/apps/architecture-review/workflow.js +12 -12
  6. package/apps/architecture-review-fast/app.json +1 -1
  7. package/apps/end-to-end-golden-path/app.json +1 -1
  8. package/apps/pr-review-fix-ci/app.json +1 -1
  9. package/apps/release-cut/app.json +1 -1
  10. package/apps/research-synthesis/app.json +1 -1
  11. package/dist/cli/dispatch.js +20 -88
  12. package/dist/cli/parseargv.js +6 -3
  13. package/dist/core/capability-data.js +270 -0
  14. package/dist/core/capability-table.js +15 -3519
  15. package/dist/core/format/help.js +30 -7
  16. package/dist/core/hash.js +1 -1
  17. package/dist/core/multi-agent/candidate-scoring.js +1 -1
  18. package/dist/core/multi-agent/collaboration.js +3 -2
  19. package/dist/core/multi-agent/coordinator.js +4 -3
  20. package/dist/core/multi-agent/eval-replay.js +1 -1
  21. package/dist/core/multi-agent/runtime.js +2 -2
  22. package/dist/core/multi-agent/trust-policy.js +1 -1
  23. package/dist/core/pipeline/commit-gate.js +2 -1
  24. package/dist/core/pipeline/contract.js +1 -1
  25. package/dist/core/pipeline/drive-decide.js +1 -1
  26. package/dist/core/state/contract-migration.js +1 -1
  27. package/dist/core/state/migrations.js +2 -2
  28. package/dist/core/state/node-snapshot.js +1 -1
  29. package/dist/core/state/state-explosion/digest.js +3 -2
  30. package/dist/core/state/state-explosion/graph.js +13 -12
  31. package/dist/core/state/state-explosion/helpers.js +5 -4
  32. package/dist/core/state/state-explosion/report.js +1 -1
  33. package/dist/core/state/state-explosion/size.js +1 -1
  34. package/dist/core/state/state-node.js +2 -2
  35. package/dist/core/state/types.js +1 -1
  36. package/dist/core/trust/ledger.js +3 -2
  37. package/dist/core/trust/telemetry-attestation.js +3 -3
  38. package/dist/core/trust/telemetry-ledger.js +2 -2
  39. package/dist/core/types/execution-backend.js +18 -0
  40. package/dist/core/types/observability.js +7 -0
  41. package/dist/core/util/collate.js +23 -0
  42. package/dist/core/version.js +1 -1
  43. package/dist/core/workflow-apps/app-schema.js +1 -1
  44. package/dist/mcp/dispatch.js +1 -1
  45. package/dist/mcp/server.js +1 -1
  46. package/dist/shell/agent-config.js +1 -1
  47. package/dist/shell/audit-cli.js +46 -2
  48. package/dist/shell/commit-summary.js +2 -1
  49. package/dist/shell/doctor.js +17 -4
  50. package/dist/shell/drive.js +47 -19
  51. package/dist/shell/evidence-reasoning.js +4 -3
  52. package/dist/shell/execution-backend/agent.js +42 -10
  53. package/dist/shell/execution-backend/ci.js +1 -1
  54. package/dist/shell/execution-backend/container.js +1 -1
  55. package/dist/shell/execution-backend/envelopes.js +1 -1
  56. package/dist/shell/execution-backend/local.js +1 -1
  57. package/dist/shell/execution-backend/probes.js +1 -1
  58. package/dist/shell/execution-backend/registry.js +3 -2
  59. package/dist/shell/execution-backend/remote.js +1 -1
  60. package/dist/shell/execution-backend/types.js +0 -9
  61. package/dist/shell/fs-atomic.js +15 -2
  62. package/dist/shell/ledger-io.js +1 -1
  63. package/dist/shell/metrics-cli.js +4 -2
  64. package/dist/shell/multi-agent-host.js +1 -1
  65. package/dist/shell/multi-agent-operator-ux.js +4 -3
  66. package/dist/shell/observability.js +12 -11
  67. package/dist/shell/onramp.js +17 -1
  68. package/dist/shell/operator-ux-text.js +2 -1
  69. package/dist/shell/operator-ux.js +7 -6
  70. package/dist/shell/pipeline-cli.js +82 -72
  71. package/dist/shell/reclamation-io.js +3 -2
  72. package/dist/shell/registry-cli.js +15 -0
  73. package/dist/shell/report.js +2 -1
  74. package/dist/shell/run-registry-io.js +1 -1
  75. package/dist/shell/run-store.js +17 -0
  76. package/dist/shell/sandbox-profile.js +1 -1
  77. package/dist/shell/scheduler-io.js +46 -37
  78. package/dist/shell/scheduling-io.js +32 -22
  79. package/dist/shell/state-explosion-cli.js +2 -1
  80. package/dist/shell/telemetry-ledger-io.js +1 -1
  81. package/dist/shell/term.js +1 -1
  82. package/dist/shell/topology-io.js +2 -1
  83. package/dist/shell/trust-audit.js +45 -5
  84. package/dist/shell/workbench-host.js +9 -1
  85. package/dist/shell/workbench.js +6 -11
  86. package/dist/shell/worker-cli.js +9 -1
  87. package/dist/shell/worker-isolation.js +34 -9
  88. package/dist/shell/workflow-app-loader.js +3 -2
  89. package/dist/wiring/capability-table/basics.js +66 -0
  90. package/dist/wiring/capability-table/exec-backend.js +162 -0
  91. package/dist/wiring/capability-table/index.js +42 -0
  92. package/dist/wiring/capability-table/multi-agent.js +623 -0
  93. package/dist/wiring/capability-table/parity.js +466 -0
  94. package/dist/wiring/capability-table/pipeline.js +280 -0
  95. package/dist/wiring/capability-table/registry-core.js +189 -0
  96. package/dist/wiring/capability-table/reporting.js +394 -0
  97. package/dist/wiring/capability-table/scheduling-registry.js +558 -0
  98. package/dist/wiring/capability-table/state.js +173 -0
  99. package/dist/wiring/capability-table/trust-ledger.js +134 -0
  100. package/dist/wiring/capability-table/workflow-apps.js +366 -0
  101. package/docs/agent-delegation-drive.7.md +4 -0
  102. package/docs/cli-mcp-parity.7.md +9 -2
  103. package/docs/contract-migration-tooling.7.md +4 -0
  104. package/docs/control-plane-scheduling.7.md +4 -0
  105. package/docs/durable-state-and-locking.7.md +24 -0
  106. package/docs/evidence-adoption-reasoning-chain.7.md +4 -0
  107. package/docs/execution-backends.7.md +4 -0
  108. package/docs/index.md +1 -0
  109. package/docs/multi-agent-cli-mcp-surface.7.md +4 -0
  110. package/docs/multi-agent-eval-replay-harness.7.md +4 -0
  111. package/docs/multi-agent-operator-ux.7.md +4 -0
  112. package/docs/node-snapshot-diff-replay.7.md +4 -0
  113. package/docs/observability-cost-accounting.7.md +6 -1
  114. package/docs/project-index.md +30 -5
  115. package/docs/real-execution-backends.7.md +4 -0
  116. package/docs/release-and-migration.7.md +4 -0
  117. package/docs/release-tooling.7.md +4 -0
  118. package/docs/remote-source-review.7.md +4 -4
  119. package/docs/report-verifiable-bundle.7.md +1 -1
  120. package/docs/run-registry-control-plane.7.md +4 -0
  121. package/docs/run-retention-reclamation.7.md +4 -0
  122. package/docs/security-trust-hardening.7.md +33 -1
  123. package/docs/state-explosion-management.7.md +4 -0
  124. package/docs/team-collaboration.7.md +4 -0
  125. package/docs/trust-audit-anchor.7.md +69 -0
  126. package/docs/web-desktop-workbench.7.md +15 -1
  127. package/manifest/plugin.manifest.json +1 -1
  128. package/package.json +3 -1
  129. package/scripts/agents/agent-adapter-core.js +22 -2
  130. package/scripts/agents/claude-p-agent.js +8 -3
  131. package/scripts/agents/gemini-agent.js +5 -1
  132. package/scripts/agents/opencode-agent.js +5 -1
  133. package/scripts/bump-version.js +24 -2
  134. package/scripts/canonical-apps.js +4 -4
  135. package/scripts/dogfood-release.js +1 -1
  136. package/scripts/golden-path.js +4 -4
  137. package/scripts/purity-baseline.json +68 -0
  138. package/scripts/purity-gate.js +239 -0
  139. package/scripts/release-check.js +8 -1
  140. package/scripts/version-sync-check.js +33 -12
  141. package/workflows/README.md +19 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cool-workflow",
3
3
  "description": "A workflow control plane and run-time you are able to check: it sends out jobs in TypeScript, makes certain of work against facts before it goes through, puts state into fixed records, orders jobs by time, runs jobs again and again, gets a group of agents to do their parts together, and talks MCP. It gives the doing of the work to outside agents — it never runs the models itself.",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "author": {
6
6
  "name": "COOLWHITE LLC"
7
7
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cool-workflow",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A workflow control plane and run-time you are able to check: it sends out jobs in TypeScript, makes certain of work against facts before it goes through, puts state into fixed records, orders jobs by time, runs jobs again and again, gets a group of agents to do their parts together, and talks MCP. It gives the doing of the work to outside agents — it never runs the models itself.",
5
5
  "author": {
6
6
  "name": "COOLWHITE LLC"
package/README.md CHANGED
@@ -64,16 +64,18 @@ cw demo tamper
64
64
  ### 2 · Ask a question about your code — one command
65
65
 
66
66
  ```bash
67
- cw -q "What are the main risks here?"
67
+ cw -q "How does auth work end-to-end here?"
68
68
  ```
69
69
 
70
- CW auto-detects the current repo and the first agent on your `PATH`. Pin a specific one with a flag
71
- (`-claude`, `-codex`, `-gemini`, `-deepseek`). Point it anywhere no `cd` required or review a
72
- **remote repo by URL** and CW clones, snapshots, and reviews the checkout:
70
+ Any question works, not only a risk audit architecture questions, "is it safe to change X",
71
+ "what would break if Y rotated" all get a direct, cited answer. CW auto-detects the current repo
72
+ and the first agent on your `PATH`. Pin a specific one with a flag (`-claude`, `-codex`, `-gemini`,
73
+ `-deepseek`). Point it anywhere — no `cd` required — or review a **remote repo by URL** and CW
74
+ clones, snapshots, and reviews the checkout:
73
75
 
74
76
  ```bash
75
77
  cw -q "What are the security risks?" -dir /path/to/project
76
- cw -q "What are the risks?" --link https://github.com/owner/repo
78
+ cw -q "Is it safe to swap this queue for Redis?" --link https://github.com/owner/repo
77
79
  ```
78
80
 
79
81
  **Not just code.** Aim CW at a folder of docs, notes, or papers and it reads them as sources for the
@@ -3,7 +3,7 @@
3
3
  "id": "architecture-review",
4
4
  "title": "Architecture Review",
5
5
  "summary": "Map a repository architecture, assess risks, verify important findings, and synthesize an evidence-backed verdict.",
6
- "version": "0.2.0",
6
+ "version": "0.2.2",
7
7
  "author": "COOLWHITE LLC",
8
8
  "inputs": [
9
9
  {
@@ -16,7 +16,7 @@
16
16
  "name": "question",
17
17
  "type": "string",
18
18
  "required": true,
19
- "description": "Architecture question or decision to review."
19
+ "description": "Architecture question or decision to review. Every phase scopes its work to this question - not only a fixed risk list."
20
20
  },
21
21
  {
22
22
  "name": "invariant",
@@ -8,7 +8,7 @@ module.exports = ({ workflow, phase, parallel, agent, artifact, input }) => {
8
8
  input("question", {
9
9
  type: "string",
10
10
  required: true,
11
- description: "Architecture question or decision to review."
11
+ description: "Architecture question or decision to review. Every phase scopes its work to this question - not only a fixed risk list."
12
12
  }),
13
13
  input("invariant", {
14
14
  type: "string",
@@ -41,54 +41,54 @@ module.exports = ({ workflow, phase, parallel, agent, artifact, input }) => {
41
41
  ),
42
42
  agent(
43
43
  "map:web-client",
44
- "Map web/client/UI boundaries, local state, backend dependencies, build/runtime assumptions, and candidate risks in {{repo}}. Focus: {{focus}}. Return exact files and commands that informed the map.",
44
+ "Map web/client/UI boundaries, local state, backend dependencies, build/runtime assumptions, and candidate risks in {{repo}} as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Return exact files and commands that informed the map.",
45
45
  { sandboxProfileId: "readonly" }
46
46
  ),
47
47
  agent(
48
48
  "map:db-security",
49
- "Map database, persistence, migrations, secrets, auth, permissions, and security-sensitive paths in {{repo}}. Return candidate risks with file paths, config names, and uncertainty boundaries.",
49
+ "Map database, persistence, migrations, secrets, auth, permissions, and security-sensitive paths in {{repo}} as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Return candidate risks with file paths, config names, and uncertainty boundaries.",
50
50
  { sandboxProfileId: "readonly" }
51
51
  ),
52
52
  agent(
53
53
  "map:deploy-config",
54
- "Map deployment, CI, package scripts, Docker or compose files, reverse proxies, environment config, supervision, and operational assumptions. Return concrete files and release or runtime risks.",
54
+ "Map deployment, CI, package scripts, Docker or compose files, reverse proxies, environment config, supervision, and operational assumptions in {{repo}} as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Return concrete files and release or runtime risks.",
55
55
  { sandboxProfileId: "readonly" }
56
56
  ),
57
57
  agent(
58
58
  "map:jobs-operators",
59
- "Map background jobs, admin/operator surfaces, queues, scheduled work, generated files, state transitions, and failure recovery paths. Identify missing or non-applicable areas explicitly.",
59
+ "Map background jobs, admin/operator surfaces, queues, scheduled work, generated files, state transitions, and failure recovery paths in {{repo}} as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Identify missing or non-applicable areas explicitly.",
60
60
  { sandboxProfileId: "readonly" }
61
61
  ),
62
62
  agent(
63
63
  "map:transport-core",
64
- "Map protocol, daemon, transport, rendering, networking, worker isolation, or core engine boundaries when present. If absent, explain why with inspected evidence.",
64
+ "Map protocol, daemon, transport, rendering, networking, worker isolation, or core engine boundaries when present in {{repo}}, as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. If absent, explain why with inspected evidence.",
65
65
  { sandboxProfileId: "readonly" }
66
66
  )
67
67
  ]),
68
68
  parallel("Assess", [
69
69
  agent(
70
70
  "assess:security",
71
- "Assess mapper findings through a security lens. Separate real, conditional, non-issue, and unknown risks with evidence, falsifiers, and exact files or config keys.",
71
+ "Assess mapper findings through a security lens as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Separate real, conditional, non-issue, and unknown risks with evidence, falsifiers, and exact files or config keys.",
72
72
  { sandboxProfileId: "readonly" }
73
73
  ),
74
74
  agent(
75
75
  "assess:data-correctness",
76
- "Assess data correctness, schema drift, persistence invariants, concurrency, transactions, cache behavior, and state corruption risks. Tie every important claim to inspected evidence.",
76
+ "Assess data correctness, schema drift, persistence invariants, concurrency, transactions, cache behavior, and state corruption risks as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Tie every important claim to inspected evidence.",
77
77
  { sandboxProfileId: "readonly" }
78
78
  ),
79
79
  agent(
80
80
  "assess:failure-modes",
81
- "Assess startup, shutdown, retries, partial failure, dependency outage, backup/restore, release rollback, and recovery behavior. Identify deterministic commands that could verify the claims.",
81
+ "Assess startup, shutdown, retries, partial failure, dependency outage, backup/restore, release rollback, and recovery behavior as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Identify deterministic commands that could verify the claims.",
82
82
  { sandboxProfileId: "readonly" }
83
83
  ),
84
84
  agent(
85
85
  "assess:scale-ops",
86
- "Assess scale, operational complexity, observability, configuration, packaging, deployment, and maintenance risks. Include exact files, scripts, or missing controls.",
86
+ "Assess scale, operational complexity, observability, configuration, packaging, deployment, and maintenance risks as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Include exact files, scripts, or missing controls.",
87
87
  { sandboxProfileId: "readonly" }
88
88
  ),
89
89
  agent(
90
90
  "assess:maintainability",
91
- "Assess module boundaries, ownership clarity, coupling, extensibility, testability, and future change risk. Distinguish architectural risks from style preferences.",
91
+ "Assess module boundaries, ownership clarity, coupling, extensibility, testability, and future change risk as they relate to {{question}}. Focus: {{focus}}. Invariants: {{invariant}}. Distinguish architectural risks from style preferences.",
92
92
  { sandboxProfileId: "readonly" }
93
93
  ),
94
94
  agent(
@@ -100,7 +100,7 @@ module.exports = ({ workflow, phase, parallel, agent, artifact, input }) => {
100
100
  phase("Verify", [
101
101
  agent(
102
102
  "verify:p0-p2-risks",
103
- "Re-open evidence for every candidate P0/P1/P2 risk. Confirm real risks, downgrade unsupported concerns, and list exact file paths, commands, logs, or unknowns. The cw:result evidence array must cite durable locators.",
103
+ "Re-open evidence for every candidate P0/P1/P2 risk found so far, judged against {{question}}. Confirm real risks, downgrade unsupported concerns, and list exact file paths, commands, logs, or unknowns. The cw:result evidence array must cite durable locators.",
104
104
  { requiresEvidence: true, sandboxProfileId: "readonly" }
105
105
  )
106
106
  ]),
@@ -3,7 +3,7 @@
3
3
  "id": "architecture-review-fast",
4
4
  "title": "Architecture Review Fast",
5
5
  "summary": "Run a shorter architecture review with parallel map and assess phases for faster first results.",
6
- "version": "0.2.0",
6
+ "version": "0.2.2",
7
7
  "author": "COOLWHITE LLC",
8
8
  "inputs": [
9
9
  {
@@ -3,7 +3,7 @@
3
3
  "id": "end-to-end-golden-path",
4
4
  "title": "End-to-End Golden Path",
5
5
  "summary": "Deterministic one-worker workflow app for proving the CW integration chain.",
6
- "version": "0.2.0",
6
+ "version": "0.2.2",
7
7
  "author": "COOLWHITE LLC",
8
8
  "inputs": [
9
9
  {
@@ -3,7 +3,7 @@
3
3
  "id": "pr-review-fix-ci",
4
4
  "title": "PR Review Fix CI",
5
5
  "summary": "Review a pull request or branch, inspect CI failures, diagnose actionable issues, optionally patch, verify, and summarize with evidence.",
6
- "version": "0.2.0",
6
+ "version": "0.2.2",
7
7
  "author": "COOLWHITE LLC",
8
8
  "inputs": [
9
9
  {
@@ -3,7 +3,7 @@
3
3
  "id": "release-cut",
4
4
  "title": "Release Cut",
5
5
  "summary": "Prepare a release with checklist discipline: version checks, changelog, tests, packaging, release notes, and final verification.",
6
- "version": "0.2.0",
6
+ "version": "0.2.2",
7
7
  "author": "COOLWHITE LLC",
8
8
  "inputs": [
9
9
  {
@@ -3,7 +3,7 @@
3
3
  "id": "research-synthesis",
4
4
  "title": "Research Synthesis",
5
5
  "summary": "Split a research question into claims, investigate sources, cross-check evidence, verify claims, and synthesize a concise answer.",
6
- "version": "0.2.0",
6
+ "version": "0.2.2",
7
7
  "author": "COOLWHITE LLC",
8
8
  "inputs": [
9
9
  {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // cli/dispatch.ts — the generic CLI executor over core/capability-table.ts.
3
3
  //
4
- // MILESTONE 2 (v2/PLAN.md build order, step 2; see the Revision note there
4
+ // MILESTONE 2 (docs/rebuild/PLAN.md build order, step 2; see the Revision note there
5
5
  // for why this lands here, right after CLI parsing, instead of late).
6
6
  //
7
7
  // `dispatch(args)` first tries the CAPABILITY TABLE: it looks up the row
@@ -16,7 +16,7 @@
16
16
  // cli-argv-parsing.case.js and cli-exit-codes.case.js probe but that do
17
17
  // not yet have a real subsystem behind them (see each case's own
18
18
  // PLACEHOLDER comment for which future milestone owns it). Per the
19
- // Revision note in v2/PLAN.md, THIS file is never hand-extended again —
19
+ // Revision note in docs/rebuild/PLAN.md, THIS file is never hand-extended again —
20
20
  // `dispatchLegacy`'s arms shrink to nothing as later milestones move each
21
21
  // one into a real capability-table row; nothing new is ever added here.
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -27,7 +27,6 @@ const capability_table_1 = require("../core/capability-table");
27
27
  const parseargv_1 = require("./parseargv");
28
28
  Object.defineProperty(exports, "KNOWN_COMMANDS", { enumerable: true, get: function () { return parseargv_1.KNOWN_COMMANDS; } });
29
29
  const io_1 = require("./io");
30
- const workflow_app_loader_1 = require("../shell/workflow-app-loader");
31
30
  function firstPositional(args, index = 0) {
32
31
  return args.positionals[index];
33
32
  }
@@ -75,26 +74,13 @@ function dispatchTable(args) {
75
74
  }
76
75
  return false;
77
76
  }
78
- // MILESTONE 12 (workflow-apps) — `search` filters the SAME real app
79
- // discovery `cw app list`/`cw list` use (shell/workflow-app-loader.ts),
80
- // by id/title/summary, matching `listApps` in the old build.
81
- function formatSearchResults(keyword, results) {
82
- if (results.length === 0) {
83
- return `No workflows matched "${keyword}".\n Tip: cw list for all available workflows.`;
84
- }
85
- const lines = [`${results.length} workflow${results.length === 1 ? "" : "s"} matching "${keyword}"`];
86
- for (const r of results) {
87
- lines.push(` ${r.id} — ${r.title}`);
88
- const cut = r.summary.length > 120 ? `${r.summary.slice(0, 119)}…` : r.summary;
89
- lines.push(` ${cut}`);
90
- }
91
- lines.push("");
92
- lines.push("Use cw info <id> for full details.");
93
- return lines.join("\n");
94
- }
95
77
  /** The milestone-1 carry-over switch. See file header: never extended
96
78
  * again — each arm here is replaced by a capability-table row when its
97
- * own build-order milestone lands, not edited in place. */
79
+ * own build-order milestone lands, not edited in place. Only entry-level
80
+ * concerns live here now (bare help, and the two verbs a real
81
+ * capability-table row can never fully own): every other verb this
82
+ * switch used to carry is now a table row (see the NOTEs below) and
83
+ * dispatchTable() above always matches it first. */
98
84
  function dispatchLegacy(args) {
99
85
  switch (args.command) {
100
86
  case "": {
@@ -114,38 +100,15 @@ function dispatchLegacy(args) {
114
100
  // NOTE: "version" is not an arm here — it is a real capability-table
115
101
  // row (core/capability-table.ts) that dispatchTable() above always
116
102
  // matches first, per the Revision note's "table rows, never a new
117
- // switch arm" rule. Same for "list", "status", and "sandbox list".
118
- // `search` filters the real app discovery by title/summary/id (see
119
- // note above); MILESTONE 12.
120
- case "search": {
121
- const keyword = args.positionals.join(" ");
122
- if (!keyword.trim()) {
123
- throw new Error('Missing search keyword.\n Tip: cw search architecture to find workflows about architecture.');
124
- }
125
- const lower = keyword.toLowerCase();
126
- const results = (0, workflow_app_loader_1.listWorkflowApps)()
127
- .filter((a) => String(a.title).toLowerCase().includes(lower) ||
128
- String(a.summary).toLowerCase().includes(lower) ||
129
- String(a.id).toLowerCase().includes(lower))
130
- .map((a) => ({ id: String(a.id), title: String(a.title), summary: String(a.summary) }));
131
- if ((0, io_1.wantsJson)(args.options)) {
132
- (0, io_1.printJson)(results);
133
- }
134
- else {
135
- process.stdout.write(`${formatSearchResults(keyword, results)}\n`);
136
- }
137
- return;
138
- }
103
+ // switch arm" rule. Same for "list", "status", "sandbox list", and
104
+ // "search" (a cli-only row, hiddenFromHelp, so `cw help search` keeps
105
+ // its existing "Unknown command" text).
139
106
  // NOTE: "plan" and "quickstart" are not arms here any more — both are
140
107
  // now real capability-table rows (core/capability-table.ts, milestone
141
108
  // 6+7) that dispatchTable() above always matches first.
142
- // PLACEHOLDER (milestone 3/6, state kernel + pipeline) — real `next`
143
- // loads run state and returns dispatchable tasks; this milestone only
144
- // reproduces the io.required missing-run-id refusal.
145
- case "next": {
146
- const runId = (0, io_1.required)((0, io_1.optionalArg)(firstPositional(args)), "run id");
147
- throw new Error(`next is not implemented in this milestone (runId=${runId})`);
148
- }
109
+ // NOTE: "next" is not an arm here any more it is a real
110
+ // capability-table row (core/capability-table.ts) that dispatchTable()
111
+ // above always matches first.
149
112
  // MILESTONE 8 — `ledger propose|review|verify|apply|list` are now
150
113
  // real capability-table rows (core/capability-table.ts) that
151
114
  // dispatchTable() above always matches first; this arm is reached
@@ -157,30 +120,9 @@ function dispatchLegacy(args) {
157
120
  case "ledger": {
158
121
  throw new Error("Usage: cw ledger propose|review|verify|apply|list [options]");
159
122
  }
160
- // PLACEHOLDER (milestone 10, scheduling/gc)real `gc verify` checks
161
- // whether a run's disk footprint was actually reclaimed; a run that
162
- // was never reclaimed is not a failure (exit 0), which is exactly the
163
- // shape this stub reproduces for an unresolvable run id.
164
- case "gc": {
165
- const sub = firstPositional(args);
166
- if (sub === "verify") {
167
- const runId = (0, io_1.optionalArg)(firstPositional(args, 1));
168
- const payload = {
169
- schemaVersion: 1,
170
- runId: runId ?? null,
171
- reclaimed: false,
172
- verified: false,
173
- tier: "live",
174
- capability: "re-runnable",
175
- chainLength: 0,
176
- checks: [{ name: "located", pass: false, code: "not-reclaimed", detail: "run source not found" }],
177
- nextAction: "node scripts/cw.js registry refresh --scope home",
178
- };
179
- (0, io_1.printJson)(payload);
180
- return;
181
- }
182
- throw new Error(`gc ${sub ?? ""} is not implemented in this milestone`);
183
- }
123
+ // NOTE: "gc" is not an arm here any more — gc.plan/gc.run/gc.verify
124
+ // are now real capability-table rows (core/capability-table.ts) that
125
+ // dispatchTable() above always matches first.
184
126
  // NOTE: "run" is not an arm here any more — run.drive.step/run.drive
185
127
  // are now real capability-table rows (core/capability-table.ts,
186
128
  // milestone 6+7) that dispatchTable() above always matches first
@@ -196,20 +138,10 @@ function dispatchLegacy(args) {
196
138
  // (core/capability-table.ts, milestone 9) that dispatchTable() above
197
139
  // always matches first, per the Revision note's "table rows, never a
198
140
  // new switch arm" rule.
199
- // PLACEHOLDER (milestone 3/4, state kernel + contract-migration)
200
- // real `migration check`/`prove` resolve a run id or file target; the
201
- // missing-target refusal is the only shape this milestone reproduces.
202
- case "migration": {
203
- const sub = firstPositional(args);
204
- if (sub === "check" || sub === "prove") {
205
- const target = (0, io_1.optionalArg)(firstPositional(args, 1));
206
- if (!target) {
207
- throw new Error('Missing target (run-id or state/app file).\n Tip: find run ids with "cw run list" or create one with "cw quickstart"');
208
- }
209
- throw new Error(`migration ${sub} is not implemented in this milestone`);
210
- }
211
- throw new Error(`migration ${sub ?? ""} is not implemented in this milestone`);
212
- }
141
+ // NOTE: "migration" is not an arm here any more migration.list/
142
+ // check/prove are now real capability-table rows
143
+ // (core/capability-table.ts) that dispatchTable() above always
144
+ // matches first.
213
145
  // NOTE: "report" is not an arm here any more — report/report.bundle/
214
146
  // report.verify-bundle are now real capability-table rows
215
147
  // (core/capability-table.ts, milestones 8/11) that dispatchTable()
@@ -2,7 +2,7 @@
2
2
  // cli/parseargv.ts — parseArgv, KNOWN_COMMANDS, suggestCommand.
3
3
  //
4
4
  // Pure. Byte-exact port of src/orchestrator.ts:789-887 in the old build.
5
- // See v2/PLAN.md byte-compat item 15 and SPEC/cli-surface.md "Argument
5
+ // See docs/rebuild/PLAN.md byte-compat item 15 and SPEC/cli-surface.md "Argument
6
6
  // parsing (parseArgv)" / SPEC/orchestrator.md "Module-level exports".
7
7
  //
8
8
  // Rules (do not "clean up" — every one of these is pinned by a conformance
@@ -103,7 +103,10 @@ function parseArgv(argv) {
103
103
  /** src/orchestrator.ts:842-851 — every top-level command name, used for
104
104
  * "did you mean". NOTE: this deliberately does NOT include "ledger" even
105
105
  * though the dispatcher handles it and formatHelp lists it — a known,
106
- * intentionally-preserved wart (see v2/PLAN.md "Kept byte-for-byte"). */
106
+ * intentionally-preserved wart (see docs/rebuild/PLAN.md "Kept byte-for-byte").
107
+ * NOTE: "update" is gone from the old capture's list on purpose: no code
108
+ * was behind the verb in this build, so having it here made `cw update`
109
+ * say "Did you mean: update?" — a hint that points at itself. */
107
110
  exports.KNOWN_COMMANDS = new Set([
108
111
  "help", "list", "doctor", "info", "search", "man", "init", "quickstart",
109
112
  "plan", "status", "next", "dispatch", "result", "state", "commit", "report",
@@ -112,7 +115,7 @@ exports.KNOWN_COMMANDS = new Set([
112
115
  "run", "queue", "clones", "orphans", "history", "audit-run", "multi-agent",
113
116
  "topology", "summary", "blackboard", "coordinator", "metrics", "operator",
114
117
  "sched", "gc", "telemetry", "migration", "demo", "workbench", "approve",
115
- "reject", "comment", "handoff", "graph", "eval", "version", "update", "fix",
118
+ "reject", "comment", "handoff", "graph", "eval", "version", "fix",
116
119
  ]);
117
120
  /** Levenshtein edit distance between two strings. */
118
121
  function levenshtein(a, b) {