@paths.design/caws-cli 11.1.7 → 11.1.8

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 (158) hide show
  1. package/dist/index.js +55 -58
  2. package/dist/init/hook-packs/manifest-claude-code.d.ts +1 -1
  3. package/dist/init/hook-packs/manifest-claude-code.d.ts.map +1 -1
  4. package/dist/init/hook-packs/manifest-claude-code.js +260 -2
  5. package/dist/init/hook-packs/manifest-claude-code.js.map +1 -1
  6. package/dist/shell/binding/resolve-binding.d.ts.map +1 -1
  7. package/dist/shell/binding/resolve-binding.js +105 -1
  8. package/dist/shell/binding/resolve-binding.js.map +1 -1
  9. package/dist/shell/binding/types.d.ts +47 -3
  10. package/dist/shell/binding/types.d.ts.map +1 -1
  11. package/dist/shell/command-metadata.d.ts +93 -0
  12. package/dist/shell/command-metadata.d.ts.map +1 -0
  13. package/dist/shell/command-metadata.js +687 -0
  14. package/dist/shell/command-metadata.js.map +1 -0
  15. package/dist/shell/commands/agents.d.ts +1 -2
  16. package/dist/shell/commands/agents.d.ts.map +1 -1
  17. package/dist/shell/commands/claim.d.ts +16 -0
  18. package/dist/shell/commands/claim.d.ts.map +1 -1
  19. package/dist/shell/commands/claim.js +85 -26
  20. package/dist/shell/commands/claim.js.map +1 -1
  21. package/dist/shell/commands/events.d.ts +106 -0
  22. package/dist/shell/commands/events.d.ts.map +1 -0
  23. package/dist/shell/commands/events.js +510 -0
  24. package/dist/shell/commands/events.js.map +1 -0
  25. package/dist/shell/commands/gates.d.ts +2 -2
  26. package/dist/shell/commands/gates.d.ts.map +1 -1
  27. package/dist/shell/commands/gates.js +106 -25
  28. package/dist/shell/commands/gates.js.map +1 -1
  29. package/dist/shell/commands/init.d.ts.map +1 -1
  30. package/dist/shell/commands/init.js +26 -0
  31. package/dist/shell/commands/init.js.map +1 -1
  32. package/dist/shell/commands/prepush.d.ts +26 -0
  33. package/dist/shell/commands/prepush.d.ts.map +1 -0
  34. package/dist/shell/commands/prepush.js +373 -0
  35. package/dist/shell/commands/prepush.js.map +1 -0
  36. package/dist/shell/commands/scope.d.ts.map +1 -1
  37. package/dist/shell/commands/scope.js +31 -1
  38. package/dist/shell/commands/scope.js.map +1 -1
  39. package/dist/shell/commands/specs.d.ts +44 -3
  40. package/dist/shell/commands/specs.d.ts.map +1 -1
  41. package/dist/shell/commands/specs.js +411 -15
  42. package/dist/shell/commands/specs.js.map +1 -1
  43. package/dist/shell/commands/worktree.d.ts.map +1 -1
  44. package/dist/shell/commands/worktree.js +51 -1
  45. package/dist/shell/commands/worktree.js.map +1 -1
  46. package/dist/shell/gates/disposition.d.ts.map +1 -1
  47. package/dist/shell/gates/disposition.js +43 -2
  48. package/dist/shell/gates/disposition.js.map +1 -1
  49. package/dist/shell/index.d.ts +10 -4
  50. package/dist/shell/index.d.ts.map +1 -1
  51. package/dist/shell/index.js +22 -2
  52. package/dist/shell/index.js.map +1 -1
  53. package/dist/shell/legacy-command-map.js +832 -0
  54. package/dist/shell/push-range/classify-range.d.ts +99 -0
  55. package/dist/shell/push-range/classify-range.d.ts.map +1 -0
  56. package/dist/shell/push-range/classify-range.js +155 -0
  57. package/dist/shell/push-range/classify-range.js.map +1 -0
  58. package/dist/shell/push-range/scope-match.d.ts +13 -0
  59. package/dist/shell/push-range/scope-match.d.ts.map +1 -0
  60. package/dist/shell/push-range/scope-match.js +53 -0
  61. package/dist/shell/push-range/scope-match.js.map +1 -0
  62. package/dist/shell/register.d.ts.map +1 -1
  63. package/dist/shell/register.js +263 -228
  64. package/dist/shell/register.js.map +1 -1
  65. package/dist/shell/registered-command-groups.js +48 -0
  66. package/dist/shell/rules.d.ts +19 -0
  67. package/dist/shell/rules.d.ts.map +1 -1
  68. package/dist/shell/rules.js +27 -0
  69. package/dist/shell/rules.js.map +1 -1
  70. package/dist/shell/session/resolve-session.d.ts +29 -1
  71. package/dist/shell/session/resolve-session.d.ts.map +1 -1
  72. package/dist/shell/session/resolve-session.js +817 -11
  73. package/dist/shell/session/resolve-session.js.map +1 -1
  74. package/dist/shell/session/types.d.ts +127 -1
  75. package/dist/shell/session/types.d.ts.map +1 -1
  76. package/dist/shell/session/types.js +10 -4
  77. package/dist/shell/session/types.js.map +1 -1
  78. package/dist/store/doctor-snapshot.d.ts.map +1 -1
  79. package/dist/store/doctor-snapshot.js +26 -0
  80. package/dist/store/doctor-snapshot.js.map +1 -1
  81. package/dist/store/events-migration.d.ts +207 -0
  82. package/dist/store/events-migration.d.ts.map +1 -0
  83. package/dist/store/events-migration.js +358 -0
  84. package/dist/store/events-migration.js.map +1 -0
  85. package/dist/store/events-store.d.ts +47 -1
  86. package/dist/store/events-store.d.ts.map +1 -1
  87. package/dist/store/events-store.js +278 -0
  88. package/dist/store/events-store.js.map +1 -1
  89. package/dist/store/git-autocommit.d.ts +46 -0
  90. package/dist/store/git-autocommit.d.ts.map +1 -0
  91. package/dist/store/git-autocommit.js +198 -0
  92. package/dist/store/git-autocommit.js.map +1 -0
  93. package/dist/store/index.d.ts +4 -1
  94. package/dist/store/index.d.ts.map +1 -1
  95. package/dist/store/index.js +7 -1
  96. package/dist/store/index.js.map +1 -1
  97. package/dist/store/leases-store.d.ts.map +1 -1
  98. package/dist/store/leases-store.js +58 -0
  99. package/dist/store/leases-store.js.map +1 -1
  100. package/dist/store/rules.d.ts +53 -0
  101. package/dist/store/rules.d.ts.map +1 -1
  102. package/dist/store/rules.js +54 -0
  103. package/dist/store/rules.js.map +1 -1
  104. package/dist/store/specs-migration.d.ts +128 -0
  105. package/dist/store/specs-migration.d.ts.map +1 -0
  106. package/dist/store/specs-migration.js +481 -0
  107. package/dist/store/specs-migration.js.map +1 -0
  108. package/dist/store/specs-store.d.ts.map +1 -1
  109. package/dist/store/specs-store.js +14 -2
  110. package/dist/store/specs-store.js.map +1 -1
  111. package/dist/store/specs-writer.d.ts +130 -3
  112. package/dist/store/specs-writer.d.ts.map +1 -1
  113. package/dist/store/specs-writer.js +941 -102
  114. package/dist/store/specs-writer.js.map +1 -1
  115. package/dist/store/types.d.ts +6 -0
  116. package/dist/store/types.d.ts.map +1 -1
  117. package/dist/store/waivers-store.d.ts.map +1 -1
  118. package/dist/store/waivers-store.js +8 -1
  119. package/dist/store/waivers-store.js.map +1 -1
  120. package/dist/store/worktrees-writer.d.ts +28 -0
  121. package/dist/store/worktrees-writer.d.ts.map +1 -1
  122. package/dist/store/worktrees-writer.js +110 -12
  123. package/dist/store/worktrees-writer.js.map +1 -1
  124. package/package.json +5 -2
  125. package/templates/hook-packs/claude-code/CLAUDE.md +7 -1
  126. package/templates/hook-packs/claude-code/agent-heartbeat.sh +1 -1
  127. package/templates/hook-packs/claude-code/agent-register.sh +1 -1
  128. package/templates/hook-packs/claude-code/agent-stop.sh +1 -1
  129. package/templates/hook-packs/claude-code/audit.sh +1 -1
  130. package/templates/hook-packs/claude-code/block-dangerous.sh +1 -1
  131. package/templates/hook-packs/claude-code/classify_command.py +1 -1
  132. package/templates/hook-packs/claude-code/cwd-guard.sh +30 -0
  133. package/templates/hook-packs/claude-code/dispatch/post_tool_use.sh +15 -4
  134. package/templates/hook-packs/claude-code/dispatch/pre_tool_use.sh +10 -2
  135. package/templates/hook-packs/claude-code/dispatch/session_start.sh +1 -1
  136. package/templates/hook-packs/claude-code/dispatch/stop.sh +2 -2
  137. package/templates/hook-packs/claude-code/duplicate-export-check.sh +156 -0
  138. package/templates/hook-packs/claude-code/god-object-check.sh +102 -0
  139. package/templates/hook-packs/claude-code/guard-strikes.sh +1 -1
  140. package/templates/hook-packs/claude-code/lib/parse-input.sh +115 -1
  141. package/templates/hook-packs/claude-code/lib/run-handlers.sh +1 -1
  142. package/templates/hook-packs/claude-code/loc-delta-check.sh +91 -0
  143. package/templates/hook-packs/claude-code/naming-check.sh +128 -0
  144. package/templates/hook-packs/claude-code/plan-transcript-finalize.sh +59 -0
  145. package/templates/hook-packs/claude-code/plan-transcript-snapshot.sh +86 -0
  146. package/templates/hook-packs/claude-code/protected-paths.sh +59 -0
  147. package/templates/hook-packs/claude-code/quiet-merge.sh +68 -0
  148. package/templates/hook-packs/claude-code/reset-danger-latch.sh +1 -1
  149. package/templates/hook-packs/claude-code/reset-strikes.sh +1 -1
  150. package/templates/hook-packs/claude-code/runtime-paths.sh +1 -1
  151. package/templates/hook-packs/claude-code/scan-secrets.sh +98 -0
  152. package/templates/hook-packs/claude-code/scope-guard.sh +47 -65
  153. package/templates/hook-packs/claude-code/session-caws-status.sh +1 -1
  154. package/templates/hook-packs/claude-code/session-log.sh +1 -1
  155. package/templates/hook-packs/claude-code/session_log_renderer.py +956 -0
  156. package/templates/hook-packs/claude-code/shortcut-language-check.sh +147 -0
  157. package/templates/hook-packs/claude-code/worktree-guard.sh +1 -1
  158. package/templates/hook-packs/claude-code/worktree-write-guard.sh +1 -1
