@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,33 @@
1
+ import { type ChainedEvent, type EventBody, type Result } from '@paths.design/caws-kernel';
2
+ import type { EventsLoadResult } from './types';
3
+ /**
4
+ * Load events from `.caws/events.jsonl`.
5
+ *
6
+ * Outcomes:
7
+ * - missing file → Ok({ events: [], warnings: [] })
8
+ * - empty file → Ok({ events: [], warnings: [] })
9
+ * - valid JSONL → Ok({ events, warnings: [] })
10
+ * - trailing partial line → Ok({ events, warnings: [trailing_partial_line] })
11
+ * - interior malformed line → Err
12
+ * - line parses as JSON but fails validateChainedEvent → Err
13
+ */
14
+ export declare function loadEvents(cawsDir: string): Result<EventsLoadResult>;
15
+ /**
16
+ * Append a new event.
17
+ *
18
+ * Sequence under lock:
19
+ * 1. Acquire .caws/events.jsonl.lock (with stale-recovery + bounded retry).
20
+ * 2. Re-read the full events file to get the most-recent event.
21
+ * 3. Call prepareAppend(lastEvent ?? null, body).
22
+ * 4. Append the chained event as a JSON line + '\n'.
23
+ * 5. Release the lock.
24
+ *
25
+ * Returns the new ChainedEvent on success. On failure, the lock is
26
+ * released and no bytes are written.
27
+ *
28
+ * Callers MUST pass an `EventBody` (caller-side fields only). The store
29
+ * never accepts a pre-chained event — sequence and hash are kernel
30
+ * authority.
31
+ */
32
+ export declare function appendEvent(cawsDir: string, body: EventBody): Result<ChainedEvent>;
33
+ //# sourceMappingURL=events-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-store.d.ts","sourceRoot":"","sources":["../../src/store/events-store.ts"],"names":[],"mappings":"AAsBA,OAAO,EAML,KAAK,YAAY,EAEjB,KAAK,SAAS,EACd,KAAK,MAAM,EACZ,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAUhD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAoBpE;AAoFD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,GACd,MAAM,CAAC,YAAY,CAAC,CAgEtB"}
@@ -0,0 +1,297 @@
1
+ "use strict";
2
+ // Events store — the ONLY write path for .caws/events.jsonl.
3
+ //
4
+ // Semantics carried over verbatim from the legacy implementation, now
5
+ // resting on the evidence kernel:
6
+ //
7
+ // - Append-only JSONL.
8
+ // - Each line is exactly one `ChainedEvent`, canonical-hashed.
9
+ // - Append acquires a lock file via `fs.openSync(lockPath, 'wx')`.
10
+ // - Stale lock recovery: if `wx` fails with EEXIST and the lockfile is
11
+ // older than 30 seconds, the stale file is removed and re-tried.
12
+ // Up to 3 acquisition attempts in total; further contention is Err.
13
+ // - Reading tolerates a trailing partial line (crash-recovery). An
14
+ // interior malformed line is Err.
15
+ // - Callers pass `EventBody`, never `ChainedEvent`. The store re-reads
16
+ // the tail, calls `prepareAppend`, and writes the new line.
17
+ //
18
+ // This module is the only place outside the kernel that creates chained
19
+ // events. All other code paths (CLI commands, hooks, future store
20
+ // callers) must go through here.
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || (function () {
38
+ var ownKeys = function(o) {
39
+ ownKeys = Object.getOwnPropertyNames || function (o) {
40
+ var ar = [];
41
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
42
+ return ar;
43
+ };
44
+ return ownKeys(o);
45
+ };
46
+ return function (mod) {
47
+ if (mod && mod.__esModule) return mod;
48
+ var result = {};
49
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
50
+ __setModuleDefault(result, mod);
51
+ return result;
52
+ };
53
+ })();
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.loadEvents = loadEvents;
56
+ exports.appendEvent = appendEvent;
57
+ const fs = __importStar(require("fs"));
58
+ const path = __importStar(require("path"));
59
+ const caws_kernel_1 = require("@paths.design/caws-kernel");
60
+ const repo_root_1 = require("./repo-root");
61
+ const rules_1 = require("./rules");
62
+ const LOCK_STALE_MS = 30_000;
63
+ const LOCK_MAX_ATTEMPTS = 3;
64
+ const LOCK_RETRY_DELAY_MS = 50;
65
+ // ----------------------------------------------------------------------------
66
+ // loadEvents
67
+ // ----------------------------------------------------------------------------
68
+ /**
69
+ * Load events from `.caws/events.jsonl`.
70
+ *
71
+ * Outcomes:
72
+ * - missing file → Ok({ events: [], warnings: [] })
73
+ * - empty file → Ok({ events: [], warnings: [] })
74
+ * - valid JSONL → Ok({ events, warnings: [] })
75
+ * - trailing partial line → Ok({ events, warnings: [trailing_partial_line] })
76
+ * - interior malformed line → Err
77
+ * - line parses as JSON but fails validateChainedEvent → Err
78
+ */
79
+ function loadEvents(cawsDir) {
80
+ const filePath = path.join(cawsDir, 'events.jsonl');
81
+ let raw;
82
+ try {
83
+ raw = fs.readFileSync(filePath, 'utf8');
84
+ }
85
+ catch (e) {
86
+ const cause = e;
87
+ if (cause.code === 'ENOENT') {
88
+ return (0, caws_kernel_1.ok)({ events: [], warnings: [] });
89
+ }
90
+ return (0, caws_kernel_1.err)((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.READ_IO_FAILED, `Failed to read events.jsonl: ${cause.message ?? 'unknown error'}.`, { subject: filePath, data: { code: cause.code } }));
91
+ }
92
+ return parseJsonlContent(raw, filePath);
93
+ }
94
+ function parseJsonlContent(raw, filePath) {
95
+ if (raw.length === 0)
96
+ return (0, caws_kernel_1.ok)({ events: [], warnings: [] });
97
+ const trailingNewline = raw.endsWith('\n');
98
+ // Split by '\n'. If the file ends with '\n', the final entry is ''.
99
+ const parts = raw.split('\n');
100
+ const lines = trailingNewline ? parts.slice(0, -1) : parts;
101
+ const events = [];
102
+ const warnings = [];
103
+ for (let i = 0; i < lines.length; i++) {
104
+ const line = lines[i];
105
+ const isLast = i === lines.length - 1;
106
+ if (line.length === 0) {
107
+ // Interior empty lines are malformed. A truly empty file was handled above.
108
+ if (!isLast) {
109
+ return (0, caws_kernel_1.err)((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.EVENTS_INTERIOR_MALFORMED_LINE, `events.jsonl line ${i + 1} is empty.`, { subject: filePath, data: { line: i + 1 } }));
110
+ }
111
+ // Trailing empty line without trailing newline shouldn't happen
112
+ // (split semantics) but skip if it does.
113
+ continue;
114
+ }
115
+ let parsed;
116
+ try {
117
+ parsed = JSON.parse(line);
118
+ }
119
+ catch (e) {
120
+ const cause = e;
121
+ // Tolerate a trailing partial line (crash-recovery). Interior
122
+ // malformed JSON is a hard error.
123
+ if (isLast && !trailingNewline) {
124
+ warnings.push((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.EVENTS_TRAILING_PARTIAL_LINE, `events.jsonl ends with a partial line (crash-recovery tolerance).`, {
125
+ subject: filePath,
126
+ data: { line: i + 1, parse_error: cause.message ?? null },
127
+ }));
128
+ continue;
129
+ }
130
+ return (0, caws_kernel_1.err)((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.EVENTS_INTERIOR_MALFORMED_LINE, `events.jsonl line ${i + 1} is not valid JSON: ${cause.message ?? 'unknown error'}.`, { subject: filePath, data: { line: i + 1 } }));
131
+ }
132
+ const validated = (0, caws_kernel_1.validateChainedEvent)(parsed);
133
+ if (!(0, caws_kernel_1.isOk)(validated)) {
134
+ // Wrap the kernel diagnostics with file + line metadata so the
135
+ // shell can render a useful pointer.
136
+ const wrapped = validated.errors.map((d) => ({
137
+ ...d,
138
+ subject: filePath,
139
+ data: { ...(d.data ?? {}), line: i + 1, source_rule: d.rule },
140
+ rule: rules_1.STORE_RULES.EVENTS_INVALID_EVENT_SHAPE,
141
+ }));
142
+ return (0, caws_kernel_1.err)(wrapped);
143
+ }
144
+ events.push(validated.value);
145
+ }
146
+ return (0, caws_kernel_1.ok)({ events, warnings });
147
+ }
148
+ // ----------------------------------------------------------------------------
149
+ // appendEvent
150
+ // ----------------------------------------------------------------------------
151
+ /**
152
+ * Append a new event.
153
+ *
154
+ * Sequence under lock:
155
+ * 1. Acquire .caws/events.jsonl.lock (with stale-recovery + bounded retry).
156
+ * 2. Re-read the full events file to get the most-recent event.
157
+ * 3. Call prepareAppend(lastEvent ?? null, body).
158
+ * 4. Append the chained event as a JSON line + '\n'.
159
+ * 5. Release the lock.
160
+ *
161
+ * Returns the new ChainedEvent on success. On failure, the lock is
162
+ * released and no bytes are written.
163
+ *
164
+ * Callers MUST pass an `EventBody` (caller-side fields only). The store
165
+ * never accepts a pre-chained event — sequence and hash are kernel
166
+ * authority.
167
+ */
168
+ function appendEvent(cawsDir, body) {
169
+ const eventsPath = path.join(cawsDir, 'events.jsonl');
170
+ const lockPath = `${eventsPath}.lock`;
171
+ // Ensure parent dir exists. We don't create .caws/ itself; that's the
172
+ // shell's bootstrap concern. But events.jsonl living somewhere with a
173
+ // missing parent is a programmer error.
174
+ if (!fs.existsSync(cawsDir)) {
175
+ throw new Error(`appendEvent: cawsDir does not exist: ${cawsDir}`);
176
+ }
177
+ const lockFd = acquireLock(lockPath);
178
+ if (!(0, caws_kernel_1.isOk)(lockFd))
179
+ return (0, caws_kernel_1.err)(lockFd.errors);
180
+ try {
181
+ const loaded = loadEvents(cawsDir);
182
+ if (!(0, caws_kernel_1.isOk)(loaded))
183
+ return (0, caws_kernel_1.err)(loaded.errors);
184
+ const prev = loaded.value.events[loaded.value.events.length - 1] ?? null;
185
+ const prepared = (0, caws_kernel_1.prepareAppend)(prev, body);
186
+ if (!(0, caws_kernel_1.isOk)(prepared)) {
187
+ // Wrap kernel diagnostics with the store rule id so callers can
188
+ // discriminate. Original rule is preserved in data.source_rule.
189
+ const wrapped = prepared.errors.map((d) => ({
190
+ ...d,
191
+ rule: rules_1.STORE_RULES.EVENTS_PREPARE_APPEND_REJECTED,
192
+ data: { ...(d.data ?? {}), source_rule: d.rule },
193
+ }));
194
+ return (0, caws_kernel_1.err)(wrapped);
195
+ }
196
+ const event = prepared.value;
197
+ const line = JSON.stringify(event) + '\n';
198
+ // Direct append — atomic-write is the wrong tool here because the
199
+ // file is append-only and we hold the lock.
200
+ let fd;
201
+ try {
202
+ fd = fs.openSync(eventsPath, 'a');
203
+ fs.writeFileSync(fd, line);
204
+ fs.fsyncSync(fd);
205
+ }
206
+ catch (e) {
207
+ const cause = e;
208
+ return (0, caws_kernel_1.err)((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.WRITE_IO_FAILED, `Failed to append to events.jsonl: ${cause.message ?? 'unknown error'}.`, { subject: eventsPath, data: { code: cause.code } }));
209
+ }
210
+ finally {
211
+ if (fd !== undefined) {
212
+ try {
213
+ fs.closeSync(fd);
214
+ }
215
+ catch {
216
+ /* ignore */
217
+ }
218
+ }
219
+ }
220
+ return (0, caws_kernel_1.ok)(event);
221
+ }
222
+ finally {
223
+ releaseLock(lockFd.value, lockPath);
224
+ }
225
+ }
226
+ function acquireLock(lockPath) {
227
+ for (let attempt = 0; attempt < LOCK_MAX_ATTEMPTS; attempt++) {
228
+ try {
229
+ const fd = fs.openSync(lockPath, 'wx');
230
+ // Write the holder pid + timestamp so a future doctor can see who
231
+ // is holding the lock and when they took it.
232
+ try {
233
+ fs.writeFileSync(fd, JSON.stringify({ pid: process.pid, at: new Date().toISOString() }));
234
+ fs.fsyncSync(fd);
235
+ }
236
+ catch {
237
+ /* writing the lock body is best-effort; the lock itself is the file's existence */
238
+ }
239
+ return (0, caws_kernel_1.ok)({ fd });
240
+ }
241
+ catch (e) {
242
+ const cause = e;
243
+ if (cause.code !== 'EEXIST') {
244
+ return (0, caws_kernel_1.err)((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.EVENTS_LOCK_CONTENTION, `Unexpected error acquiring events lock: ${cause.message ?? 'unknown error'}.`, { subject: lockPath, data: { code: cause.code } }));
245
+ }
246
+ // Stale-lock recovery.
247
+ const recovered = tryRecoverStaleLock(lockPath);
248
+ if (!recovered) {
249
+ // Lock is held by a fresh holder. Brief sleep, then retry.
250
+ sleepSyncMs(LOCK_RETRY_DELAY_MS);
251
+ }
252
+ // Either way, loop and try again.
253
+ }
254
+ }
255
+ return (0, caws_kernel_1.err)((0, repo_root_1.storeDiagnostic)(rules_1.STORE_RULES.EVENTS_LOCK_CONTENTION, `Could not acquire events lock after ${LOCK_MAX_ATTEMPTS} attempts.`, { subject: lockPath }));
256
+ }
257
+ function releaseLock(handle, lockPath) {
258
+ try {
259
+ fs.closeSync(handle.fd);
260
+ }
261
+ catch {
262
+ /* ignore */
263
+ }
264
+ try {
265
+ fs.unlinkSync(lockPath);
266
+ }
267
+ catch {
268
+ /* ignore — best-effort */
269
+ }
270
+ }
271
+ function tryRecoverStaleLock(lockPath) {
272
+ try {
273
+ const stat = fs.statSync(lockPath);
274
+ const ageMs = Date.now() - stat.mtimeMs;
275
+ if (ageMs > LOCK_STALE_MS) {
276
+ fs.unlinkSync(lockPath);
277
+ return true;
278
+ }
279
+ }
280
+ catch {
281
+ // The file might have disappeared between attempts; treat that as
282
+ // recovery and retry.
283
+ return true;
284
+ }
285
+ return false;
286
+ }
287
+ function sleepSyncMs(ms) {
288
+ // Synchronous sleep without dragging in dependencies. Used only inside
289
+ // the lock-acquisition retry loop.
290
+ const end = Date.now() + ms;
291
+ // Atomics.wait is the clean tool here but requires a SharedArrayBuffer
292
+ // setup. Polling Date.now() is fine for the tens-of-ms scale we use.
293
+ while (Date.now() < end) {
294
+ // empty body — spinning briefly under contention is acceptable.
295
+ }
296
+ }
297
+ //# sourceMappingURL=events-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-store.js","sourceRoot":"","sources":["../../src/store/events-store.ts"],"names":[],"mappings":";AAAA,6DAA6D;AAC7D,EAAE;AACF,sEAAsE;AACtE,kCAAkC;AAClC,EAAE;AACF,yBAAyB;AACzB,iEAAiE;AACjE,qEAAqE;AACrE,yEAAyE;AACzE,qEAAqE;AACrE,wEAAwE;AACxE,qEAAqE;AACrE,sCAAsC;AACtC,yEAAyE;AACzE,gEAAgE;AAChE,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCjC,gCAoBC;AAqGD,kCAmEC;AAhOD,uCAAyB;AACzB,2CAA6B;AAC7B,2DAUmC;AACnC,2CAA8C;AAC9C,mCAAsC;AAGtC,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,mBAAmB,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AY,EACpE,EAAE,OAAO,EAAE,QAAQ,EAAE,CACtB,CACF,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,MAAkB,EAAE,QAAgB;IACvD,IAAI,CAAC;QACH,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,YAAY;IACd,CAAC;IACD,IAAI,CAAC;QACH,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,0BAA0B;IAC5B,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACxC,IAAI,KAAK,GAAG,aAAa,EAAE,CAAC;YAC1B,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,kEAAkE;QAClE,sBAAsB;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,EAAU;IAC7B,uEAAuE;IACvE,mCAAmC;IACnC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;IAC5B,uEAAuE;IACvE,qEAAqE;IACrE,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;QACxB,gEAAgE;IAClE,CAAC;AACH,CAAC"}
@@ -0,0 +1,21 @@
1
+ export { STORE_RULES, STORE_RULE_PREFIXES } from './rules';
2
+ export type { StoreRule } from './rules';
3
+ export type { EventsLoadResult, PolicyLoadResult, SpecsLoadResult, StoreSnapshot, } from './types';
4
+ export { defaultGitRunner, resolveRepoRoot, storeDiagnostic, } from './repo-root';
5
+ export type { GitRunner, RepoRoot, ResolveRepoRootOptions } from './repo-root';
6
+ export { fsyncDir, writeFileAtomic } from './atomic-write';
7
+ export { readJsonFile } from './json-store';
8
+ export { readYamlFile, readYamlSource } from './yaml-store';
9
+ export { loadSpecs } from './specs-store';
10
+ export { loadPolicy } from './policy-store';
11
+ export { loadWorktrees } from './worktrees-store';
12
+ export { loadAgents } from './agents-store';
13
+ export { appendEvent, loadEvents } from './events-store';
14
+ export { applyRegistryPatch } from './apply-patch';
15
+ export { loadWaivers, writeWaiver, markRevoked } from './waivers-store';
16
+ export type { WaiversLoadResult } from './waivers-store';
17
+ export { initProject, DEFAULT_POLICY_YAML } from './init-store';
18
+ export type { InitOutcome, InitProjectResult } from './init-store';
19
+ export { composeDoctorSnapshot, composeStoreSnapshot, } from './doctor-snapshot';
20
+ export type { ComposeDoctorOptions, ComposeDoctorResult, ComposeOptions, } from './doctor-snapshot';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ // Node-only store layer — programmatic exports.
3
+ //
4
+ // This module is the bridge between the filesystem and the pure kernel.
5
+ // It is consumed programmatically; no public CLI commands are registered
6
+ // here. CLI command surface lands in Slice 5c.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.composeStoreSnapshot = exports.composeDoctorSnapshot = exports.DEFAULT_POLICY_YAML = exports.initProject = exports.markRevoked = exports.writeWaiver = exports.loadWaivers = exports.applyRegistryPatch = exports.loadEvents = exports.appendEvent = exports.loadAgents = exports.loadWorktrees = exports.loadPolicy = exports.loadSpecs = exports.readYamlSource = exports.readYamlFile = exports.readJsonFile = exports.writeFileAtomic = exports.fsyncDir = exports.storeDiagnostic = exports.resolveRepoRoot = exports.defaultGitRunner = exports.STORE_RULE_PREFIXES = exports.STORE_RULES = void 0;
9
+ var rules_1 = require("./rules");
10
+ Object.defineProperty(exports, "STORE_RULES", { enumerable: true, get: function () { return rules_1.STORE_RULES; } });
11
+ Object.defineProperty(exports, "STORE_RULE_PREFIXES", { enumerable: true, get: function () { return rules_1.STORE_RULE_PREFIXES; } });
12
+ var repo_root_1 = require("./repo-root");
13
+ Object.defineProperty(exports, "defaultGitRunner", { enumerable: true, get: function () { return repo_root_1.defaultGitRunner; } });
14
+ Object.defineProperty(exports, "resolveRepoRoot", { enumerable: true, get: function () { return repo_root_1.resolveRepoRoot; } });
15
+ Object.defineProperty(exports, "storeDiagnostic", { enumerable: true, get: function () { return repo_root_1.storeDiagnostic; } });
16
+ var atomic_write_1 = require("./atomic-write");
17
+ Object.defineProperty(exports, "fsyncDir", { enumerable: true, get: function () { return atomic_write_1.fsyncDir; } });
18
+ Object.defineProperty(exports, "writeFileAtomic", { enumerable: true, get: function () { return atomic_write_1.writeFileAtomic; } });
19
+ var json_store_1 = require("./json-store");
20
+ Object.defineProperty(exports, "readJsonFile", { enumerable: true, get: function () { return json_store_1.readJsonFile; } });
21
+ var yaml_store_1 = require("./yaml-store");
22
+ Object.defineProperty(exports, "readYamlFile", { enumerable: true, get: function () { return yaml_store_1.readYamlFile; } });
23
+ Object.defineProperty(exports, "readYamlSource", { enumerable: true, get: function () { return yaml_store_1.readYamlSource; } });
24
+ var specs_store_1 = require("./specs-store");
25
+ Object.defineProperty(exports, "loadSpecs", { enumerable: true, get: function () { return specs_store_1.loadSpecs; } });
26
+ var policy_store_1 = require("./policy-store");
27
+ Object.defineProperty(exports, "loadPolicy", { enumerable: true, get: function () { return policy_store_1.loadPolicy; } });
28
+ var worktrees_store_1 = require("./worktrees-store");
29
+ Object.defineProperty(exports, "loadWorktrees", { enumerable: true, get: function () { return worktrees_store_1.loadWorktrees; } });
30
+ var agents_store_1 = require("./agents-store");
31
+ Object.defineProperty(exports, "loadAgents", { enumerable: true, get: function () { return agents_store_1.loadAgents; } });
32
+ var events_store_1 = require("./events-store");
33
+ Object.defineProperty(exports, "appendEvent", { enumerable: true, get: function () { return events_store_1.appendEvent; } });
34
+ Object.defineProperty(exports, "loadEvents", { enumerable: true, get: function () { return events_store_1.loadEvents; } });
35
+ var apply_patch_1 = require("./apply-patch");
36
+ Object.defineProperty(exports, "applyRegistryPatch", { enumerable: true, get: function () { return apply_patch_1.applyRegistryPatch; } });
37
+ var waivers_store_1 = require("./waivers-store");
38
+ Object.defineProperty(exports, "loadWaivers", { enumerable: true, get: function () { return waivers_store_1.loadWaivers; } });
39
+ Object.defineProperty(exports, "writeWaiver", { enumerable: true, get: function () { return waivers_store_1.writeWaiver; } });
40
+ Object.defineProperty(exports, "markRevoked", { enumerable: true, get: function () { return waivers_store_1.markRevoked; } });
41
+ var init_store_1 = require("./init-store");
42
+ Object.defineProperty(exports, "initProject", { enumerable: true, get: function () { return init_store_1.initProject; } });
43
+ Object.defineProperty(exports, "DEFAULT_POLICY_YAML", { enumerable: true, get: function () { return init_store_1.DEFAULT_POLICY_YAML; } });
44
+ var doctor_snapshot_1 = require("./doctor-snapshot");
45
+ Object.defineProperty(exports, "composeDoctorSnapshot", { enumerable: true, get: function () { return doctor_snapshot_1.composeDoctorSnapshot; } });
46
+ Object.defineProperty(exports, "composeStoreSnapshot", { enumerable: true, get: function () { return doctor_snapshot_1.composeStoreSnapshot; } });
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":";AAAA,gDAAgD;AAChD,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,+CAA+C;;;AAE/C,iCAA2D;AAAlD,oGAAA,WAAW,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AAUzC,yCAIqB;AAHnB,6GAAA,gBAAgB,OAAA;AAChB,4GAAA,eAAe,OAAA;AACf,4GAAA,eAAe,OAAA;AAIjB,+CAA2D;AAAlD,wGAAA,QAAQ,OAAA;AAAE,+GAAA,eAAe,OAAA;AAClC,2CAA4C;AAAnC,0GAAA,YAAY,OAAA;AACrB,2CAA4D;AAAnD,0GAAA,YAAY,OAAA;AAAE,4GAAA,cAAc,OAAA;AAErC,6CAA0C;AAAjC,wGAAA,SAAS,OAAA;AAClB,+CAA4C;AAAnC,0GAAA,UAAU,OAAA;AACnB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,+CAA4C;AAAnC,0GAAA,UAAU,OAAA;AACnB,+CAAyD;AAAhD,2GAAA,WAAW,OAAA;AAAE,0GAAA,UAAU,OAAA;AAEhC,6CAAmD;AAA1C,iHAAA,kBAAkB,OAAA;AAE3B,iDAAwE;AAA/D,4GAAA,WAAW,OAAA;AAAE,4GAAA,WAAW,OAAA;AAAE,4GAAA,WAAW,OAAA;AAG9C,2CAAgE;AAAvD,yGAAA,WAAW,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAGzC,qDAG2B;AAFzB,wHAAA,qBAAqB,OAAA;AACrB,uHAAA,oBAAoB,OAAA"}
@@ -0,0 +1,21 @@
1
+ import { type Policy, type Result } from '@paths.design/caws-kernel';
2
+ export declare const DEFAULT_POLICY_YAML = "version: 1\nrisk_tiers:\n '1':\n max_files: 5\n max_loc: 200\n '2':\n max_files: 15\n max_loc: 600\n '3':\n max_files: 30\n max_loc: 1500\ngates:\n budget_limit:\n enabled: true\n mode: block\n spec_completeness:\n enabled: true\n mode: block\n scope_boundary:\n enabled: true\n mode: block\n god_object:\n enabled: true\n mode: warn\n todo_detection:\n enabled: true\n mode: warn\nedit_rules:\n policy_and_code_same_pr: true\n require_signed_commits: false\n require_dual_control_for_governance: false\n";
3
+ export type InitOutcome = 'created' | 'already_initialized';
4
+ export interface InitProjectResult {
5
+ readonly outcome: InitOutcome;
6
+ /** Absolute paths of files/dirs newly created. Empty when already initialized. */
7
+ readonly created: readonly string[];
8
+ /** Validated policy (whether freshly seeded or already on disk). */
9
+ readonly policy: Policy;
10
+ }
11
+ /**
12
+ * Idempotent vNext init. Returns:
13
+ *
14
+ * Ok({ outcome: 'created', created: [...], policy })
15
+ * Ok({ outcome: 'already_initialized', created: [], policy })
16
+ * Err on legacy residue (INIT_LEGACY_RESIDUE) or write failure
17
+ * (WRITE_IO_FAILED) or a default-policy that fails kernel
18
+ * validation (INIT_DEFAULT_POLICY_INVALID).
19
+ */
20
+ export declare function initProject(repoRoot: string): Result<InitProjectResult>;
21
+ //# sourceMappingURL=init-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-store.d.ts","sourceRoot":"","sources":["../../src/store/init-store.ts"],"names":[],"mappings":"AAiDA,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,MAAM,EACZ,MAAM,2BAA2B,CAAC;AA0CnC,eAAO,MAAM,mBAAmB,wjBA+B/B,CAAC;AAMF,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,qBAAqB,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AA4ED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,iBAAiB,CAAC,CA+F3B"}