@paths.design/caws-cli 10.2.0 → 11.1.0

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 (493) hide show
  1. package/README.md +125 -374
  2. package/dist/index.js +45 -787
  3. package/dist/init/harness-detect.d.ts +18 -0
  4. package/dist/init/harness-detect.d.ts.map +1 -0
  5. package/dist/init/harness-detect.js +90 -0
  6. package/dist/init/harness-detect.js.map +1 -0
  7. package/dist/init/hook-install.d.ts +53 -0
  8. package/dist/init/hook-install.d.ts.map +1 -0
  9. package/dist/init/hook-install.js +421 -0
  10. package/dist/init/hook-install.js.map +1 -0
  11. package/dist/init/hook-packs/manifest-claude-code.d.ts +4 -0
  12. package/dist/init/hook-packs/manifest-claude-code.d.ts.map +1 -0
  13. package/dist/init/hook-packs/manifest-claude-code.js +190 -0
  14. package/dist/init/hook-packs/manifest-claude-code.js.map +1 -0
  15. package/dist/init/hook-packs/register.d.ts +19 -0
  16. package/dist/init/hook-packs/register.d.ts.map +1 -0
  17. package/dist/init/hook-packs/register.js +37 -0
  18. package/dist/init/hook-packs/register.js.map +1 -0
  19. package/dist/init/hook-packs/types.d.ts +123 -0
  20. package/dist/init/hook-packs/types.d.ts.map +1 -0
  21. package/dist/init/hook-packs/types.js +29 -0
  22. package/dist/init/hook-packs/types.js.map +1 -0
  23. package/dist/shell/binding/resolve-binding.d.ts +4 -0
  24. package/dist/shell/binding/resolve-binding.d.ts.map +1 -0
  25. package/dist/shell/binding/resolve-binding.js +228 -0
  26. package/dist/shell/binding/resolve-binding.js.map +1 -0
  27. package/dist/shell/binding/types.d.ts +42 -0
  28. package/dist/shell/binding/types.d.ts.map +1 -0
  29. package/dist/shell/binding/types.js +21 -0
  30. package/dist/shell/binding/types.js.map +1 -0
  31. package/dist/shell/commands/claim.d.ts +14 -0
  32. package/dist/shell/commands/claim.d.ts.map +1 -0
  33. package/dist/shell/commands/claim.js +197 -0
  34. package/dist/shell/commands/claim.js.map +1 -0
  35. package/dist/shell/commands/doctor.d.ts +13 -0
  36. package/dist/shell/commands/doctor.d.ts.map +1 -0
  37. package/dist/shell/commands/doctor.js +97 -0
  38. package/dist/shell/commands/doctor.js.map +1 -0
  39. package/dist/shell/commands/evidence.d.ts +28 -0
  40. package/dist/shell/commands/evidence.d.ts.map +1 -0
  41. package/dist/shell/commands/evidence.js +166 -0
  42. package/dist/shell/commands/evidence.js.map +1 -0
  43. package/dist/shell/commands/gates.d.ts +19 -0
  44. package/dist/shell/commands/gates.d.ts.map +1 -0
  45. package/dist/shell/commands/gates.js +208 -0
  46. package/dist/shell/commands/gates.js.map +1 -0
  47. package/dist/shell/commands/init.d.ts +17 -0
  48. package/dist/shell/commands/init.d.ts.map +1 -0
  49. package/dist/shell/commands/init.js +168 -0
  50. package/dist/shell/commands/init.js.map +1 -0
  51. package/dist/shell/commands/scope.d.ts +11 -0
  52. package/dist/shell/commands/scope.d.ts.map +1 -0
  53. package/dist/shell/commands/scope.js +92 -0
  54. package/dist/shell/commands/scope.js.map +1 -0
  55. package/dist/shell/commands/specs.d.ts +41 -0
  56. package/dist/shell/commands/specs.d.ts.map +1 -0
  57. package/dist/shell/commands/specs.js +264 -0
  58. package/dist/shell/commands/specs.js.map +1 -0
  59. package/dist/shell/commands/status.d.ts +15 -0
  60. package/dist/shell/commands/status.d.ts.map +1 -0
  61. package/dist/shell/commands/status.js +106 -0
  62. package/dist/shell/commands/status.js.map +1 -0
  63. package/dist/shell/commands/waiver.d.ts +38 -0
  64. package/dist/shell/commands/waiver.d.ts.map +1 -0
  65. package/dist/shell/commands/waiver.js +240 -0
  66. package/dist/shell/commands/waiver.js.map +1 -0
  67. package/dist/shell/commands/worktree.d.ts +38 -0
  68. package/dist/shell/commands/worktree.d.ts.map +1 -0
  69. package/dist/shell/commands/worktree.js +286 -0
  70. package/dist/shell/commands/worktree.js.map +1 -0
  71. package/dist/shell/gates/disposition.d.ts +23 -0
  72. package/dist/shell/gates/disposition.d.ts.map +1 -0
  73. package/dist/shell/gates/disposition.js +117 -0
  74. package/dist/shell/gates/disposition.js.map +1 -0
  75. package/dist/shell/gates/gate-result-contract.d.ts +39 -0
  76. package/dist/shell/gates/gate-result-contract.d.ts.map +1 -0
  77. package/dist/shell/gates/gate-result-contract.js +150 -0
  78. package/dist/shell/gates/gate-result-contract.js.map +1 -0
  79. package/dist/shell/gates/local-evaluators/budget-limit.d.ts +24 -0
  80. package/dist/shell/gates/local-evaluators/budget-limit.d.ts.map +1 -0
  81. package/dist/shell/gates/local-evaluators/budget-limit.js +67 -0
  82. package/dist/shell/gates/local-evaluators/budget-limit.js.map +1 -0
  83. package/dist/shell/gates/local-evaluators/diff-helpers.d.ts +25 -0
  84. package/dist/shell/gates/local-evaluators/diff-helpers.d.ts.map +1 -0
  85. package/dist/shell/gates/local-evaluators/diff-helpers.js +74 -0
  86. package/dist/shell/gates/local-evaluators/diff-helpers.js.map +1 -0
  87. package/dist/shell/gates/local-evaluators/index.d.ts +28 -0
  88. package/dist/shell/gates/local-evaluators/index.d.ts.map +1 -0
  89. package/dist/shell/gates/local-evaluators/index.js +67 -0
  90. package/dist/shell/gates/local-evaluators/index.js.map +1 -0
  91. package/dist/shell/gates/local-evaluators/scope-boundary.d.ts +23 -0
  92. package/dist/shell/gates/local-evaluators/scope-boundary.d.ts.map +1 -0
  93. package/dist/shell/gates/local-evaluators/scope-boundary.js +67 -0
  94. package/dist/shell/gates/local-evaluators/scope-boundary.js.map +1 -0
  95. package/dist/shell/gates/local-evaluators/spec-completeness.d.ts +12 -0
  96. package/dist/shell/gates/local-evaluators/spec-completeness.d.ts.map +1 -0
  97. package/dist/shell/gates/local-evaluators/spec-completeness.js +73 -0
  98. package/dist/shell/gates/local-evaluators/spec-completeness.js.map +1 -0
  99. package/dist/shell/gates/quality-gates-adapter.d.ts +55 -0
  100. package/dist/shell/gates/quality-gates-adapter.d.ts.map +1 -0
  101. package/dist/shell/gates/quality-gates-adapter.js +161 -0
  102. package/dist/shell/gates/quality-gates-adapter.js.map +1 -0
  103. package/dist/shell/gates/waiver-filter.d.ts +58 -0
  104. package/dist/shell/gates/waiver-filter.d.ts.map +1 -0
  105. package/dist/shell/gates/waiver-filter.js +119 -0
  106. package/dist/shell/gates/waiver-filter.js.map +1 -0
  107. package/dist/shell/index.d.ts +54 -0
  108. package/dist/shell/index.d.ts.map +1 -0
  109. package/dist/shell/index.js +85 -0
  110. package/dist/shell/index.js.map +1 -0
  111. package/dist/shell/register.d.ts +11 -0
  112. package/dist/shell/register.d.ts.map +1 -0
  113. package/dist/shell/register.js +464 -0
  114. package/dist/shell/register.js.map +1 -0
  115. package/dist/shell/render/claim.d.ts +22 -0
  116. package/dist/shell/render/claim.d.ts.map +1 -0
  117. package/dist/shell/render/claim.js +75 -0
  118. package/dist/shell/render/claim.js.map +1 -0
  119. package/dist/shell/render/decision.d.ts +15 -0
  120. package/dist/shell/render/decision.d.ts.map +1 -0
  121. package/dist/shell/render/decision.js +66 -0
  122. package/dist/shell/render/decision.js.map +1 -0
  123. package/dist/shell/render/diagnostic.d.ts +19 -0
  124. package/dist/shell/render/diagnostic.d.ts.map +1 -0
  125. package/dist/shell/render/diagnostic.js +76 -0
  126. package/dist/shell/render/diagnostic.js.map +1 -0
  127. package/dist/shell/render/finding.d.ts +15 -0
  128. package/dist/shell/render/finding.d.ts.map +1 -0
  129. package/dist/shell/render/finding.js +57 -0
  130. package/dist/shell/render/finding.js.map +1 -0
  131. package/dist/shell/render/gates.d.ts +3 -0
  132. package/dist/shell/render/gates.d.ts.map +1 -0
  133. package/dist/shell/render/gates.js +56 -0
  134. package/dist/shell/render/gates.js.map +1 -0
  135. package/dist/shell/render/init-hook-pack.d.ts +16 -0
  136. package/dist/shell/render/init-hook-pack.d.ts.map +1 -0
  137. package/dist/shell/render/init-hook-pack.js +206 -0
  138. package/dist/shell/render/init-hook-pack.js.map +1 -0
  139. package/dist/shell/render/init.d.ts +11 -0
  140. package/dist/shell/render/init.d.ts.map +1 -0
  141. package/dist/shell/render/init.js +32 -0
  142. package/dist/shell/render/init.js.map +1 -0
  143. package/dist/shell/render/status.d.ts +26 -0
  144. package/dist/shell/render/status.d.ts.map +1 -0
  145. package/dist/shell/render/status.js +143 -0
  146. package/dist/shell/render/status.js.map +1 -0
  147. package/dist/shell/render/waiver.d.ts +21 -0
  148. package/dist/shell/render/waiver.d.ts.map +1 -0
  149. package/dist/shell/render/waiver.js +94 -0
  150. package/dist/shell/render/waiver.js.map +1 -0
  151. package/dist/shell/rules.d.ts +37 -0
  152. package/dist/shell/rules.d.ts.map +1 -0
  153. package/dist/shell/rules.js +51 -0
  154. package/dist/shell/rules.js.map +1 -0
  155. package/dist/shell/session/actor.d.ts +14 -0
  156. package/dist/shell/session/actor.d.ts.map +1 -0
  157. package/dist/shell/session/actor.js +34 -0
  158. package/dist/shell/session/actor.js.map +1 -0
  159. package/dist/shell/session/resolve-session.d.ts +5 -0
  160. package/dist/shell/session/resolve-session.d.ts.map +1 -0
  161. package/dist/shell/session/resolve-session.js +239 -0
  162. package/dist/shell/session/resolve-session.js.map +1 -0
  163. package/dist/shell/session/types.d.ts +56 -0
  164. package/dist/shell/session/types.d.ts.map +1 -0
  165. package/dist/shell/session/types.js +15 -0
  166. package/dist/shell/session/types.js.map +1 -0
  167. package/dist/store/agents-store.d.ts +3 -0
  168. package/dist/store/agents-store.d.ts.map +1 -0
  169. package/dist/store/agents-store.js +63 -0
  170. package/dist/store/agents-store.js.map +1 -0
  171. package/dist/store/apply-patch.d.ts +16 -0
  172. package/dist/store/apply-patch.d.ts.map +1 -0
  173. package/dist/store/apply-patch.js +191 -0
  174. package/dist/store/apply-patch.js.map +1 -0
  175. package/dist/store/atomic-write.d.ts +34 -0
  176. package/dist/store/atomic-write.d.ts.map +1 -0
  177. package/dist/store/atomic-write.js +174 -0
  178. package/dist/store/atomic-write.js.map +1 -0
  179. package/dist/store/doctor-snapshot.d.ts +20 -0
  180. package/dist/store/doctor-snapshot.d.ts.map +1 -0
  181. package/dist/store/doctor-snapshot.js +176 -0
  182. package/dist/store/doctor-snapshot.js.map +1 -0
  183. package/dist/store/events-store.d.ts +33 -0
  184. package/dist/store/events-store.d.ts.map +1 -0
  185. package/dist/store/events-store.js +297 -0
  186. package/dist/store/events-store.js.map +1 -0
  187. package/dist/store/index.d.ts +21 -0
  188. package/dist/store/index.d.ts.map +1 -0
  189. package/dist/store/index.js +47 -0
  190. package/dist/store/index.js.map +1 -0
  191. package/dist/store/init-store.d.ts +21 -0
  192. package/dist/store/init-store.d.ts.map +1 -0
  193. package/dist/store/init-store.js +295 -0
  194. package/dist/store/init-store.js.map +1 -0
  195. package/dist/store/json-store.d.ts +3 -0
  196. package/dist/store/json-store.d.ts.map +1 -0
  197. package/dist/store/json-store.js +65 -0
  198. package/dist/store/json-store.js.map +1 -0
  199. package/dist/store/lifecycle-lock.d.ts +34 -0
  200. package/dist/store/lifecycle-lock.d.ts.map +1 -0
  201. package/dist/store/lifecycle-lock.js +168 -0
  202. package/dist/store/lifecycle-lock.js.map +1 -0
  203. package/dist/store/lifecycle-transaction.d.ts +79 -0
  204. package/dist/store/lifecycle-transaction.d.ts.map +1 -0
  205. package/dist/store/lifecycle-transaction.js +319 -0
  206. package/dist/store/lifecycle-transaction.js.map +1 -0
  207. package/dist/store/policy-store.d.ts +3 -0
  208. package/dist/store/policy-store.d.ts.map +1 -0
  209. package/dist/store/policy-store.js +65 -0
  210. package/dist/store/policy-store.js.map +1 -0
  211. package/dist/store/repo-root.d.ts +46 -0
  212. package/dist/store/repo-root.d.ts.map +1 -0
  213. package/dist/store/repo-root.js +145 -0
  214. package/dist/store/repo-root.js.map +1 -0
  215. package/dist/store/rules.d.ts +69 -0
  216. package/dist/store/rules.d.ts.map +1 -0
  217. package/dist/store/rules.js +95 -0
  218. package/dist/store/rules.js.map +1 -0
  219. package/dist/store/specs-store.d.ts +3 -0
  220. package/dist/store/specs-store.d.ts.map +1 -0
  221. package/dist/store/specs-store.js +131 -0
  222. package/dist/store/specs-store.js.map +1 -0
  223. package/dist/store/specs-writer.d.ts +61 -0
  224. package/dist/store/specs-writer.d.ts.map +1 -0
  225. package/dist/store/specs-writer.js +506 -0
  226. package/dist/store/specs-writer.js.map +1 -0
  227. package/dist/store/types.d.ts +84 -0
  228. package/dist/store/types.d.ts.map +1 -0
  229. package/dist/store/types.js +14 -0
  230. package/dist/store/types.js.map +1 -0
  231. package/dist/store/waivers-store.d.ts +25 -0
  232. package/dist/store/waivers-store.d.ts.map +1 -0
  233. package/dist/store/waivers-store.js +232 -0
  234. package/dist/store/waivers-store.js.map +1 -0
  235. package/dist/store/worktrees-store.d.ts +3 -0
  236. package/dist/store/worktrees-store.d.ts.map +1 -0
  237. package/dist/store/worktrees-store.js +62 -0
  238. package/dist/store/worktrees-store.js.map +1 -0
  239. package/dist/store/worktrees-writer.d.ts +77 -0
  240. package/dist/store/worktrees-writer.d.ts.map +1 -0
  241. package/dist/store/worktrees-writer.js +674 -0
  242. package/dist/store/worktrees-writer.js.map +1 -0
  243. package/dist/store/yaml-patch.d.ts +7 -0
  244. package/dist/store/yaml-patch.d.ts.map +1 -0
  245. package/dist/store/yaml-patch.js +250 -0
  246. package/dist/store/yaml-patch.js.map +1 -0
  247. package/dist/store/yaml-store.d.ts +9 -0
  248. package/dist/store/yaml-store.d.ts.map +1 -0
  249. package/dist/store/yaml-store.js +121 -0
  250. package/dist/store/yaml-store.js.map +1 -0
  251. package/package.json +15 -13
  252. package/dist/budget-derivation.js +0 -751
  253. package/dist/cicd-optimizer.js +0 -504
  254. package/dist/commands/agents.js +0 -124
  255. package/dist/commands/archive.js +0 -500
  256. package/dist/commands/burnup.js +0 -198
  257. package/dist/commands/diagnose.js +0 -525
  258. package/dist/commands/evaluate.js +0 -314
  259. package/dist/commands/gates.js +0 -149
  260. package/dist/commands/init.js +0 -857
  261. package/dist/commands/iterate.js +0 -417
  262. package/dist/commands/mode.js +0 -269
  263. package/dist/commands/parallel.js +0 -242
  264. package/dist/commands/plan.js +0 -438
  265. package/dist/commands/provenance.js +0 -1143
  266. package/dist/commands/quality-monitor.js +0 -284
  267. package/dist/commands/scope.js +0 -264
  268. package/dist/commands/session.js +0 -312
  269. package/dist/commands/sidecar.js +0 -74
  270. package/dist/commands/specs.js +0 -1656
  271. package/dist/commands/status.js +0 -1172
  272. package/dist/commands/templates.js +0 -237
  273. package/dist/commands/tool.js +0 -136
  274. package/dist/commands/tutorial.js +0 -480
  275. package/dist/commands/validate.js +0 -357
  276. package/dist/commands/verify-acs.js +0 -443
  277. package/dist/commands/waivers.js +0 -599
  278. package/dist/commands/workflow.js +0 -243
  279. package/dist/commands/worktree.js +0 -502
  280. package/dist/config/lite-scope.js +0 -158
  281. package/dist/config/modes.js +0 -347
  282. package/dist/constants/spec-types.js +0 -65
  283. package/dist/gates/budget-limit.js +0 -121
  284. package/dist/gates/feedback.js +0 -260
  285. package/dist/gates/format.js +0 -179
  286. package/dist/gates/god-object.js +0 -117
  287. package/dist/gates/pipeline.js +0 -167
  288. package/dist/gates/scope-boundary.js +0 -112
  289. package/dist/gates/spec-completeness.js +0 -109
  290. package/dist/gates/todo-detection.js +0 -205
  291. package/dist/generators/jest-config-generator.js +0 -242
  292. package/dist/generators/working-spec.js +0 -237
  293. package/dist/minimal-cli.js +0 -88
  294. package/dist/parallel/parallel-manager.js +0 -433
  295. package/dist/policy/PolicyManager.js +0 -470
  296. package/dist/scaffold/claude-hooks.js +0 -443
  297. package/dist/scaffold/cursor-hooks.js +0 -177
  298. package/dist/scaffold/git-hooks.js +0 -928
  299. package/dist/scaffold/index.js +0 -794
  300. package/dist/session/session-manager.js +0 -653
  301. package/dist/sidecars/index.js +0 -33
  302. package/dist/sidecars/listeners.js +0 -40
  303. package/dist/sidecars/provenance-summary.js +0 -238
  304. package/dist/sidecars/quality-gaps.js +0 -258
  305. package/dist/sidecars/schema.js +0 -149
  306. package/dist/sidecars/spec-drift.js +0 -151
  307. package/dist/sidecars/waiver-draft.js +0 -176
  308. package/dist/spec/SpecFileManager.js +0 -419
  309. package/dist/templates/.caws/schemas/policy.schema.json +0 -117
  310. package/dist/templates/.caws/schemas/scope.schema.json +0 -52
  311. package/dist/templates/.caws/schemas/waivers.schema.json +0 -106
  312. package/dist/templates/.caws/schemas/working-spec.schema.json +0 -340
  313. package/dist/templates/.caws/schemas/worktrees.schema.json +0 -38
  314. package/dist/templates/.caws/templates/working-spec.template.yml +0 -80
  315. package/dist/templates/.caws/tools/README.md +0 -18
  316. package/dist/templates/.caws/tools/scope-guard.js +0 -203
  317. package/dist/templates/.caws/tools-allow.json +0 -331
  318. package/dist/templates/.caws/waivers.yml +0 -19
  319. package/dist/templates/.claude/README.md +0 -190
  320. package/dist/templates/.claude/hooks/audit.sh +0 -121
  321. package/dist/templates/.claude/hooks/block-dangerous.sh +0 -203
  322. package/dist/templates/.claude/hooks/classify_command.py +0 -592
  323. package/dist/templates/.claude/hooks/doc-frontmatter-check.sh +0 -173
  324. package/dist/templates/.claude/hooks/lite-sprawl-check.sh +0 -145
  325. package/dist/templates/.claude/hooks/naming-check.sh +0 -100
  326. package/dist/templates/.claude/hooks/protected-paths.sh +0 -39
  327. package/dist/templates/.claude/hooks/quality-check.sh +0 -81
  328. package/dist/templates/.claude/hooks/scan-secrets.sh +0 -85
  329. package/dist/templates/.claude/hooks/scope-guard.sh +0 -381
  330. package/dist/templates/.claude/hooks/session-caws-status.sh +0 -117
  331. package/dist/templates/.claude/hooks/session-log.sh +0 -634
  332. package/dist/templates/.claude/hooks/simplification-guard.sh +0 -92
  333. package/dist/templates/.claude/hooks/stop-worktree-check.sh +0 -46
  334. package/dist/templates/.claude/hooks/test_classify_command.py +0 -370
  335. package/dist/templates/.claude/hooks/test_wrapper_smoke.sh +0 -96
  336. package/dist/templates/.claude/hooks/validate-spec.sh +0 -76
  337. package/dist/templates/.claude/hooks/worktree-guard.sh +0 -220
  338. package/dist/templates/.claude/hooks/worktree-write-guard.sh +0 -190
  339. package/dist/templates/.claude/rules/git-safety.md +0 -26
  340. package/dist/templates/.claude/rules/worktree-isolation.md +0 -101
  341. package/dist/templates/.claude/settings.json +0 -141
  342. package/dist/templates/.cursor/README.md +0 -299
  343. package/dist/templates/.cursor/hooks/audit.sh +0 -55
  344. package/dist/templates/.cursor/hooks/block-dangerous.sh +0 -84
  345. package/dist/templates/.cursor/hooks/caws-quality-check.sh +0 -52
  346. package/dist/templates/.cursor/hooks/caws-scope-guard.sh +0 -130
  347. package/dist/templates/.cursor/hooks/format.sh +0 -38
  348. package/dist/templates/.cursor/hooks/naming-check.sh +0 -64
  349. package/dist/templates/.cursor/hooks/scan-secrets.sh +0 -51
  350. package/dist/templates/.cursor/hooks/scope-guard.sh +0 -52
  351. package/dist/templates/.cursor/hooks/session-log.sh +0 -924
  352. package/dist/templates/.cursor/hooks/validate-spec.sh +0 -83
  353. package/dist/templates/.cursor/hooks.json +0 -76
  354. package/dist/templates/.cursor/rules/00-claims-verification.mdc +0 -144
  355. package/dist/templates/.cursor/rules/01-working-style.mdc +0 -50
  356. package/dist/templates/.cursor/rules/02-quality-gates.mdc +0 -368
  357. package/dist/templates/.cursor/rules/03-naming-and-refactor.mdc +0 -33
  358. package/dist/templates/.cursor/rules/04-logging-language-style.mdc +0 -23
  359. package/dist/templates/.cursor/rules/05-safe-defaults-guards.mdc +0 -23
  360. package/dist/templates/.cursor/rules/06-typescript-conventions.mdc +0 -36
  361. package/dist/templates/.cursor/rules/07-process-ops.mdc +0 -20
  362. package/dist/templates/.cursor/rules/08-solid-and-architecture.mdc +0 -16
  363. package/dist/templates/.cursor/rules/09-docstrings.mdc +0 -89
  364. package/dist/templates/.cursor/rules/10-documentation-quality-standards.mdc +0 -385
  365. package/dist/templates/.cursor/rules/11-scope-management-waivers.mdc +0 -381
  366. package/dist/templates/.cursor/rules/12-implementation-completeness.mdc +0 -516
  367. package/dist/templates/.cursor/rules/13-language-agnostic-standards.mdc +0 -578
  368. package/dist/templates/.cursor/rules/README.md +0 -148
  369. package/dist/templates/.github/copilot-instructions.md +0 -82
  370. package/dist/templates/.idea/runConfigurations/CAWS_Evaluate.xml +0 -5
  371. package/dist/templates/.idea/runConfigurations/CAWS_Validate.xml +0 -5
  372. package/dist/templates/.junie/guidelines.md +0 -73
  373. package/dist/templates/.vscode/launch.json +0 -17
  374. package/dist/templates/.vscode/settings.json +0 -95
  375. package/dist/templates/.windsurf/rules/caws-quality-standards.md +0 -54
  376. package/dist/templates/.windsurf/workflows/caws-guided-development.md +0 -92
  377. package/dist/templates/CLAUDE.md +0 -196
  378. package/dist/templates/COMMIT_CONVENTIONS.md +0 -86
  379. package/dist/templates/OIDC_SETUP.md +0 -300
  380. package/dist/templates/agents.md +0 -171
  381. package/dist/templates/codemod/README.md +0 -1
  382. package/dist/templates/codemod/test.js +0 -93
  383. package/dist/templates/docs/README.md +0 -151
  384. package/dist/templates/scripts/new_feature.sh +0 -80
  385. package/dist/templates/scripts/quality-gates/check-god-objects.js +0 -146
  386. package/dist/templates/scripts/quality-gates/run-quality-gates.js +0 -50
  387. package/dist/templates/scripts/v3/analysis/todo_analyzer.py +0 -1997
  388. package/dist/test-analysis.js +0 -786
  389. package/dist/tool-interface.js +0 -314
  390. package/dist/tool-loader.js +0 -303
  391. package/dist/tool-validator.js +0 -393
  392. package/dist/utils/agent-display.js +0 -210
  393. package/dist/utils/agent-session.js +0 -344
  394. package/dist/utils/async-utils.js +0 -188
  395. package/dist/utils/command-wrapper.js +0 -200
  396. package/dist/utils/event-log.js +0 -584
  397. package/dist/utils/event-renderer.js +0 -521
  398. package/dist/utils/finalization.js +0 -230
  399. package/dist/utils/git-lock.js +0 -119
  400. package/dist/utils/gitignore-updater.js +0 -158
  401. package/dist/utils/ide-detection.js +0 -133
  402. package/dist/utils/lifecycle-events.js +0 -94
  403. package/dist/utils/project-analysis.js +0 -367
  404. package/dist/utils/promise-utils.js +0 -72
  405. package/dist/utils/quality-gates-errors.js +0 -520
  406. package/dist/utils/quality-gates-utils.js +0 -387
  407. package/dist/utils/schema-validator.js +0 -50
  408. package/dist/utils/spec-resolver.js +0 -711
  409. package/dist/utils/typescript-detector.js +0 -369
  410. package/dist/utils/working-state.js +0 -530
  411. package/dist/utils/yaml-validation.js +0 -156
  412. package/dist/validation/spec-validation.js +0 -924
  413. package/dist/waivers-manager.js +0 -732
  414. package/dist/worktree/worktree-manager.js +0 -1735
  415. package/templates/.caws/schemas/policy.schema.json +0 -117
  416. package/templates/.caws/schemas/scope.schema.json +0 -52
  417. package/templates/.caws/schemas/waivers.schema.json +0 -106
  418. package/templates/.caws/schemas/working-spec.schema.json +0 -340
  419. package/templates/.caws/schemas/worktrees.schema.json +0 -38
  420. package/templates/.caws/templates/working-spec.template.yml +0 -80
  421. package/templates/.caws/tools/README.md +0 -18
  422. package/templates/.caws/tools/scope-guard.js +0 -203
  423. package/templates/.caws/tools-allow.json +0 -331
  424. package/templates/.caws/waivers.yml +0 -19
  425. package/templates/.claude/README.md +0 -190
  426. package/templates/.claude/hooks/audit.sh +0 -121
  427. package/templates/.claude/hooks/block-dangerous.sh +0 -203
  428. package/templates/.claude/hooks/classify_command.py +0 -592
  429. package/templates/.claude/hooks/doc-frontmatter-check.sh +0 -173
  430. package/templates/.claude/hooks/lite-sprawl-check.sh +0 -145
  431. package/templates/.claude/hooks/naming-check.sh +0 -100
  432. package/templates/.claude/hooks/protected-paths.sh +0 -39
  433. package/templates/.claude/hooks/quality-check.sh +0 -81
  434. package/templates/.claude/hooks/scan-secrets.sh +0 -85
  435. package/templates/.claude/hooks/scope-guard.sh +0 -381
  436. package/templates/.claude/hooks/session-caws-status.sh +0 -117
  437. package/templates/.claude/hooks/session-log.sh +0 -634
  438. package/templates/.claude/hooks/simplification-guard.sh +0 -92
  439. package/templates/.claude/hooks/stop-worktree-check.sh +0 -46
  440. package/templates/.claude/hooks/test_classify_command.py +0 -370
  441. package/templates/.claude/hooks/test_wrapper_smoke.sh +0 -96
  442. package/templates/.claude/hooks/validate-spec.sh +0 -76
  443. package/templates/.claude/hooks/worktree-guard.sh +0 -220
  444. package/templates/.claude/hooks/worktree-write-guard.sh +0 -190
  445. package/templates/.claude/rules/git-safety.md +0 -26
  446. package/templates/.claude/rules/worktree-isolation.md +0 -101
  447. package/templates/.claude/settings.json +0 -141
  448. package/templates/.cursor/README.md +0 -299
  449. package/templates/.cursor/hooks/audit.sh +0 -55
  450. package/templates/.cursor/hooks/block-dangerous.sh +0 -84
  451. package/templates/.cursor/hooks/caws-quality-check.sh +0 -52
  452. package/templates/.cursor/hooks/caws-scope-guard.sh +0 -130
  453. package/templates/.cursor/hooks/format.sh +0 -38
  454. package/templates/.cursor/hooks/naming-check.sh +0 -64
  455. package/templates/.cursor/hooks/scan-secrets.sh +0 -51
  456. package/templates/.cursor/hooks/scope-guard.sh +0 -52
  457. package/templates/.cursor/hooks/session-log.sh +0 -924
  458. package/templates/.cursor/hooks/validate-spec.sh +0 -83
  459. package/templates/.cursor/hooks.json +0 -76
  460. package/templates/.cursor/rules/00-claims-verification.mdc +0 -144
  461. package/templates/.cursor/rules/01-working-style.mdc +0 -50
  462. package/templates/.cursor/rules/02-quality-gates.mdc +0 -368
  463. package/templates/.cursor/rules/03-naming-and-refactor.mdc +0 -33
  464. package/templates/.cursor/rules/04-logging-language-style.mdc +0 -23
  465. package/templates/.cursor/rules/05-safe-defaults-guards.mdc +0 -23
  466. package/templates/.cursor/rules/06-typescript-conventions.mdc +0 -36
  467. package/templates/.cursor/rules/07-process-ops.mdc +0 -20
  468. package/templates/.cursor/rules/08-solid-and-architecture.mdc +0 -16
  469. package/templates/.cursor/rules/09-docstrings.mdc +0 -89
  470. package/templates/.cursor/rules/10-documentation-quality-standards.mdc +0 -385
  471. package/templates/.cursor/rules/11-scope-management-waivers.mdc +0 -381
  472. package/templates/.cursor/rules/12-implementation-completeness.mdc +0 -516
  473. package/templates/.cursor/rules/13-language-agnostic-standards.mdc +0 -578
  474. package/templates/.cursor/rules/README.md +0 -148
  475. package/templates/.github/copilot-instructions.md +0 -82
  476. package/templates/.idea/runConfigurations/CAWS_Evaluate.xml +0 -5
  477. package/templates/.idea/runConfigurations/CAWS_Validate.xml +0 -5
  478. package/templates/.junie/guidelines.md +0 -73
  479. package/templates/.vscode/launch.json +0 -17
  480. package/templates/.vscode/settings.json +0 -95
  481. package/templates/.windsurf/rules/caws-quality-standards.md +0 -54
  482. package/templates/.windsurf/workflows/caws-guided-development.md +0 -92
  483. package/templates/CLAUDE.md +0 -196
  484. package/templates/COMMIT_CONVENTIONS.md +0 -86
  485. package/templates/OIDC_SETUP.md +0 -300
  486. package/templates/agents.md +0 -171
  487. package/templates/codemod/README.md +0 -1
  488. package/templates/codemod/test.js +0 -93
  489. package/templates/docs/README.md +0 -151
  490. package/templates/scripts/new_feature.sh +0 -80
  491. package/templates/scripts/quality-gates/check-god-objects.js +0 -146
  492. package/templates/scripts/quality-gates/run-quality-gates.js +0 -50
  493. package/templates/scripts/v3/analysis/todo_analyzer.py +0 -1997
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ // Resolve the canonical CAWS repo root.
3
+ //
4
+ // CAWS lives under a single `.caws/` directory in the *main* repository,
5
+ // not under linked worktrees. A worktree's `.git` is a file pointing at
6
+ // `<main>/.git/worktrees/<name>/`. Using `git rev-parse --show-toplevel`
7
+ // from inside a worktree would return the WORKTREE's filesystem root,
8
+ // not the main repo's — and any path derived from it would write state
9
+ // into the worktree's filesystem.
10
+ //
11
+ // The correct authority is:
12
+ //
13
+ // git rev-parse --path-format=absolute --git-common-dir
14
+ //
15
+ // which returns `<main>/.git` regardless of where the caller stands. The
16
+ // CAWS repo root is the parent of that directory. The `.caws/` directory
17
+ // is one level deeper.
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
30
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
31
+ }) : function(o, v) {
32
+ o["default"] = v;
33
+ });
34
+ var __importStar = (this && this.__importStar) || (function () {
35
+ var ownKeys = function(o) {
36
+ ownKeys = Object.getOwnPropertyNames || function (o) {
37
+ var ar = [];
38
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
39
+ return ar;
40
+ };
41
+ return ownKeys(o);
42
+ };
43
+ return function (mod) {
44
+ if (mod && mod.__esModule) return mod;
45
+ var result = {};
46
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
47
+ __setModuleDefault(result, mod);
48
+ return result;
49
+ };
50
+ })();
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.defaultGitRunner = void 0;
53
+ exports.resolveRepoRoot = resolveRepoRoot;
54
+ exports.storeDiagnostic = storeDiagnostic;
55
+ const child_process_1 = require("child_process");
56
+ const fs = __importStar(require("fs"));
57
+ const path = __importStar(require("path"));
58
+ const caws_kernel_1 = require("@paths.design/caws-kernel");
59
+ const rules_1 = require("./rules");
60
+ const defaultGitRunner = (args, options) => {
61
+ const execOptions = {
62
+ cwd: options.cwd,
63
+ encoding: 'utf8',
64
+ stdio: ['ignore', 'pipe', 'pipe'],
65
+ };
66
+ return (0, child_process_1.execFileSync)('git', args, execOptions).trim();
67
+ };
68
+ exports.defaultGitRunner = defaultGitRunner;
69
+ /**
70
+ * Resolve the main-repo root from `cwd`, even when cwd is inside a linked
71
+ * worktree.
72
+ *
73
+ * Returns Err when:
74
+ * - cwd is not inside a git repository, OR
75
+ * - git invocation fails for another reason, OR
76
+ * - `requireCawsDir: true` and `.caws/` does not exist.
77
+ *
78
+ * Programmer errors (cwd not a string, git binary missing) throw.
79
+ */
80
+ function resolveRepoRoot(cwd, options = {}) {
81
+ if (typeof cwd !== 'string' || cwd.length === 0) {
82
+ throw new TypeError('resolveRepoRoot: cwd must be a non-empty string.');
83
+ }
84
+ const git = options.git ?? exports.defaultGitRunner;
85
+ let commonDir;
86
+ try {
87
+ commonDir = git(['rev-parse', '--path-format=absolute', '--git-common-dir'], {
88
+ cwd,
89
+ });
90
+ }
91
+ catch (e) {
92
+ const cause = e;
93
+ const stderr = typeof cause.stderr === 'string'
94
+ ? cause.stderr
95
+ : cause.stderr instanceof Buffer
96
+ ? cause.stderr.toString('utf8')
97
+ : '';
98
+ // "not a git repository" surfaces on stderr.
99
+ if (stderr.toLowerCase().includes('not a git repository')) {
100
+ return (0, caws_kernel_1.err)((0, caws_kernel_1.diagnostic)({
101
+ rule: rules_1.STORE_RULES.REPO_ROOT_NOT_A_GIT_REPO,
102
+ authority: 'kernel/diagnostics',
103
+ message: `${cwd} is not inside a git repository.`,
104
+ subject: cwd,
105
+ narrowRepair: 'Run `git init` or change directory to a repository.',
106
+ }));
107
+ }
108
+ return (0, caws_kernel_1.err)((0, caws_kernel_1.diagnostic)({
109
+ rule: rules_1.STORE_RULES.REPO_ROOT_GIT_INVOCATION_FAILED,
110
+ authority: 'kernel/diagnostics',
111
+ message: `git rev-parse failed: ${cause.message ?? 'unknown error'}.`,
112
+ subject: cwd,
113
+ data: { stderr },
114
+ }));
115
+ }
116
+ // commonDir is the path to <main>/.git (or a separate gitdir). The
117
+ // repository root is its parent. We do NOT use --show-toplevel.
118
+ const repoRoot = path.dirname(commonDir);
119
+ const cawsDir = path.join(repoRoot, '.caws');
120
+ if (options.requireCawsDir && !fs.existsSync(cawsDir)) {
121
+ return (0, caws_kernel_1.err)((0, caws_kernel_1.diagnostic)({
122
+ rule: rules_1.STORE_RULES.REPO_ROOT_CAWS_DIR_MISSING,
123
+ authority: 'kernel/diagnostics',
124
+ message: `Resolved repo root has no .caws/ directory: ${repoRoot}.`,
125
+ subject: repoRoot,
126
+ narrowRepair: 'Run `caws init` to bootstrap the repository.',
127
+ }));
128
+ }
129
+ return (0, caws_kernel_1.ok)({ repoRoot, cawsDir });
130
+ }
131
+ // ----------------------------------------------------------------------------
132
+ // Helpers exposed for tests
133
+ // ----------------------------------------------------------------------------
134
+ /** Construct a structured Diagnostic with the canonical store authority. */
135
+ function storeDiagnostic(rule, message, extra = {}) {
136
+ return (0, caws_kernel_1.diagnostic)({
137
+ rule,
138
+ authority: 'kernel/diagnostics',
139
+ message,
140
+ ...(extra.subject !== undefined ? { subject: extra.subject } : {}),
141
+ ...(extra.narrowRepair !== undefined ? { narrowRepair: extra.narrowRepair } : {}),
142
+ ...(extra.data !== undefined ? { data: extra.data } : {}),
143
+ });
144
+ }
145
+ //# sourceMappingURL=repo-root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-root.js","sourceRoot":"","sources":["../../src/store/repo-root.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,sEAAsE;AACtE,uEAAuE;AACvE,kCAAkC;AAClC,EAAE;AACF,4BAA4B;AAC5B,EAAE;AACF,0DAA0D;AAC1D,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEvB,0CAgEC;AAOD,0CAaC;AAzJD,iDAAyF;AACzF,uCAAyB;AACzB,2CAA6B;AAC7B,2DAMmC;AACnC,mCAAsC;AAyB/B,MAAM,gBAAgB,GAAc,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;IAC3D,MAAM,WAAW,GAA0C;QACzD,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC;IACF,OAAO,IAAA,4BAAY,EAAC,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,IAAI,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E,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,69 @@
1
+ export declare const STORE_RULES: {
2
+ readonly REPO_ROOT_NOT_A_GIT_REPO: "store.repo_root.not_a_git_repo";
3
+ readonly REPO_ROOT_GIT_INVOCATION_FAILED: "store.repo_root.git_invocation_failed";
4
+ readonly REPO_ROOT_CAWS_DIR_MISSING: "store.repo_root.caws_dir_missing";
5
+ /** Distinguishable so callers can decide missing → Ok([]) vs missing → Err. */
6
+ readonly READ_MISSING_FILE: "store.read.missing_file";
7
+ readonly READ_NOT_A_FILE: "store.read.not_a_file";
8
+ readonly READ_IO_FAILED: "store.read.io_failed";
9
+ /** YAML parse failure. */
10
+ readonly READ_YAML_INVALID: "store.read.yaml_invalid";
11
+ /** JSON parse failure. */
12
+ readonly READ_JSON_INVALID: "store.read.json_invalid";
13
+ readonly WRITE_IO_FAILED: "store.write.io_failed";
14
+ /** Patch references a registry entry that does not exist (rebind/takeover). */
15
+ readonly WRITE_PATCH_TARGET_MISSING: "store.write.patch_target_missing";
16
+ /** A single spec file failed validation; the load itself still succeeds. */
17
+ readonly SPECS_SPEC_INVALID: "store.specs.spec_invalid";
18
+ /** A non-spec file landed in .caws/specs/ (e.g., README.md). Soft skip. */
19
+ readonly SPECS_NON_YAML_SKIPPED: "store.specs.non_yaml_skipped";
20
+ /** Two spec files declared the same spec id. */
21
+ readonly SPECS_DUPLICATE_ID: "store.specs.duplicate_id";
22
+ /** worktrees.json or agents.json parsed but is not a plain object. */
23
+ readonly REGISTRY_NOT_OBJECT: "store.registry.not_object";
24
+ /** A single waiver file failed validation; the load itself still succeeds. */
25
+ readonly WAIVERS_FILE_INVALID: "store.waivers.file_invalid";
26
+ /** Non-YAML file in .caws/waivers/. Soft skip. */
27
+ readonly WAIVERS_NON_YAML_SKIPPED: "store.waivers.non_yaml_skipped";
28
+ /** Two waiver files declared the same waiver id. */
29
+ readonly WAIVERS_DUPLICATE_ID: "store.waivers.duplicate_id";
30
+ /** Filename did not match the waiver id. */
31
+ readonly WAIVERS_FILENAME_MISMATCH: "store.waivers.filename_mismatch";
32
+ /** Caller tried to create a waiver with an id that already exists. */
33
+ readonly WAIVERS_ALREADY_EXISTS: "store.waivers.already_exists";
34
+ /** Caller tried to revoke a waiver that does not exist. */
35
+ readonly WAIVERS_NOT_FOUND: "store.waivers.not_found";
36
+ /** Interior (non-trailing) malformed JSON line in events.jsonl. */
37
+ readonly EVENTS_INTERIOR_MALFORMED_LINE: "store.events.interior_malformed_line";
38
+ /** Trailing partial line (crash-recovery). Tolerated; emitted as warning. */
39
+ readonly EVENTS_TRAILING_PARTIAL_LINE: "store.events.trailing_partial_line";
40
+ /** Event line parsed as JSON but did not pass validateChainedEvent. */
41
+ readonly EVENTS_INVALID_EVENT_SHAPE: "store.events.invalid_event_shape";
42
+ /** Failed to acquire the events.jsonl lock after the bounded retry. */
43
+ readonly EVENTS_LOCK_CONTENTION: "store.events.lock_contention";
44
+ /** prepareAppend rejected the body. Carries the kernel diagnostics. */
45
+ readonly EVENTS_PREPARE_APPEND_REJECTED: "store.events.prepare_append_rejected";
46
+ /** A legacy file (e.g., working-spec.yaml) blocks vNext init. */
47
+ readonly INIT_LEGACY_RESIDUE: "store.init.legacy_residue";
48
+ /** init seeded a default policy that did not pass kernel validation. */
49
+ readonly INIT_DEFAULT_POLICY_INVALID: "store.init.default_policy_invalid";
50
+ /** Failed to acquire the global .caws/state.lock after bounded retry. */
51
+ readonly LIFECYCLE_LOCK_CONTENTION: "store.lifecycle.lock_contention";
52
+ /** Plan validation rejected the proposed transaction before any write. */
53
+ readonly LIFECYCLE_PLAN_REJECTED: "store.lifecycle.plan_rejected";
54
+ /** A planned file write failed; the transaction aborted before event append. */
55
+ readonly LIFECYCLE_WRITE_FAILED: "store.lifecycle.write_failed";
56
+ /** State writes succeeded but event append failed; rollback succeeded. */
57
+ readonly LIFECYCLE_PARTIAL_FAILURE_RECOVERED: "store.lifecycle.partial_failure_recovered";
58
+ /** State writes succeeded, event append failed, AND rollback also failed.
59
+ * Caller MUST handle the recovery instruction in the diagnostic data. */
60
+ readonly LIFECYCLE_PARTIAL_FAILURE_UNRECOVERED: "store.lifecycle.partial_failure_unrecovered";
61
+ /** yaml-patch refused an ambiguous mutation (e.g., duplicate top-level key,
62
+ * or a flow-style mapping at the target location). */
63
+ readonly YAML_PATCH_AMBIGUOUS: "store.yaml_patch.ambiguous";
64
+ /** yaml-patch refused because the target key was not found in the document. */
65
+ readonly YAML_PATCH_KEY_NOT_FOUND: "store.yaml_patch.key_not_found";
66
+ };
67
+ export type StoreRule = (typeof STORE_RULES)[keyof typeof STORE_RULES];
68
+ export declare const STORE_RULE_PREFIXES: readonly ["store.repo_root.", "store.read.", "store.write.", "store.specs.", "store.waivers.", "store.registry.", "store.events.", "store.init."];
69
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/store/rules.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW;;;;IAOtB,+EAA+E;;;;IAI/E,0BAA0B;;IAE1B,0BAA0B;;;IAK1B,+EAA+E;;IAI/E,4EAA4E;;IAE5E,2EAA2E;;IAE3E,gDAAgD;;IAIhD,sEAAsE;;IAItE,8EAA8E;;IAE9E,kDAAkD;;IAElD,oDAAoD;;IAEpD,4CAA4C;;IAE5C,sEAAsE;;IAEtE,2DAA2D;;IAI3D,mEAAmE;;IAEnE,6EAA6E;;IAE7E,uEAAuE;;IAEvE,uEAAuE;;IAEvE,uEAAuE;;IAIvE,iEAAiE;;IAEjE,wEAAwE;;IAIxE,yEAAyE;;IAEzE,0EAA0E;;IAE1E,gFAAgF;;IAEhF,0EAA0E;;IAG1E;8EAC0E;;IAG1E;2DACuD;;IAEvD,+EAA+E;;CAEvE,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEvE,eAAO,MAAM,mBAAmB,mJAStB,CAAC"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ // Stable rule identifiers for the Node-only store layer.
3
+ //
4
+ // These ids are public contract for shell-side diagnostics. The store is
5
+ // the only place outside the kernel that emits Diagnostics under the
6
+ // `kernel/diagnostics` authority — store-specific authority is reserved
7
+ // for future. Until then, store rule ids carry the `store.*` namespace.
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.STORE_RULE_PREFIXES = exports.STORE_RULES = void 0;
10
+ exports.STORE_RULES = {
11
+ // ---- repo root resolution -----------------------------------------------
12
+ REPO_ROOT_NOT_A_GIT_REPO: 'store.repo_root.not_a_git_repo',
13
+ REPO_ROOT_GIT_INVOCATION_FAILED: 'store.repo_root.git_invocation_failed',
14
+ REPO_ROOT_CAWS_DIR_MISSING: 'store.repo_root.caws_dir_missing',
15
+ // ---- file I/O ------------------------------------------------------------
16
+ /** Distinguishable so callers can decide missing → Ok([]) vs missing → Err. */
17
+ READ_MISSING_FILE: 'store.read.missing_file',
18
+ READ_NOT_A_FILE: 'store.read.not_a_file',
19
+ READ_IO_FAILED: 'store.read.io_failed',
20
+ /** YAML parse failure. */
21
+ READ_YAML_INVALID: 'store.read.yaml_invalid',
22
+ /** JSON parse failure. */
23
+ READ_JSON_INVALID: 'store.read.json_invalid',
24
+ // ---- atomic write --------------------------------------------------------
25
+ WRITE_IO_FAILED: 'store.write.io_failed',
26
+ /** Patch references a registry entry that does not exist (rebind/takeover). */
27
+ WRITE_PATCH_TARGET_MISSING: 'store.write.patch_target_missing',
28
+ // ---- specs ---------------------------------------------------------------
29
+ /** A single spec file failed validation; the load itself still succeeds. */
30
+ SPECS_SPEC_INVALID: 'store.specs.spec_invalid',
31
+ /** A non-spec file landed in .caws/specs/ (e.g., README.md). Soft skip. */
32
+ SPECS_NON_YAML_SKIPPED: 'store.specs.non_yaml_skipped',
33
+ /** Two spec files declared the same spec id. */
34
+ SPECS_DUPLICATE_ID: 'store.specs.duplicate_id',
35
+ // ---- registries ---------------------------------------------------------
36
+ /** worktrees.json or agents.json parsed but is not a plain object. */
37
+ REGISTRY_NOT_OBJECT: 'store.registry.not_object',
38
+ // ---- waivers ------------------------------------------------------------
39
+ /** A single waiver file failed validation; the load itself still succeeds. */
40
+ WAIVERS_FILE_INVALID: 'store.waivers.file_invalid',
41
+ /** Non-YAML file in .caws/waivers/. Soft skip. */
42
+ WAIVERS_NON_YAML_SKIPPED: 'store.waivers.non_yaml_skipped',
43
+ /** Two waiver files declared the same waiver id. */
44
+ WAIVERS_DUPLICATE_ID: 'store.waivers.duplicate_id',
45
+ /** Filename did not match the waiver id. */
46
+ WAIVERS_FILENAME_MISMATCH: 'store.waivers.filename_mismatch',
47
+ /** Caller tried to create a waiver with an id that already exists. */
48
+ WAIVERS_ALREADY_EXISTS: 'store.waivers.already_exists',
49
+ /** Caller tried to revoke a waiver that does not exist. */
50
+ WAIVERS_NOT_FOUND: 'store.waivers.not_found',
51
+ // ---- events -------------------------------------------------------------
52
+ /** Interior (non-trailing) malformed JSON line in events.jsonl. */
53
+ EVENTS_INTERIOR_MALFORMED_LINE: 'store.events.interior_malformed_line',
54
+ /** Trailing partial line (crash-recovery). Tolerated; emitted as warning. */
55
+ EVENTS_TRAILING_PARTIAL_LINE: 'store.events.trailing_partial_line',
56
+ /** Event line parsed as JSON but did not pass validateChainedEvent. */
57
+ EVENTS_INVALID_EVENT_SHAPE: 'store.events.invalid_event_shape',
58
+ /** Failed to acquire the events.jsonl lock after the bounded retry. */
59
+ EVENTS_LOCK_CONTENTION: 'store.events.lock_contention',
60
+ /** prepareAppend rejected the body. Carries the kernel diagnostics. */
61
+ EVENTS_PREPARE_APPEND_REJECTED: 'store.events.prepare_append_rejected',
62
+ // ---- init (slice 7b) ----------------------------------------------------
63
+ /** A legacy file (e.g., working-spec.yaml) blocks vNext init. */
64
+ INIT_LEGACY_RESIDUE: 'store.init.legacy_residue',
65
+ /** init seeded a default policy that did not pass kernel validation. */
66
+ INIT_DEFAULT_POLICY_INVALID: 'store.init.default_policy_invalid',
67
+ // ---- lifecycle mutation substrate (LIFECYCLE-MUTATION-001) -------------
68
+ /** Failed to acquire the global .caws/state.lock after bounded retry. */
69
+ LIFECYCLE_LOCK_CONTENTION: 'store.lifecycle.lock_contention',
70
+ /** Plan validation rejected the proposed transaction before any write. */
71
+ LIFECYCLE_PLAN_REJECTED: 'store.lifecycle.plan_rejected',
72
+ /** A planned file write failed; the transaction aborted before event append. */
73
+ LIFECYCLE_WRITE_FAILED: 'store.lifecycle.write_failed',
74
+ /** State writes succeeded but event append failed; rollback succeeded. */
75
+ LIFECYCLE_PARTIAL_FAILURE_RECOVERED: 'store.lifecycle.partial_failure_recovered',
76
+ /** State writes succeeded, event append failed, AND rollback also failed.
77
+ * Caller MUST handle the recovery instruction in the diagnostic data. */
78
+ LIFECYCLE_PARTIAL_FAILURE_UNRECOVERED: 'store.lifecycle.partial_failure_unrecovered',
79
+ /** yaml-patch refused an ambiguous mutation (e.g., duplicate top-level key,
80
+ * or a flow-style mapping at the target location). */
81
+ YAML_PATCH_AMBIGUOUS: 'store.yaml_patch.ambiguous',
82
+ /** yaml-patch refused because the target key was not found in the document. */
83
+ YAML_PATCH_KEY_NOT_FOUND: 'store.yaml_patch.key_not_found',
84
+ };
85
+ exports.STORE_RULE_PREFIXES = [
86
+ 'store.repo_root.',
87
+ 'store.read.',
88
+ 'store.write.',
89
+ 'store.specs.',
90
+ 'store.waivers.',
91
+ 'store.registry.',
92
+ 'store.events.',
93
+ 'store.init.',
94
+ ];
95
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/store/rules.ts"],"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B,EAAE,sCAAsC;IAEtE,4EAA4E;IAC5E,iEAAiE;IACjE,mBAAmB,EAAE,2BAA2B;IAChD,wEAAwE;IACxE,2BAA2B,EAAE,mCAAmC;IAEhE,2EAA2E;IAC3E,yEAAyE;IACzE,yBAAyB,EAAE,iCAAiC;IAC5D,0EAA0E;IAC1E,uBAAuB,EAAE,+BAA+B;IACxD,gFAAgF;IAChF,sBAAsB,EAAE,8BAA8B;IACtD,0EAA0E;IAC1E,mCAAmC,EACjC,2CAA2C;IAC7C;8EAC0E;IAC1E,qCAAqC,EACnC,6CAA6C;IAC/C;2DACuD;IACvD,oBAAoB,EAAE,4BAA4B;IAClD,+EAA+E;IAC/E,wBAAwB,EAAE,gCAAgC;CAClD,CAAC;AAIE,QAAA,mBAAmB,GAAG;IACjC,kBAAkB;IAClB,aAAa;IACb,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,aAAa;CACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SpecsLoadResult } from './types';
2
+ export declare function loadSpecs(cawsDir: string): SpecsLoadResult;
3
+ //# sourceMappingURL=specs-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specs-store.d.ts","sourceRoot":"","sources":["../../src/store/specs-store.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAM/C,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAmG1D"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ // Specs loader.
3
+ //
4
+ // Multi-spec only. Loads every `*.yaml` / `*.yml` file directly under
5
+ // `.caws/specs/`, hands each source to the kernel's `parseAndValidateSpec`,
6
+ // and collects the results.
7
+ //
8
+ // Discipline:
9
+ // - DOES NOT resurrect `.caws/working-spec.yaml`. The project-level
10
+ // spec is gone in vNext; the only authoritative source is per-feature
11
+ // specs under .caws/specs/.
12
+ // - Skips files that are not .yaml/.yml with a soft `non_yaml_skipped`
13
+ // diagnostic (info severity).
14
+ // - Per-file validation failures land in `diagnostics`; the valid
15
+ // specs are still returned. doctor decides how to surface them.
16
+ // - Duplicate spec ids → diagnostic; the first occurrence wins.
17
+ // - Missing `.caws/specs/` directory → returns `{ specs: [], diagnostics: [] }`.
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
30
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
31
+ }) : function(o, v) {
32
+ o["default"] = v;
33
+ });
34
+ var __importStar = (this && this.__importStar) || (function () {
35
+ var ownKeys = function(o) {
36
+ ownKeys = Object.getOwnPropertyNames || function (o) {
37
+ var ar = [];
38
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
39
+ return ar;
40
+ };
41
+ return ownKeys(o);
42
+ };
43
+ return function (mod) {
44
+ if (mod && mod.__esModule) return mod;
45
+ var result = {};
46
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
47
+ __setModuleDefault(result, mod);
48
+ return result;
49
+ };
50
+ })();
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.loadSpecs = loadSpecs;
53
+ const fs = __importStar(require("fs"));
54
+ const path = __importStar(require("path"));
55
+ const caws_kernel_1 = require("@paths.design/caws-kernel");
56
+ const repo_root_1 = require("./repo-root");
57
+ const rules_1 = require("./rules");
58
+ const yaml_store_1 = require("./yaml-store");
59
+ function isYamlPath(name) {
60
+ return name.endsWith('.yaml') || name.endsWith('.yml');
61
+ }
62
+ function loadSpecs(cawsDir) {
63
+ const specsDir = path.join(cawsDir, 'specs');
64
+ if (!fs.existsSync(specsDir)) {
65
+ return { specs: [], diagnostics: [] };
66
+ }
67
+ let entries;
68
+ try {
69
+ entries = fs.readdirSync(specsDir, { withFileTypes: true });
70
+ }
71
+ catch (e) {
72
+ const cause = e;
73
+ return {
74
+ specs: [],
75
+ diagnostics: [
76
+ (0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.READ_IO_FAILED, `Failed to read ${specsDir}: ${cause.message ?? 'unknown error'}.`, { subject: specsDir, data: { code: cause.code } }),
77
+ ],
78
+ };
79
+ }
80
+ const validSpecs = [];
81
+ const diagnostics = [];
82
+ const seenIds = new Map(); // id → first-seen file path
83
+ // Sort for determinism. composeDoctorSnapshot should produce the same
84
+ // snapshot for the same on-disk state.
85
+ entries.sort((a, b) => a.name.localeCompare(b.name));
86
+ for (const entry of entries) {
87
+ if (!entry.isFile())
88
+ continue;
89
+ // Explicit guard: working-spec.yaml is forbidden in vNext.
90
+ if (entry.name === 'working-spec.yaml' || entry.name === 'working-spec.yml') {
91
+ diagnostics.push((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.SPECS_NON_YAML_SKIPPED, `Skipping ${entry.name}: project-level working spec is not supported in vNext.`, { subject: path.join(specsDir, entry.name) }));
92
+ continue;
93
+ }
94
+ const fullPath = path.join(specsDir, entry.name);
95
+ if (!isYamlPath(entry.name)) {
96
+ diagnostics.push((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.SPECS_NON_YAML_SKIPPED, `Skipping non-YAML file in .caws/specs/: ${entry.name}.`, { subject: fullPath }));
97
+ continue;
98
+ }
99
+ const source = (0, yaml_store_1.readYamlSource)(fullPath);
100
+ if (!(0, caws_kernel_1.isOk)(source)) {
101
+ diagnostics.push(...source.errors);
102
+ continue;
103
+ }
104
+ const result = (0, caws_kernel_1.parseAndValidateSpec)(source.value);
105
+ if (!(0, caws_kernel_1.isOk)(result)) {
106
+ // Wrap kernel diagnostics with the offending file as subject when
107
+ // the kernel didn't already attach one.
108
+ for (const d of result.errors) {
109
+ diagnostics.push({
110
+ ...d,
111
+ subject: d.subject ?? fullPath,
112
+ });
113
+ }
114
+ continue;
115
+ }
116
+ const spec = result.value;
117
+ const existing = seenIds.get(spec.id);
118
+ if (existing !== undefined) {
119
+ diagnostics.push((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.SPECS_DUPLICATE_ID, `Duplicate spec id "${spec.id}" — already loaded from ${existing}.`, {
120
+ subject: fullPath,
121
+ narrowRepair: `Rename the spec id in ${entry.name} or remove the duplicate file.`,
122
+ data: { spec_id: spec.id, first_seen: existing, duplicate: fullPath },
123
+ }));
124
+ continue;
125
+ }
126
+ seenIds.set(spec.id, fullPath);
127
+ validSpecs.push(spec);
128
+ }
129
+ return { specs: validSpecs, diagnostics };
130
+ }
131
+ //# sourceMappingURL=specs-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specs-store.js","sourceRoot":"","sources":["../../src/store/specs-store.ts"],"names":[],"mappings":";AAAA,gBAAgB;AAChB,EAAE;AACF,sEAAsE;AACtE,4EAA4E;AAC5E,4BAA4B;AAC5B,EAAE;AACF,cAAc;AACd,sEAAsE;AACtE,0EAA0E;AAC1E,gCAAgC;AAChC,yEAAyE;AACzE,kCAAkC;AAClC,oEAAoE;AACpE,oEAAoE;AACpE,kEAAkE;AAClE,mFAAmF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBnF,8BAmGC;AApHD,uCAAyB;AACzB,2CAA6B;AAC7B,2DAKmC;AACnC,2CAA8C;AAC9C,mCAAsC;AACtC,6CAA8C;AAG9C,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACz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SAAS;QACX,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,WAAW,CAAC,IAAI,CACd,IAAA,2BAAe,EACb,mBAAW,CAAC,kBAAkB,EAC9B,sBAAsB,IAAI,CAAC,EAAE,2BAA2B,QAAQ,GAAG,EACnE;gBACE,OAAO,EAAE,QAAQ;gBACjB,YAAY,EAAE,yBAAyB,KAAK,CAAC,IAAI,gCAAgC;gBACjF,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE;aACtE,CACF,CACF,CAAC;YACF,SAAS;QACX,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC/B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { type EventBody, type Result, type Spec, type Diagnostic } from '@paths.design/caws-kernel';
2
+ export interface CreateSpecInput {
3
+ readonly id: string;
4
+ readonly title: string;
5
+ readonly mode: 'feature' | 'refactor' | 'fix' | 'doc' | 'chore';
6
+ readonly riskTier: 1 | 2 | 3;
7
+ /** Initial state. v11.1 defaults to active. */
8
+ readonly initialState?: 'active' | 'draft';
9
+ /** Override the timestamp used for created_at + the event ts. Tests inject. */
10
+ readonly now?: () => Date;
11
+ /** The EventBody actor envelope (built by the shell layer). */
12
+ readonly actor: EventBody['actor'];
13
+ }
14
+ export interface CloseSpecInput {
15
+ readonly id: string;
16
+ readonly resolution: 'completed' | 'superseded' | 'abandoned';
17
+ readonly reason?: string;
18
+ readonly mergeCommit?: string;
19
+ readonly supersededBy?: string;
20
+ readonly now?: () => Date;
21
+ readonly actor: EventBody['actor'];
22
+ }
23
+ export interface ArchiveSpecInput {
24
+ readonly id: string;
25
+ readonly reason?: string;
26
+ readonly now?: () => Date;
27
+ readonly actor: EventBody['actor'];
28
+ }
29
+ export type SpecWriterOutcome = {
30
+ readonly kind: 'success';
31
+ readonly id: string;
32
+ readonly path: string;
33
+ } | {
34
+ readonly kind: 'partial_failure_recovered';
35
+ readonly cause: readonly Diagnostic[];
36
+ };
37
+ export declare function createSpec(cawsDir: string, input: CreateSpecInput): Result<SpecWriterOutcome>;
38
+ export declare function closeSpec(cawsDir: string, input: CloseSpecInput): Result<SpecWriterOutcome>;
39
+ export declare function archiveSpec(cawsDir: string, input: ArchiveSpecInput): Result<SpecWriterOutcome>;
40
+ export interface SpecsListEntry {
41
+ readonly id: string;
42
+ readonly title: string;
43
+ readonly lifecycle_state: string;
44
+ readonly path: string;
45
+ }
46
+ export interface SpecsListResult {
47
+ readonly active: readonly SpecsListEntry[];
48
+ readonly archived: readonly SpecsListEntry[];
49
+ }
50
+ /** List specs by lifecycle state, optionally including archived ones. */
51
+ export declare function listSpecs(cawsDir: string, options?: {
52
+ readonly includeArchived?: boolean;
53
+ }): Result<SpecsListResult>;
54
+ /** Find a spec by id under active or archive locations. */
55
+ export declare function showSpec(cawsDir: string, id: string): Result<{
56
+ readonly spec: Spec;
57
+ readonly path: string;
58
+ readonly source: string;
59
+ }>;
60
+ export type { EventBody };
61
+ //# sourceMappingURL=specs-writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specs-writer.d.ts","sourceRoot":"","sources":["../../src/store/specs-writer.ts"],"names":[],"mappings":"AA2BA,OAAO,EACL,KAAK,SAAS,EAKd,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;AAmBnC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EA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