@@ -0,0 +1,832 @@
1
+ 'use strict';
2
+
3
+ // Runtime mirror of docs/v11-surface-matrix.yaml.
4
+ //
5
+ // This module is the only authority the runtime should consume — the YAML
6
+ // at docs/v11-surface-matrix.yaml is human-edited doctrine and is NOT
7
+ // bundled in the npm tarball (see packages/caws-cli/package.json `files`).
8
+ // The two surfaces are kept semantically equivalent by the test at
9
+ // packages/caws-cli/tests/matrix/surface-matrix-completeness.test.js —
10
+ // drift in either authority fails the test.
11
+ //
12
+ // This slice (CAWS-V11-COMMAND-MATRIX-LOCK-001) only exports the map and
13
+ // the registered-group list. No runtime consumer imports it yet.
14
+ // CAWS-REMOVED-COMMAND-DIAGNOSTICS-001 wires consumption in Slice 2.
15
+ //
16
+ // Field naming: the JS surface uses camelCase (v11Status, runtimeDiagnostic,
17
+ // implementationProbe, sourceDocs). The YAML uses snake_case. The equivalence
18
+ // test normalizes both sides before comparing.
19
+
20
+ const SCHEMA_VERSION = 1;
21
+
22
+ const V11_REGISTERED_GROUPS = Object.freeze([
23
+ 'init',
24
+ 'doctor',
25
+ 'scope',
26
+ 'status',
27
+ 'claim',
28
+ 'gates',
29
+ 'evidence',
30
+ 'events',
31
+ 'waiver',
32
+ 'specs',
33
+ 'worktree',
34
+ 'agents',
35
+ 'prepush',
36
+ ]);
37
+
38
+ function entry(o) {
39
+ const probe = Object.freeze({
40
+ group: o.implementationProbe.group ?? null,
41
+ subcommand: o.implementationProbe.subcommand ?? null,
42
+ });
43
+ const diag = {
44
+ kind: o.runtimeDiagnostic.kind,
45
+ message: o.runtimeDiagnostic.message,
46
+ };
47
+ if (Array.isArray(o.runtimeDiagnostic.use)) {
48
+ diag.use = Object.freeze([...o.runtimeDiagnostic.use]);
49
+ }
50
+ return Object.freeze({
51
+ command: o.command,
52
+ disposition: o.disposition,
53
+ v11Status: o.v11Status,
54
+ replacement: o.replacement ?? null,
55
+ since: o.since ?? null,
56
+ sourceDocs: Object.freeze([...o.sourceDocs]),
57
+ implementationProbe: probe,
58
+ runtimeDiagnostic: Object.freeze(diag),
59
+ });
60
+ }
61
+
62
+ const LEGACY_COMMAND_MAP = Object.freeze([
63
+ // ─── Replaced ───
64
+ entry({
65
+ command: 'validate',
66
+ disposition: 'replaced',
67
+ v11Status: 'shipped',
68
+ replacement: 'caws doctor && caws gates run --spec <id>',
69
+ since: '11.0',
70
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
71
+ implementationProbe: { group: 'doctor' },
72
+ runtimeDiagnostic: {
73
+ kind: 'replaced',
74
+ message: 'caws validate was replaced in v11.',
75
+ use: ['caws doctor', 'caws gates run --spec <id>'],
76
+ },
77
+ }),
78
+ entry({
79
+ command: 'verify',
80
+ disposition: 'replaced',
81
+ v11Status: 'shipped',
82
+ replacement: 'caws doctor && caws gates run --spec <id>',
83
+ since: '11.0',
84
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
85
+ implementationProbe: { group: 'doctor' },
86
+ runtimeDiagnostic: {
87
+ kind: 'replaced',
88
+ message: 'caws verify was replaced in v11 (alias of validate).',
89
+ use: ['caws doctor', 'caws gates run --spec <id>'],
90
+ },
91
+ }),
92
+ entry({
93
+ command: 'diagnose',
94
+ disposition: 'replaced',
95
+ v11Status: 'shipped',
96
+ replacement: 'caws doctor',
97
+ since: '11.0',
98
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
99
+ implementationProbe: { group: 'doctor' },
100
+ runtimeDiagnostic: {
101
+ kind: 'replaced',
102
+ message: 'caws diagnose was renamed to caws doctor in v11.',
103
+ use: ['caws doctor'],
104
+ },
105
+ }),
106
+ entry({
107
+ command: 'hooks install',
108
+ disposition: 'replaced',
109
+ v11Status: 'shipped',
110
+ replacement: 'caws init --agent-surface claude-code',
111
+ since: '11.0',
112
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
113
+ implementationProbe: { group: 'init' },
114
+ runtimeDiagnostic: {
115
+ kind: 'replaced',
116
+ message: 'caws hooks install was folded into caws init in v11.',
117
+ use: ['caws init --agent-surface claude-code'],
118
+ },
119
+ }),
120
+ entry({
121
+ command: 'hooks remove',
122
+ disposition: 'removed',
123
+ v11Status: 'intentionally_absent',
124
+ replacement: null,
125
+ since: null,
126
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
127
+ implementationProbe: { group: null },
128
+ runtimeDiagnostic: {
129
+ kind: 'removed',
130
+ message:
131
+ 'caws hooks remove was removed in v11. Hook-pack adoption is now an init concern; uninstall by deleting the installed hook files manually.',
132
+ },
133
+ }),
134
+ entry({
135
+ command: 'hooks status',
136
+ disposition: 'removed',
137
+ v11Status: 'intentionally_absent',
138
+ replacement: null,
139
+ since: null,
140
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
141
+ implementationProbe: { group: null },
142
+ runtimeDiagnostic: {
143
+ kind: 'removed',
144
+ message: 'caws hooks status was removed in v11. Inspect installed hook files directly.',
145
+ },
146
+ }),
147
+ entry({
148
+ command: 'provenance',
149
+ disposition: 'replaced',
150
+ v11Status: 'shipped',
151
+ replacement: 'caws evidence record',
152
+ since: '11.0',
153
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
154
+ implementationProbe: { group: 'evidence', subcommand: 'record' },
155
+ runtimeDiagnostic: {
156
+ kind: 'replaced',
157
+ message:
158
+ 'caws provenance was replaced in v11 by caws evidence record + the hash-chained .caws/events.jsonl.',
159
+ use: ['caws evidence record --type <test|gate|ac> --spec <id> --data <json>'],
160
+ },
161
+ }),
162
+ entry({
163
+ command: 'provenance update',
164
+ disposition: 'replaced',
165
+ v11Status: 'shipped',
166
+ replacement: 'caws evidence record',
167
+ since: '11.0',
168
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
169
+ implementationProbe: { group: 'evidence', subcommand: 'record' },
170
+ runtimeDiagnostic: {
171
+ kind: 'replaced',
172
+ message: 'caws provenance update was replaced by caws evidence record.',
173
+ use: ['caws evidence record --type <test|gate|ac> --spec <id> --data <json>'],
174
+ },
175
+ }),
176
+ entry({
177
+ command: 'provenance show',
178
+ disposition: 'replaced',
179
+ v11Status: 'shipped',
180
+ replacement: 'read .caws/events.jsonl',
181
+ since: '11.0',
182
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
183
+ implementationProbe: { group: 'events' },
184
+ runtimeDiagnostic: {
185
+ kind: 'replaced',
186
+ message:
187
+ 'caws provenance show was replaced. Read .caws/events.jsonl directly (it is hash-chained and human-readable).',
188
+ },
189
+ }),
190
+ entry({
191
+ command: 'provenance verify',
192
+ disposition: 'replaced',
193
+ v11Status: 'shipped',
194
+ replacement: 'caws events verify-archive',
195
+ since: '11.0',
196
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
197
+ implementationProbe: { group: 'events', subcommand: 'verify-archive' },
198
+ runtimeDiagnostic: {
199
+ kind: 'replaced',
200
+ message:
201
+ 'caws provenance verify was replaced by caws events verify-archive (verifies rotated archive byte-match + digest).',
202
+ use: ['caws events verify-archive'],
203
+ },
204
+ }),
205
+ entry({
206
+ command: 'provenance analyze-ai',
207
+ disposition: 'removed',
208
+ v11Status: 'intentionally_absent',
209
+ replacement: null,
210
+ since: null,
211
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
212
+ implementationProbe: { group: null },
213
+ runtimeDiagnostic: {
214
+ kind: 'removed',
215
+ message: 'caws provenance analyze-ai was removed in v11 with no replacement.',
216
+ },
217
+ }),
218
+ entry({
219
+ command: 'provenance init',
220
+ disposition: 'removed',
221
+ v11Status: 'intentionally_absent',
222
+ replacement: null,
223
+ since: null,
224
+ sourceDocs: ['docs/migration-v10-to-v11.md#replaced'],
225
+ implementationProbe: { group: null },
226
+ runtimeDiagnostic: {
227
+ kind: 'removed',
228
+ message: 'caws provenance init was folded into caws init in v11.',
229
+ },
230
+ }),
231
+ entry({
232
+ command: 'scaffold',
233
+ disposition: 'replaced',
234
+ v11Status: 'shipped',
235
+ replacement: 'caws init',
236
+ since: '11.0',
237
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed'],
238
+ implementationProbe: { group: 'init' },
239
+ runtimeDiagnostic: {
240
+ kind: 'replaced',
241
+ message: "caws scaffold was folded into caws init's idempotent re-init flow.",
242
+ use: ['caws init'],
243
+ },
244
+ }),
245
+
246
+ // ─── Renamed ───
247
+ entry({
248
+ command: 'archive',
249
+ disposition: 'renamed',
250
+ v11Status: 'shipped',
251
+ replacement: 'caws specs archive <id>',
252
+ since: '11.0',
253
+ sourceDocs: ['docs/migration-v10-to-v11.md#renamed'],
254
+ implementationProbe: { group: 'specs', subcommand: 'archive' },
255
+ runtimeDiagnostic: {
256
+ kind: 'renamed',
257
+ message: 'caws archive was renamed to caws specs archive in v11.',
258
+ use: ['caws specs archive <id>'],
259
+ },
260
+ }),
261
+ entry({
262
+ command: 'waivers',
263
+ disposition: 'renamed',
264
+ v11Status: 'shipped',
265
+ replacement: 'caws waiver',
266
+ since: '11.0',
267
+ sourceDocs: ['docs/migration-v10-to-v11.md#renamed'],
268
+ implementationProbe: { group: 'waiver' },
269
+ runtimeDiagnostic: {
270
+ kind: 'renamed',
271
+ message: 'caws waivers (plural) was renamed to caws waiver (singular) in v11.',
272
+ use: ['caws waiver'],
273
+ },
274
+ }),
275
+
276
+ // ─── Removed without replacement ───
277
+ entry({
278
+ command: 'sidecar',
279
+ disposition: 'removed',
280
+ v11Status: 'intentionally_absent',
281
+ replacement: null,
282
+ since: null,
283
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
284
+ implementationProbe: { group: null },
285
+ runtimeDiagnostic: {
286
+ kind: 'removed',
287
+ message:
288
+ 'caws sidecar was removed in v11 (all subcommands: drift, gaps, provenance, waiver-draft). Advisory tooling removed; v11.1 prioritizes governed lifecycle over advisory-report parity.',
289
+ },
290
+ }),
291
+ entry({
292
+ command: 'sidecar drift',
293
+ disposition: 'removed',
294
+ v11Status: 'intentionally_absent',
295
+ replacement: null,
296
+ since: null,
297
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
298
+ implementationProbe: { group: null },
299
+ runtimeDiagnostic: {
300
+ kind: 'removed',
301
+ message:
302
+ 'caws sidecar drift was removed in v11. Stay on v10.2 or rebuild externally over .caws/events.jsonl.',
303
+ },
304
+ }),
305
+ entry({
306
+ command: 'sidecar gaps',
307
+ disposition: 'removed',
308
+ v11Status: 'intentionally_absent',
309
+ replacement: null,
310
+ since: null,
311
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
312
+ implementationProbe: { group: null },
313
+ runtimeDiagnostic: {
314
+ kind: 'removed',
315
+ message:
316
+ 'caws sidecar gaps was removed in v11. Trace gate failures manually from caws gates run output.',
317
+ },
318
+ }),
319
+ entry({
320
+ command: 'sidecar provenance',
321
+ disposition: 'removed',
322
+ v11Status: 'intentionally_absent',
323
+ replacement: null,
324
+ since: null,
325
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
326
+ implementationProbe: { group: null },
327
+ runtimeDiagnostic: {
328
+ kind: 'removed',
329
+ message: 'caws sidecar provenance was removed in v11. Read .caws/events.jsonl directly.',
330
+ },
331
+ }),
332
+ entry({
333
+ command: 'sidecar waiver-draft',
334
+ disposition: 'removed',
335
+ v11Status: 'intentionally_absent',
336
+ replacement: null,
337
+ since: null,
338
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
339
+ implementationProbe: { group: null },
340
+ runtimeDiagnostic: {
341
+ kind: 'removed',
342
+ message:
343
+ 'caws sidecar waiver-draft was removed in v11. Use caws waiver create --help for the flag surface.',
344
+ },
345
+ }),
346
+ entry({
347
+ command: 'burnup',
348
+ disposition: 'removed',
349
+ v11Status: 'intentionally_absent',
350
+ replacement: null,
351
+ since: null,
352
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
353
+ implementationProbe: { group: null },
354
+ runtimeDiagnostic: {
355
+ kind: 'removed',
356
+ message:
357
+ 'caws burnup was removed in v11. Derive budget burn-up from caws status + spec change_budget manually.',
358
+ },
359
+ }),
360
+ entry({
361
+ command: 'verify-acs',
362
+ disposition: 'removed',
363
+ v11Status: 'intentionally_absent',
364
+ replacement: null,
365
+ since: null,
366
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
367
+ implementationProbe: { group: null },
368
+ runtimeDiagnostic: {
369
+ kind: 'removed',
370
+ message:
371
+ 'caws verify-acs was removed in v11. Encode AC-evidence assertions in your test suite directly.',
372
+ },
373
+ }),
374
+ entry({
375
+ command: 'evaluate',
376
+ disposition: 'removed',
377
+ v11Status: 'intentionally_absent',
378
+ replacement: null,
379
+ since: null,
380
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
381
+ implementationProbe: { group: null },
382
+ runtimeDiagnostic: {
383
+ kind: 'removed',
384
+ message:
385
+ 'caws evaluate was removed in v11. caws gates run covers policy gates; quality-evaluation reports are not reproduced.',
386
+ },
387
+ }),
388
+ entry({
389
+ command: 'iterate',
390
+ disposition: 'removed',
391
+ v11Status: 'intentionally_absent',
392
+ replacement: null,
393
+ since: null,
394
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
395
+ implementationProbe: { group: null },
396
+ runtimeDiagnostic: {
397
+ kind: 'removed',
398
+ message:
399
+ 'caws iterate was removed in v11 (advisory-only, no v11 equivalent). Use spec acceptance criteria as guidance.',
400
+ },
401
+ }),
402
+ entry({
403
+ command: 'workflow',
404
+ disposition: 'removed',
405
+ v11Status: 'intentionally_absent',
406
+ replacement: null,
407
+ since: null,
408
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
409
+ implementationProbe: { group: null },
410
+ runtimeDiagnostic: {
411
+ kind: 'removed',
412
+ message: 'caws workflow was removed in v11. Workflow guidance is documentation-driven now.',
413
+ },
414
+ }),
415
+ entry({
416
+ command: 'quality-monitor',
417
+ disposition: 'removed',
418
+ v11Status: 'intentionally_absent',
419
+ replacement: null,
420
+ since: null,
421
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
422
+ implementationProbe: { group: null },
423
+ runtimeDiagnostic: {
424
+ kind: 'removed',
425
+ message: 'caws quality-monitor was removed in v11.',
426
+ },
427
+ }),
428
+ entry({
429
+ command: 'test-analysis',
430
+ disposition: 'removed',
431
+ v11Status: 'intentionally_absent',
432
+ replacement: null,
433
+ since: null,
434
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
435
+ implementationProbe: { group: null },
436
+ runtimeDiagnostic: {
437
+ kind: 'removed',
438
+ message: 'caws test-analysis was removed in v11.',
439
+ },
440
+ }),
441
+ entry({
442
+ command: 'tool',
443
+ disposition: 'removed',
444
+ v11Status: 'intentionally_absent',
445
+ replacement: null,
446
+ since: null,
447
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
448
+ implementationProbe: { group: null },
449
+ runtimeDiagnostic: {
450
+ kind: 'removed',
451
+ message: 'caws tool was removed in v11 (niche utility).',
452
+ },
453
+ }),
454
+ entry({
455
+ command: 'templates',
456
+ disposition: 'removed',
457
+ v11Status: 'intentionally_absent',
458
+ replacement: null,
459
+ since: null,
460
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
461
+ implementationProbe: { group: null },
462
+ runtimeDiagnostic: {
463
+ kind: 'removed',
464
+ message:
465
+ 'caws templates was removed in v11. Hook-pack install via caws init --agent-surface is now the only template surface.',
466
+ },
467
+ }),
468
+ entry({
469
+ command: 'templates discover',
470
+ disposition: 'removed',
471
+ v11Status: 'intentionally_absent',
472
+ replacement: null,
473
+ since: null,
474
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
475
+ implementationProbe: { group: null },
476
+ runtimeDiagnostic: {
477
+ kind: 'removed',
478
+ message: 'caws templates discover was removed in v11.',
479
+ },
480
+ }),
481
+ entry({
482
+ command: 'templates manage',
483
+ disposition: 'removed',
484
+ v11Status: 'intentionally_absent',
485
+ replacement: null,
486
+ since: null,
487
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
488
+ implementationProbe: { group: null },
489
+ runtimeDiagnostic: {
490
+ kind: 'removed',
491
+ message: 'caws templates manage was removed in v11.',
492
+ },
493
+ }),
494
+ entry({
495
+ command: 'mode',
496
+ disposition: 'removed',
497
+ v11Status: 'intentionally_absent',
498
+ replacement: null,
499
+ since: null,
500
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
501
+ implementationProbe: { group: null },
502
+ runtimeDiagnostic: {
503
+ kind: 'removed',
504
+ message: 'caws mode was removed in v11. Per-feature specs replace complexity-tier management.',
505
+ },
506
+ }),
507
+ entry({
508
+ command: 'tutorial',
509
+ disposition: 'removed',
510
+ v11Status: 'intentionally_absent',
511
+ replacement: null,
512
+ since: null,
513
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
514
+ implementationProbe: { group: null },
515
+ runtimeDiagnostic: {
516
+ kind: 'removed',
517
+ message: 'caws tutorial was removed in v11 (doc-driven now).',
518
+ },
519
+ }),
520
+ entry({
521
+ command: 'plan',
522
+ disposition: 'removed',
523
+ v11Status: 'intentionally_absent',
524
+ replacement: null,
525
+ since: null,
526
+ sourceDocs: ['docs/migration-v10-to-v11.md#removed-without-replacement'],
527
+ implementationProbe: { group: null },
528
+ runtimeDiagnostic: {
529
+ kind: 'removed',
530
+ message: 'caws plan was removed in v11.',
531
+ },
532
+ }),
533
+
534
+ // ─── Deferred ───
535
+ entry({
536
+ command: 'agents list',
537
+ disposition: 'deferred',
538
+ v11Status: 'shipped',
539
+ replacement: 'caws agents list',
540
+ since: '11.1.x',
541
+ sourceDocs: [
542
+ 'docs/migration-v10-to-v11.md#deferred',
543
+ 'docs/architecture/caws-vnext-command-surface.md',
544
+ ],
545
+ implementationProbe: { group: 'agents', subcommand: 'list' },
546
+ runtimeDiagnostic: {
547
+ kind: 'shipped',
548
+ message: 'caws agents list shipped ahead of the v11.2 multi-agent line.',
549
+ },
550
+ }),
551
+ entry({
552
+ command: 'agents show',
553
+ disposition: 'deferred',
554
+ v11Status: 'shipped',
555
+ replacement: 'caws agents show <id>',
556
+ since: '11.1.x',
557
+ sourceDocs: [
558
+ 'docs/migration-v10-to-v11.md#deferred',
559
+ 'docs/architecture/caws-vnext-command-surface.md',
560
+ ],
561
+ implementationProbe: { group: 'agents', subcommand: 'show' },
562
+ runtimeDiagnostic: {
563
+ kind: 'shipped',
564
+ message: 'caws agents show shipped ahead of the v11.2 multi-agent line.',
565
+ },
566
+ }),
567
+ entry({
568
+ command: 'session',
569
+ disposition: 'deferred',
570
+ v11Status: 'planned',
571
+ replacement: null,
572
+ since: null,
573
+ sourceDocs: [
574
+ 'docs/migration-v10-to-v11.md#deferred',
575
+ 'docs/architecture/caws-vnext-command-surface.md',
576
+ ],
577
+ implementationProbe: { group: null },
578
+ runtimeDiagnostic: {
579
+ kind: 'deferred',
580
+ message:
581
+ 'caws session is deferred to v11.3+. Per-worktree binding remains the v11 isolation primitive until then.',
582
+ },
583
+ }),
584
+ entry({
585
+ command: 'session start',
586
+ disposition: 'deferred',
587
+ v11Status: 'planned',
588
+ replacement: null,
589
+ since: null,
590
+ sourceDocs: ['docs/migration-v10-to-v11.md#deferred'],
591
+ implementationProbe: { group: null },
592
+ runtimeDiagnostic: {
593
+ kind: 'deferred',
594
+ message: 'caws session start is deferred to v11.3+.',
595
+ },
596
+ }),
597
+ entry({
598
+ command: 'session checkpoint',
599
+ disposition: 'deferred',
600
+ v11Status: 'planned',
601
+ replacement: null,
602
+ since: null,
603
+ sourceDocs: ['docs/migration-v10-to-v11.md#deferred'],
604
+ implementationProbe: { group: null },
605
+ runtimeDiagnostic: {
606
+ kind: 'deferred',
607
+ message: 'caws session checkpoint is deferred to v11.3+.',
608
+ },
609
+ }),
610
+ entry({
611
+ command: 'session end',
612
+ disposition: 'deferred',
613
+ v11Status: 'planned',
614
+ replacement: null,
615
+ since: null,
616
+ sourceDocs: ['docs/migration-v10-to-v11.md#deferred'],
617
+ implementationProbe: { group: null },
618
+ runtimeDiagnostic: {
619
+ kind: 'deferred',
620
+ message: 'caws session end is deferred to v11.3+.',
621
+ },
622
+ }),
623
+ entry({
624
+ command: 'session list',
625
+ disposition: 'deferred',
626
+ v11Status: 'planned',
627
+ replacement: null,
628
+ since: null,
629
+ sourceDocs: ['docs/migration-v10-to-v11.md#deferred'],
630
+ implementationProbe: { group: null },
631
+ runtimeDiagnostic: {
632
+ kind: 'deferred',
633
+ message: 'caws session list is deferred to v11.3+.',
634
+ },
635
+ }),
636
+ entry({
637
+ command: 'parallel',
638
+ disposition: 'deferred',
639
+ v11Status: 'planned',
640
+ replacement: 'loop caws worktree create --spec <id>',
641
+ since: null,
642
+ sourceDocs: [
643
+ 'docs/migration-v10-to-v11.md#deferred',
644
+ 'docs/architecture/caws-vnext-command-surface.md',
645
+ ],
646
+ implementationProbe: { group: null },
647
+ runtimeDiagnostic: {
648
+ kind: 'deferred',
649
+ message:
650
+ 'caws parallel is deferred to v11.3+. Until then, loop caws worktree create per spec.',
651
+ use: ['caws worktree create <name> --spec <id>'],
652
+ },
653
+ }),
654
+ entry({
655
+ command: 'parallel setup',
656
+ disposition: 'deferred',
657
+ v11Status: 'planned',
658
+ replacement: 'loop caws worktree create --spec <id>',
659
+ since: null,
660
+ sourceDocs: ['docs/migration-v10-to-v11.md#deferred'],
661
+ implementationProbe: { group: null },
662
+ runtimeDiagnostic: {
663
+ kind: 'deferred',
664
+ message: 'caws parallel setup is deferred to v11.3+. Loop caws worktree create per spec.',
665
+ use: ['caws worktree create <name> --spec <id>'],
666
+ },
667
+ }),
668
+ entry({
669
+ command: 'worktree prune',
670
+ disposition: 'deferred',
671
+ v11Status: 'planned',
672
+ replacement: null,
673
+ since: null,
674
+ sourceDocs: [
675
+ 'docs/migration-v10-to-v11.md#deferred',
676
+ 'docs/architecture/caws-vnext-command-surface.md',
677
+ ],
678
+ implementationProbe: { group: null },
679
+ runtimeDiagnostic: {
680
+ kind: 'deferred',
681
+ message:
682
+ 'caws worktree prune is planned for v11.2. Until then, use caws status to inspect worktree state and clean up via git worktree directly.',
683
+ },
684
+ }),
685
+ entry({
686
+ command: 'worktree repair',
687
+ disposition: 'deferred',
688
+ v11Status: 'planned',
689
+ replacement: null,
690
+ since: null,
691
+ sourceDocs: ['docs/migration-v10-to-v11.md#deferred'],
692
+ implementationProbe: { group: null },
693
+ runtimeDiagnostic: {
694
+ kind: 'deferred',
695
+ message:
696
+ 'caws worktree repair is planned for v11.2. Distinct from worktree repair-sparse (shipped).',
697
+ },
698
+ }),
699
+ entry({
700
+ command: 'worktree reconcile',
701
+ disposition: 'deferred',
702
+ v11Status: 'planned',
703
+ replacement: null,
704
+ since: null,
705
+ sourceDocs: ['docs/migration-v10-to-v11.md#deferred'],
706
+ implementationProbe: { group: null },
707
+ runtimeDiagnostic: {
708
+ kind: 'deferred',
709
+ message: 'caws worktree reconcile is planned for v11.2.',
710
+ },
711
+ }),
712
+
713
+ // ─── History gaps ───
714
+ entry({
715
+ command: 'quality-gates',
716
+ disposition: 'removed',
717
+ v11Status: 'intentionally_absent',
718
+ replacement: 'caws gates run',
719
+ since: null,
720
+ sourceDocs: ['docs/architecture/caws-vnext-command-surface.md'],
721
+ implementationProbe: { group: 'gates', subcommand: 'run' },
722
+ runtimeDiagnostic: {
723
+ kind: 'removed',
724
+ message:
725
+ 'caws quality-gates was a pre-v11 alias removed before the v11.0 cutover. Use caws gates run.',
726
+ use: ['caws gates run --spec <id>'],
727
+ },
728
+ }),
729
+ entry({
730
+ command: 'troubleshoot',
731
+ disposition: 'replaced',
732
+ v11Status: 'shipped',
733
+ replacement: 'caws doctor',
734
+ since: null,
735
+ sourceDocs: ['docs/architecture/caws-vnext-command-surface.md'],
736
+ implementationProbe: { group: 'doctor' },
737
+ runtimeDiagnostic: {
738
+ kind: 'replaced',
739
+ message:
740
+ 'caws troubleshoot was consolidated into diagnose pre-v11; diagnose itself was renamed to doctor at v11.0.',
741
+ use: ['caws doctor'],
742
+ },
743
+ }),
744
+ ]);
745
+
746
+ // Index the map by command string for O(1) prefix probing.
747
+ const MAP_BY_COMMAND = new Map(LEGACY_COMMAND_MAP.map((e) => [e.command, e]));
748
+
749
+ /**
750
+ * Classify an argv tail against the legacy command map using LONGEST-PREFIX
751
+ * matching over the full (possibly multi-token) command strings.
752
+ *
753
+ * Pure function. No IO. No execution. No dispatch. Given the argv that
754
+ * Commander could not resolve, it returns the matching LEGACY_COMMAND_MAP
755
+ * entry whose `command` is the longest space-joined prefix of argv, or null
756
+ * if no legacy entry matches.
757
+ *
758
+ * Examples (with LEGACY_COMMAND_MAP holding both "sidecar" and
759
+ * "sidecar gaps"):
760
+ * classifyLegacyCommand(['sidecar', 'gaps']) -> the "sidecar gaps" entry
761
+ * classifyLegacyCommand(['sidecar', 'xyzzy']) -> the "sidecar" entry
762
+ * classifyLegacyCommand(['sidecar']) -> the "sidecar" entry
763
+ * classifyLegacyCommand(['statuz']) -> null (genuine typo;
764
+ * caller falls back to the
765
+ * fuzzy suggester)
766
+ *
767
+ * @param {string[]} argv - command tokens (e.g. process.argv.slice(2)),
768
+ * options included; options are ignored for matching since legacy command
769
+ * strings never contain leading-dash tokens.
770
+ * @returns {object|null} a frozen LEGACY_COMMAND_MAP entry, or null.
771
+ */
772
+ function classifyLegacyCommand(argv) {
773
+ if (!Array.isArray(argv) || argv.length === 0) return null;
774
+ // Drop option tokens (anything starting with '-') from the candidate
775
+ // prefix; legacy command names are positional words only.
776
+ const words = [];
777
+ for (const tok of argv) {
778
+ if (typeof tok !== 'string') break;
779
+ if (tok.startsWith('-')) break;
780
+ words.push(tok);
781
+ }
782
+ if (words.length === 0) return null;
783
+ // Try the longest prefix first, shrinking by one token until a match.
784
+ for (let n = words.length; n >= 1; n--) {
785
+ const candidate = words.slice(0, n).join(' ');
786
+ const entry = MAP_BY_COMMAND.get(candidate);
787
+ if (entry) return entry;
788
+ }
789
+ return null;
790
+ }
791
+
792
+ /**
793
+ * Build the operator-facing diagnostic lines for a classified legacy
794
+ * command entry. Pure: returns an array of strings, prints nothing.
795
+ *
796
+ * The shape is driven by the entry's runtimeDiagnostic.kind:
797
+ * - removed -> "removed in v11" message, no "use" guidance expected
798
+ * - replaced -> message + "Use instead:" lines from runtimeDiagnostic.use
799
+ * - renamed -> message + "Use instead:" lines
800
+ * - deferred -> "deferred" message + optional workaround "use" lines
801
+ * - shipped -> message (a deferred-in-doc-but-actually-shipped command;
802
+ * rare on the unknown-command path since shipped commands
803
+ * resolve in Commander, but handled for completeness)
804
+ *
805
+ * Always appends the doc anchor from sourceDocs[0] as a "See:" line.
806
+ *
807
+ * @param {object} entry - a LEGACY_COMMAND_MAP entry.
808
+ * @returns {string[]} diagnostic lines, in print order.
809
+ */
810
+ function formatLegacyDiagnostic(entry) {
811
+ if (!entry || !entry.runtimeDiagnostic) return [];
812
+ const diag = entry.runtimeDiagnostic;
813
+ const lines = [diag.message];
814
+ if (Array.isArray(diag.use) && diag.use.length > 0) {
815
+ lines.push('Use instead:');
816
+ for (const u of diag.use) {
817
+ lines.push(` ${u}`);
818
+ }
819
+ }
820
+ if (Array.isArray(entry.sourceDocs) && entry.sourceDocs.length > 0) {
821
+ lines.push(`See: ${entry.sourceDocs[0]}`);
822
+ }
823
+ return lines;
824
+ }
825
+
826
+ module.exports = {
827
+ SCHEMA_VERSION,
828
+ V11_REGISTERED_GROUPS,
829
+ LEGACY_COMMAND_MAP,
830
+ classifyLegacyCommand,
831
+ formatLegacyDiagnostic,
832
+ };