@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
@@ -1,230 +0,0 @@
1
- /**
2
- * @fileoverview Project Finalization Utilities
3
- * Functions for finalizing CAWS project setup
4
- * @author @darianrosebrook
5
- */
6
-
7
- const fs = require('fs-extra');
8
- const path = require('path');
9
- const chalk = require('chalk');
10
-
11
- // CLI version from package.json
12
- const CLI_VERSION = require('../../package.json').version;
13
-
14
- // Import scaffold utilities
15
- const { scaffoldCursorHooks } = require('../scaffold/cursor-hooks');
16
-
17
- // Dependencies injected via setFinalizationDependencies()
18
- let languageSupport = null;
19
- let loadProvenanceTools = null;
20
-
21
- /**
22
- * Set dependencies for finalization utilities
23
- * @param {Object} deps - Dependencies object
24
- */
25
- function setFinalizationDependencies(deps) {
26
- languageSupport = deps.languageSupport;
27
- loadProvenanceTools = deps.loadProvenanceTools;
28
- }
29
-
30
- /**
31
- * Generate provenance manifest and git initialization (for both modes)
32
- * @param {string} projectName - Project name
33
- * @param {Object} options - Command options
34
- * @param {Object} answers - User answers
35
- */
36
- async function finalizeProject(projectName, options, answers) {
37
- try {
38
- // Detect and configure language support
39
- if (languageSupport) {
40
- console.log(chalk.cyan('Detecting project language...'));
41
- const detectedLanguage = languageSupport.detectProjectLanguage();
42
-
43
- if (detectedLanguage !== 'unknown') {
44
- console.log(chalk.green(`Detected language: ${detectedLanguage}`));
45
-
46
- // Generate language-specific configuration
47
- try {
48
- const langConfig = languageSupport.generateLanguageConfig(
49
- detectedLanguage,
50
- '.caws/language-config.json'
51
- );
52
-
53
- console.log(chalk.green('Generated language-specific configuration'));
54
- console.log(` Language: ${langConfig.name}`);
55
- console.log(` Tier: ${langConfig.tier}`);
56
- console.log(
57
- ` Thresholds: Branch ≥${langConfig.thresholds.min_branch * 100}%, Mutation ≥${langConfig.thresholds.min_mutation * 100}%`
58
- );
59
- } catch (langError) {
60
- console.warn(chalk.yellow('Could not generate language config:'), langError.message);
61
- }
62
- } else {
63
- console.log(
64
- chalk.blue('Could not detect project language - using default configuration')
65
- );
66
- }
67
- }
68
-
69
- // Setup Cursor hooks if enabled
70
- if (answers && answers.enableCursorHooks) {
71
- console.log(chalk.cyan('Setting up Cursor hooks...'));
72
- await scaffoldCursorHooks(
73
- process.cwd(),
74
- answers.cursorHookLevels || ['safety', 'quality', 'scope', 'audit']
75
- );
76
- }
77
-
78
- // Generate provenance manifest
79
- console.log(chalk.cyan('Generating provenance manifest...'));
80
-
81
- const provenanceData = {
82
- agent: 'caws-cli',
83
- model: 'cli-interactive',
84
- modelHash: CLI_VERSION,
85
- toolAllowlist: [
86
- 'node',
87
- 'npm',
88
- 'git',
89
- 'fs-extra',
90
- 'inquirer',
91
- 'commander',
92
- 'js-yaml',
93
- 'ajv',
94
- 'chalk',
95
- ],
96
- prompts: Object.keys(answers),
97
- commit: null, // Will be set after git init
98
- artifacts: ['.caws/specs/', '.caws/working-spec.yaml'],
99
- results: {
100
- project_id: answers.projectId,
101
- project_title: answers.projectTitle,
102
- risk_tier: answers.riskTier,
103
- mode: answers.projectMode,
104
- change_budget: {
105
- max_files: answers.maxFiles,
106
- max_loc: answers.maxLoc,
107
- },
108
- },
109
- approvals: [],
110
- };
111
-
112
- // Generate provenance if tools are available
113
- const tools = loadProvenanceTools && loadProvenanceTools();
114
- if (
115
- tools &&
116
- typeof tools.generateProvenance === 'function' &&
117
- typeof tools.saveProvenance === 'function'
118
- ) {
119
- const provenance = tools.generateProvenance(provenanceData);
120
- await tools.saveProvenance(provenance, '.agent/provenance.json');
121
- console.log(chalk.green('Provenance manifest generated'));
122
- } else {
123
- console.log(
124
- chalk.yellow('Provenance tools not available - skipping manifest generation')
125
- );
126
- }
127
-
128
- // Initialize git repository
129
- if (options.git) {
130
- try {
131
- console.log(chalk.cyan('Initializing git repository...'));
132
-
133
- // Check if git is available
134
- try {
135
- require('child_process').execSync('git --version', { stdio: 'ignore' });
136
- } catch (error) {
137
- console.warn(chalk.yellow('Git not found. Skipping git initialization.'));
138
- console.warn(chalk.blue('Install git to enable automatic repository setup.'));
139
- return;
140
- }
141
-
142
- // Configure git author information
143
- const gitConfig = answers.git_config || {};
144
- const authorName = process.env.GIT_AUTHOR_NAME || gitConfig.author_name;
145
- const authorEmail = process.env.GIT_AUTHOR_EMAIL || gitConfig.author_email;
146
-
147
- if (authorName && authorEmail) {
148
- require('child_process').execSync(`git config user.name "${authorName}"`, {
149
- stdio: 'inherit',
150
- });
151
- require('child_process').execSync(`git config user.email "${authorEmail}"`, {
152
- stdio: 'inherit',
153
- });
154
- console.log(chalk.green(`Git configured: ${authorName} <${authorEmail}>`));
155
- }
156
-
157
- require('child_process').execSync('git init', { stdio: 'inherit' });
158
- require('child_process').execSync('git add .', { stdio: 'inherit' });
159
- require('child_process').execSync('git commit -m "Initial CAWS project setup"', {
160
- stdio: 'inherit',
161
- });
162
- console.log(chalk.green('Git repository initialized'));
163
-
164
- // Update provenance with commit hash
165
- const commitHash = require('child_process')
166
- .execSync('git rev-parse HEAD', { encoding: 'utf8' })
167
- .trim();
168
- const currentProvenance = JSON.parse(fs.readFileSync('.agent/provenance.json', 'utf8'));
169
- currentProvenance.commit = commitHash;
170
- currentProvenance.hash = require('crypto')
171
- .createHash('sha256')
172
- .update(JSON.stringify(currentProvenance, Object.keys(currentProvenance).sort()))
173
- .digest('hex');
174
- await fs.writeFile('.agent/provenance.json', JSON.stringify(currentProvenance, null, 2));
175
-
176
- console.log(chalk.green('Provenance updated with commit hash'));
177
- } catch (error) {
178
- console.warn(
179
- chalk.yellow('Failed to initialize git repository:'),
180
- error?.message || String(error)
181
- );
182
- console.warn(chalk.blue('You can initialize git manually later with:'));
183
- console.warn(" git init && git add . && git commit -m 'Initial CAWS project setup'");
184
- }
185
- }
186
- } catch (error) {
187
- console.error(
188
- chalk.red('Error during project finalization:'),
189
- error?.message || String(error)
190
- );
191
- }
192
- }
193
-
194
- /**
195
- * Display success message after project initialization
196
- */
197
- function continueToSuccess() {
198
- const isCurrentDir =
199
- process.cwd() ===
200
- path.resolve(process.argv[3] === '.' ? process.cwd() : process.argv[3] || 'caws-project');
201
-
202
- console.log(chalk.green('\nCAWS project initialized successfully!'));
203
-
204
- if (isCurrentDir) {
205
- console.log(
206
- `${chalk.cyan('Initialized in current directory')}: ${path.resolve(process.cwd())}`
207
- );
208
- console.log(chalk.gray(' (CAWS files added to your existing project)'));
209
- } else {
210
- console.log(`${chalk.cyan('Project location')}: ${path.resolve(process.cwd())}`);
211
- console.log(chalk.gray(' (New subdirectory created with CAWS structure)'));
212
- }
213
-
214
- console.log(chalk.bold('\nNext steps:'));
215
- console.log('1. Customize .caws/specs/<spec-id>.yaml');
216
- console.log('2. Treat .caws/working-spec.yaml as a compatibility mirror');
217
- console.log('3. Review added CAWS tools and documentation');
218
- if (!isCurrentDir) {
219
- console.log('4. Move CAWS files to your main project if needed');
220
- }
221
- console.log('5. npm install (if using Node.js)');
222
- console.log('6. Set up your CI/CD pipeline');
223
- console.log(chalk.blue('\nFor help: caws --help'));
224
- }
225
-
226
- module.exports = {
227
- finalizeProject,
228
- continueToSuccess,
229
- setFinalizationDependencies,
230
- };
@@ -1,119 +0,0 @@
1
- /**
2
- * @fileoverview Git Lock Detection Utilities
3
- * Functions for detecting and handling git locks
4
- * @author @darianrosebrook
5
- */
6
-
7
- const fs = require('fs-extra');
8
- const path = require('path');
9
-
10
- /**
11
- * Check for git lock files
12
- * @param {string} projectRoot - Project root directory
13
- * @returns {Object} Lock status information
14
- */
15
- function checkGitLock(projectRoot) {
16
- const lockFile = path.join(projectRoot, '.git', 'index.lock');
17
- const headLockFile = path.join(projectRoot, '.git', 'HEAD.lock');
18
-
19
- const result = {
20
- locked: false,
21
- stale: false,
22
- lockFiles: [],
23
- message: null,
24
- suggestion: null,
25
- };
26
-
27
- // Check index.lock
28
- if (fs.existsSync(lockFile)) {
29
- const lockAge = Date.now() - fs.statSync(lockFile).mtimeMs;
30
- const lockAgeMinutes = Math.floor(lockAge / 60000);
31
-
32
- result.locked = true;
33
- result.lockFiles.push({
34
- path: '.git/index.lock',
35
- age: lockAgeMinutes,
36
- stale: lockAgeMinutes > 5,
37
- });
38
-
39
- if (lockAgeMinutes > 5) {
40
- // Stale lock (older than 5 minutes)
41
- result.stale = true;
42
- result.message = `Stale git lock detected (${lockAgeMinutes} minutes old). This may indicate a crashed git process.`;
43
- result.suggestion = 'Remove stale lock: rm .git/index.lock';
44
- } else {
45
- // Active lock
46
- result.message =
47
- 'Git lock detected. Another git process may be running.';
48
- result.suggestion =
49
- 'Wait for the other process to complete, or check for running git/editor processes';
50
- }
51
- }
52
-
53
- // Check HEAD.lock
54
- if (fs.existsSync(headLockFile)) {
55
- const lockAge = Date.now() - fs.statSync(headLockFile).mtimeMs;
56
- const lockAgeMinutes = Math.floor(lockAge / 60000);
57
-
58
- result.locked = true;
59
- result.lockFiles.push({
60
- path: '.git/HEAD.lock',
61
- age: lockAgeMinutes,
62
- stale: lockAgeMinutes > 5,
63
- });
64
-
65
- if (lockAgeMinutes > 5) {
66
- result.stale = true;
67
- if (!result.message) {
68
- result.message = `Stale git lock detected (${lockAgeMinutes} minutes old).`;
69
- result.suggestion = 'Remove stale lock: rm .git/HEAD.lock';
70
- }
71
- }
72
- }
73
-
74
- return result;
75
- }
76
-
77
- /**
78
- * Format git lock error message
79
- * @param {Object} lockStatus - Lock status from checkGitLock
80
- * @returns {string} Formatted error message
81
- */
82
- function formatGitLockError(lockStatus) {
83
- if (!lockStatus.locked) {
84
- return null;
85
- }
86
-
87
- let message = 'Git lock detected\n';
88
- message += ` ${lockStatus.message}\n`;
89
-
90
- if (lockStatus.lockFiles.length > 0) {
91
- message += '\n Lock files:\n';
92
- for (const lockFile of lockStatus.lockFiles) {
93
- message += ` - ${lockFile.path} (${lockFile.age} minutes old)`;
94
- if (lockFile.stale) {
95
- message += ' [STALE]';
96
- }
97
- message += '\n';
98
- }
99
- }
100
-
101
- if (lockStatus.suggestion) {
102
- message += `\n ${lockStatus.suggestion}\n`;
103
- }
104
-
105
- if (lockStatus.stale) {
106
- message +=
107
- '\n Warning: Removing stale locks may cause data loss if another process is actually running.\n';
108
- message += ' Check for running git/editor processes before removing locks.\n';
109
- }
110
-
111
- return message;
112
- }
113
-
114
- module.exports = {
115
- checkGitLock,
116
- formatGitLockError,
117
- };
118
-
119
-
@@ -1,158 +0,0 @@
1
- /**
2
- * @fileoverview Gitignore Updater Utility
3
- * Updates .gitignore to properly handle CAWS runtime files vs source files
4
- * @author @darianrosebrook
5
- */
6
-
7
- const fs = require('fs-extra');
8
- const path = require('path');
9
- const chalk = require('chalk');
10
-
11
- /**
12
- * CAWS .gitignore entries
13
- *
14
- * Strategy: Track shared/collaborative files, ignore local-only runtime data
15
- *
16
- * TRACKED (shared with team):
17
- * - .caws/working-spec.yaml (main spec)
18
- * - .caws/specs/*.yaml (feature specs)
19
- * - .caws/policy.yaml (team policy)
20
- * - .caws/waivers/*.yaml (project-wide waivers)
21
- * - .caws/provenance/ (audit trails for compliance)
22
- * - .caws/changes/ (change tracking for team visibility)
23
- * - .caws/archive/ (archived changes for history)
24
- * - .caws/plans/*.md (implementation plans)
25
- *
26
- * IGNORED (local-only):
27
- * - .agent/ (agent runtime tracking, local to each developer)
28
- * - Temporary files (*.tmp, *.bak)
29
- * - Logs (caws.log, debug logs)
30
- * - Local overrides (caws.local.*)
31
- */
32
- const CAWS_GITIGNORE_ENTRIES = `
33
- # CAWS Local Runtime Data (developer-specific, should not be tracked)
34
- # ====================================================================
35
- # Note: Specs, policy, waivers, provenance, and plans ARE tracked for team collaboration
36
- # Only local agent tracking, generated tools, and temporary files are ignored
37
-
38
- # Agent runtime tracking (local to each developer)
39
- .agent/
40
-
41
- # CAWS tools (now in .caws/tools/)
42
- .caws/tools/
43
- # Legacy location (for backward compatibility)
44
- apps/tools/caws/
45
-
46
- # Temporary CAWS files
47
- **/*.caws.tmp
48
- **/*.working-spec.bak
49
- .caws/*.tmp
50
- .caws/*.bak
51
-
52
- # CAWS logs (local debugging)
53
- caws-debug.log*
54
- **/caws.log
55
- .caws/*.log
56
-
57
- # Local development overrides (developer-specific)
58
- caws.local.*
59
- .caws/local.*
60
-
61
- # CAWS working state (runtime, not committed)
62
- .caws/state/
63
-
64
- # CAWS Worktrees (local, should not be tracked)
65
- .caws/worktrees/
66
- .caws/worktrees.json
67
-
68
- # Session transcripts (generated by session-log hook)
69
- tmp/
70
- `;
71
-
72
- /**
73
- * Update .gitignore to include CAWS runtime file exclusions
74
- * @param {string} projectRoot - Project root directory
75
- * @param {Object} options - Options
76
- * @param {boolean} options.force - Force update even if entries exist
77
- * @returns {Promise<boolean>} Whether .gitignore was updated
78
- */
79
- async function updateGitignore(projectRoot, options = {}) {
80
- const { force = false } = options;
81
- const gitignorePath = path.join(projectRoot, '.gitignore');
82
-
83
- try {
84
- // Read existing .gitignore or create empty
85
- let existingContent = '';
86
- if (await fs.pathExists(gitignorePath)) {
87
- existingContent = await fs.readFile(gitignorePath, 'utf8');
88
- }
89
-
90
- // Check if CAWS entries already exist (check for either old or new header)
91
- const hasCawsEntries =
92
- existingContent.includes('# CAWS Local Runtime Data') ||
93
- existingContent.includes('# CAWS Runtime Data');
94
-
95
- if (hasCawsEntries && !force) {
96
- // Already has CAWS entries, skip
97
- return false;
98
- }
99
-
100
- // If old entries exist, replace them with new ones
101
- if (existingContent.includes('# CAWS Runtime Data') && force) {
102
- // Remove old CAWS entries (between "# CAWS Runtime Data" and next major section)
103
- const lines = existingContent.split('\n');
104
- const startIndex = lines.findIndex((line) => line.includes('# CAWS Runtime Data'));
105
- if (startIndex !== -1) {
106
- // Find the end of CAWS section (next major section starting with #)
107
- let endIndex = startIndex + 1;
108
- while (
109
- endIndex < lines.length &&
110
- (lines[endIndex].trim() === '' ||
111
- lines[endIndex].startsWith('#') ||
112
- lines[endIndex].startsWith('.caws/') ||
113
- lines[endIndex].startsWith('.agent/') ||
114
- lines[endIndex].includes('caws') ||
115
- lines[endIndex].includes('CAWS'))
116
- ) {
117
- endIndex++;
118
- }
119
- // Remove old section and insert new one
120
- const before = lines.slice(0, startIndex).join('\n');
121
- const after = lines.slice(endIndex).join('\n');
122
- existingContent = [before, after].filter(Boolean).join('\n');
123
- }
124
- }
125
-
126
- // Append CAWS entries
127
- const updatedContent = existingContent.trim() + '\n' + CAWS_GITIGNORE_ENTRIES.trim() + '\n';
128
-
129
- await fs.writeFile(gitignorePath, updatedContent, 'utf8');
130
-
131
- return true;
132
- } catch (error) {
133
- console.warn(chalk.yellow(`Could not update .gitignore: ${error.message}`));
134
- return false;
135
- }
136
- }
137
-
138
- /**
139
- * Verify .gitignore has proper CAWS entries
140
- * @param {string} projectRoot - Project root directory
141
- * @returns {Promise<boolean>} Whether .gitignore has CAWS entries
142
- */
143
- async function verifyGitignore(projectRoot) {
144
- const gitignorePath = path.join(projectRoot, '.gitignore');
145
-
146
- if (!(await fs.pathExists(gitignorePath))) {
147
- return false;
148
- }
149
-
150
- const content = await fs.readFile(gitignorePath, 'utf8');
151
- return content.includes('# CAWS Local Runtime Data') || content.includes('# CAWS Runtime Data');
152
- }
153
-
154
- module.exports = {
155
- updateGitignore,
156
- verifyGitignore,
157
- CAWS_GITIGNORE_ENTRIES,
158
- };
@@ -1,133 +0,0 @@
1
- /**
2
- * @fileoverview IDE Detection and Selection Utilities
3
- * Detects active IDEs from environment variables and provides
4
- * selection/parsing helpers for the --ide CLI flag.
5
- * @author @darianrosebrook
6
- */
7
-
8
- const chalk = require('chalk');
9
-
10
- /**
11
- * Registry of supported IDE integrations.
12
- * Each entry maps an ID to its display name, description, and detection env vars.
13
- */
14
- const IDE_REGISTRY = {
15
- cursor: {
16
- id: 'cursor',
17
- name: 'Cursor',
18
- description: 'AI-first IDE with hooks, rules, and audit logs',
19
- envVars: ['CURSOR_TRACE_DIR'],
20
- },
21
- claude: {
22
- id: 'claude',
23
- name: 'Claude Code',
24
- description: 'Claude Code with safety hooks and settings',
25
- envVars: ['CLAUDE_PROJECT_DIR'],
26
- },
27
- vscode: {
28
- id: 'vscode',
29
- name: 'VS Code',
30
- description: 'Visual Studio Code settings and debug configs',
31
- envVars: ['VSCODE_PID', 'VSCODE_IPC_HOOK'],
32
- },
33
- intellij: {
34
- id: 'intellij',
35
- name: 'IntelliJ IDEA',
36
- description: 'IntelliJ run configurations for CAWS',
37
- envVars: ['IDEA_INITIAL_DIRECTORY'],
38
- },
39
- windsurf: {
40
- id: 'windsurf',
41
- name: 'Windsurf',
42
- description: 'Windsurf workflow for CAWS-guided development',
43
- envVars: ['WINDSURF_WORKSPACE'],
44
- },
45
- copilot: {
46
- id: 'copilot',
47
- name: 'GitHub Copilot',
48
- description: 'GitHub Copilot CAWS integration instructions',
49
- envVars: [], // No reliable env var; paired with vscode
50
- },
51
- junie: {
52
- id: 'junie',
53
- name: 'JetBrains Junie',
54
- description: 'Junie AI agent guidelines for JetBrains IDEs',
55
- envVars: [], // Paired with intellij
56
- },
57
- };
58
-
59
- const ALL_IDE_IDS = Object.keys(IDE_REGISTRY);
60
-
61
- /**
62
- * Detect currently active IDEs from environment variables.
63
- * @returns {string[]} Array of detected IDE identifiers
64
- */
65
- function detectActiveIDEs() {
66
- const detected = [];
67
- for (const [id, config] of Object.entries(IDE_REGISTRY)) {
68
- if (config.envVars.length > 0 && config.envVars.some((v) => process.env[v])) {
69
- detected.push(id);
70
- }
71
- }
72
- return detected;
73
- }
74
-
75
- /**
76
- * Get recommended IDE set based on detection and natural pairings.
77
- * - Cursor detected -> also recommend Claude Code
78
- * - VS Code detected -> also recommend Copilot
79
- * - Nothing detected -> default to cursor + claude (AI-first set)
80
- * @returns {string[]} Array of recommended IDE identifiers
81
- */
82
- function getRecommendedIDEs() {
83
- const detected = detectActiveIDEs();
84
-
85
- if (detected.length > 0) {
86
- const recommended = new Set(detected);
87
- if (detected.includes('cursor')) recommended.add('claude');
88
- if (detected.includes('vscode')) recommended.add('copilot');
89
- if (detected.includes('intellij')) recommended.add('junie');
90
- return Array.from(recommended);
91
- }
92
-
93
- return ['cursor', 'claude'];
94
- }
95
-
96
- /**
97
- * Parse an IDE selection from a CLI flag value or prompt answer.
98
- * @param {string|string[]} input - Comma-separated string or array of IDE ids
99
- * @returns {string[]} Normalized, validated array of IDE identifiers
100
- */
101
- function parseIDESelection(input) {
102
- if (!input) return [];
103
-
104
- let ids;
105
- if (typeof input === 'string') {
106
- ids = input.split(',').map((s) => s.trim().toLowerCase()).filter(Boolean);
107
- } else if (Array.isArray(input)) {
108
- ids = input.map((s) => String(s).trim().toLowerCase()).filter(Boolean);
109
- } else {
110
- return [];
111
- }
112
-
113
- if (ids.includes('all')) return [...ALL_IDE_IDS];
114
- if (ids.includes('none')) return [];
115
-
116
- const valid = ids.filter((id) => id in IDE_REGISTRY);
117
- const invalid = ids.filter((id) => !(id in IDE_REGISTRY));
118
-
119
- if (invalid.length > 0) {
120
- console.warn(chalk.yellow(`Warning: Unknown IDE identifiers: ${invalid.join(', ')}`));
121
- console.warn(chalk.blue(`Valid options: ${ALL_IDE_IDS.join(', ')}, all, none`));
122
- }
123
-
124
- return valid;
125
- }
126
-
127
- module.exports = {
128
- IDE_REGISTRY,
129
- ALL_IDE_IDS,
130
- detectActiveIDEs,
131
- getRecommendedIDEs,
132
- parseIDESelection,
133
- };