@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,1172 +0,0 @@
1
- /**
2
- * @fileoverview CAWS Status Command
3
- * Display project health overview
4
- * @author @darianrosebrook
5
- */
6
-
7
- const fs = require('fs-extra');
8
- const path = require('path');
9
- const yaml = require('js-yaml');
10
- const chalk = require('chalk');
11
- // child_process removed - execSync no longer used directly
12
- const { safeAsync, outputResult } = require('../error-handler');
13
- const { parallel } = require('../utils/async-utils');
14
- const { resolveSpec } = require('../utils/spec-resolver');
15
- // EVLOG-002 Phase 2 read flip: status reads working state from the event log
16
- // via the pure renderer. loadStateFromEvents matches loadState's null contract
17
- // exactly, so the `ws && ws.phase !== 'not-started'` guard and the
18
- // `loadState(id) || null` coalesce below stay semantically correct.
19
- const { loadStateFromEvents } = require('../utils/event-renderer');
20
-
21
- /**
22
- * Load working specification (legacy single file approach)
23
- * @param {string} specPath - Path to working spec
24
- * @returns {Promise<Object|null>} Parsed spec or null
25
- */
26
- async function loadWorkingSpec(specPath = '.caws/working-spec.yaml') {
27
- try {
28
- if (!(await fs.pathExists(specPath))) {
29
- return null;
30
- }
31
-
32
- const content = await fs.readFile(specPath, 'utf8');
33
- return yaml.load(content);
34
- } catch (error) {
35
- return null;
36
- }
37
- }
38
-
39
- /**
40
- * Resolve the primary spec for status display when explicitly targeted
41
- * or when the resolver can identify a single canonical spec.
42
- * Returns null when no spec can be auto-selected.
43
- * @param {Object} options
44
- * @returns {Promise<Object|null>}
45
- */
46
- async function loadResolvedStatusSpec(options = {}) {
47
- try {
48
- const resolved = await resolveSpec({
49
- specId: options.specId,
50
- specFile: options.spec,
51
- warnLegacy: false,
52
- interactive: false,
53
- quiet: Boolean(options.json),
54
- });
55
- return {
56
- ...resolved,
57
- selected: true,
58
- };
59
- } catch (error) {
60
- if (
61
- error.message === 'Spec ID required when multiple specs exist' &&
62
- !options.specId &&
63
- !options.spec
64
- ) {
65
- return null;
66
- }
67
- if (error.message.includes('No CAWS spec found')) {
68
- return null;
69
- }
70
- throw error;
71
- }
72
- }
73
-
74
- /**
75
- * Load specs from the new multi-spec system
76
- * @returns {Promise<Array>} Array of spec objects
77
- */
78
- async function loadSpecsFromMultiSpec() {
79
- const { listSpecFiles } = require('./specs');
80
-
81
- try {
82
- return await listSpecFiles();
83
- } catch (error) {
84
- return [];
85
- }
86
- }
87
-
88
- /**
89
- * Check Git hooks status
90
- * @returns {Promise<Object>} Hooks status
91
- */
92
- async function checkGitHooks() {
93
- const hooksDir = '.git/hooks';
94
-
95
- if (!(await fs.pathExists(hooksDir))) {
96
- return {
97
- installed: false,
98
- count: 0,
99
- active: [],
100
- };
101
- }
102
-
103
- const cawsHooks = ['pre-commit', 'post-commit', 'pre-push', 'commit-msg'];
104
- const activeHooks = [];
105
-
106
- for (const hook of cawsHooks) {
107
- const hookPath = path.join(hooksDir, hook);
108
- if (await fs.pathExists(hookPath)) {
109
- const content = await fs.readFile(hookPath, 'utf8');
110
- if (content.includes('CAWS')) {
111
- activeHooks.push(hook);
112
- }
113
- }
114
- }
115
-
116
- return {
117
- installed: activeHooks.length > 0,
118
- count: activeHooks.length,
119
- active: activeHooks,
120
- total: cawsHooks.length,
121
- };
122
- }
123
-
124
- /**
125
- * Load provenance chain
126
- * @returns {Promise<Object>} Provenance status
127
- */
128
- async function loadProvenanceChain() {
129
- const chainPath = '.caws/provenance/chain.json';
130
-
131
- if (!(await fs.pathExists(chainPath))) {
132
- return {
133
- exists: false,
134
- count: 0,
135
- lastUpdate: null,
136
- };
137
- }
138
-
139
- try {
140
- const chain = JSON.parse(await fs.readFile(chainPath, 'utf8'));
141
- const lastEntry = chain.length > 0 ? chain[chain.length - 1] : null;
142
-
143
- return {
144
- exists: true,
145
- count: chain.length,
146
- lastUpdate: lastEntry?.timestamp || null,
147
- lastCommit: lastEntry?.commit?.hash || null,
148
- };
149
- } catch (error) {
150
- return {
151
- exists: true,
152
- count: 0,
153
- lastUpdate: null,
154
- error: error.message,
155
- };
156
- }
157
- }
158
-
159
- /**
160
- * Load waiver status
161
- * @returns {Promise<Object>} Waiver status
162
- */
163
- async function loadWaiverStatus() {
164
- const waiversDir = '.caws/waivers';
165
-
166
- if (!(await fs.pathExists(waiversDir))) {
167
- return {
168
- exists: false,
169
- active: 0,
170
- expired: 0,
171
- revoked: 0,
172
- total: 0,
173
- };
174
- }
175
-
176
- try {
177
- const waiverFiles = await fs.readdir(waiversDir);
178
- const yamlFiles = waiverFiles.filter((f) => f.endsWith('.yaml'));
179
-
180
- let active = 0;
181
- let expired = 0;
182
- let revoked = 0;
183
-
184
- for (const file of yamlFiles) {
185
- const waiverPath = path.join(waiversDir, file);
186
- const content = await fs.readFile(waiverPath, 'utf8');
187
- const waiver = yaml.load(content);
188
-
189
- if (waiver.status === 'revoked') {
190
- revoked++;
191
- } else if (waiver.status === 'active') {
192
- const now = new Date();
193
- const expiresAt = new Date(waiver.expires_at);
194
- if (now > expiresAt) {
195
- expired++;
196
- } else {
197
- active++;
198
- }
199
- }
200
- }
201
-
202
- return {
203
- exists: true,
204
- active,
205
- expired,
206
- revoked,
207
- total: active + expired + revoked,
208
- };
209
- } catch (error) {
210
- return {
211
- exists: false,
212
- active: 0,
213
- expired: 0,
214
- revoked: 0,
215
- total: 0,
216
- error: error.message,
217
- };
218
- }
219
- }
220
-
221
- /**
222
- * Check quality gates status (simplified)
223
- * @returns {Promise<Object>} Quality gates status
224
- */
225
- async function checkQualityGates() {
226
- return {
227
- checked: false,
228
- message: 'Run: caws quality-gates for full gate status',
229
- };
230
- }
231
-
232
- /**
233
- * Get test coverage from coverage reports
234
- * Looks for common coverage report locations and formats
235
- * @returns {Promise<Object>} Coverage data with percentage and details
236
- */
237
- async function getTestCoverage() {
238
- const coverageLocations = [
239
- // Jest/Istanbul coverage
240
- { path: 'coverage/coverage-summary.json', type: 'istanbul' },
241
- { path: 'coverage/lcov-report/index.html', type: 'lcov-html' },
242
- { path: 'coverage/coverage-final.json', type: 'istanbul-final' },
243
- // NYC coverage
244
- { path: '.nyc_output/coverage-summary.json', type: 'nyc' },
245
- // C8 coverage
246
- { path: 'coverage/c8/coverage-summary.json', type: 'c8' },
247
- ];
248
-
249
- try {
250
- for (const loc of coverageLocations) {
251
- const coveragePath = path.join(process.cwd(), loc.path);
252
- if (await fs.pathExists(coveragePath)) {
253
- if (loc.type === 'istanbul' || loc.type === 'nyc' || loc.type === 'c8') {
254
- const content = await fs.readFile(coveragePath, 'utf8');
255
- const data = JSON.parse(content);
256
-
257
- // Istanbul/NYC format has a "total" key with coverage percentages
258
- if (data.total) {
259
- const lines = data.total.lines?.pct || 0;
260
- const statements = data.total.statements?.pct || 0;
261
- const branches = data.total.branches?.pct || 0;
262
- const functions = data.total.functions?.pct || 0;
263
-
264
- return {
265
- available: true,
266
- percentage: Math.round((lines + statements + branches + functions) / 4),
267
- lines: Math.round(lines),
268
- statements: Math.round(statements),
269
- branches: Math.round(branches),
270
- functions: Math.round(functions),
271
- source: loc.path,
272
- };
273
- }
274
- } else if (loc.type === 'istanbul-final') {
275
- // coverage-final.json has per-file data, need to aggregate
276
- const content = await fs.readFile(coveragePath, 'utf8');
277
- const data = JSON.parse(content);
278
-
279
- let totalStatements = 0;
280
- let coveredStatements = 0;
281
-
282
- for (const file of Object.values(data)) {
283
- const s = file.s || {};
284
- for (const count of Object.values(s)) {
285
- totalStatements++;
286
- if (count > 0) coveredStatements++;
287
- }
288
- }
289
-
290
- if (totalStatements > 0) {
291
- const percentage = Math.round((coveredStatements / totalStatements) * 100);
292
- return {
293
- available: true,
294
- percentage,
295
- source: loc.path,
296
- };
297
- }
298
- }
299
- }
300
- }
301
-
302
- // Try running test coverage command if no reports found
303
- try {
304
- // Check if package.json has a coverage script
305
- const pkgPath = path.join(process.cwd(), 'package.json');
306
- if (await fs.pathExists(pkgPath)) {
307
- const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf8'));
308
- if (pkg.scripts && (pkg.scripts.coverage || pkg.scripts['test:coverage'])) {
309
- return {
310
- available: false,
311
- percentage: null,
312
- message: 'Run npm run coverage to generate coverage report',
313
- };
314
- }
315
- }
316
- } catch {
317
- // Ignore package.json errors
318
- }
319
-
320
- return {
321
- available: false,
322
- percentage: null,
323
- message: 'No coverage report found',
324
- };
325
- } catch (error) {
326
- return {
327
- available: false,
328
- percentage: null,
329
- message: `Error reading coverage: ${error.message}`,
330
- };
331
- }
332
- }
333
-
334
- /**
335
- * Get time since last update
336
- * @param {string} timestamp - ISO timestamp
337
- * @returns {string} Human-readable time
338
- */
339
- function getTimeSince(timestamp) {
340
- if (!timestamp) return 'never';
341
-
342
- const now = new Date();
343
- const then = new Date(timestamp);
344
- const diffMs = now - then;
345
-
346
- const diffMins = Math.floor(diffMs / 60000);
347
- const diffHours = Math.floor(diffMs / 3600000);
348
- const diffDays = Math.floor(diffMs / 86400000);
349
-
350
- if (diffMins < 1) return 'just now';
351
- if (diffMins < 60) return `${diffMins} minute${diffMins > 1 ? 's' : ''} ago`;
352
- if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? 's' : ''} ago`;
353
- return `${diffDays} day${diffDays > 1 ? 's' : ''} ago`;
354
- }
355
-
356
- /**
357
- * Display project status
358
- * @param {Object} data - Status data
359
- */
360
- function displayStatus(data) {
361
- const { spec, specSelection, hooks, provenance, waivers, gates } = data;
362
-
363
- console.log(chalk.bold.cyan('\nCAWS Project Status'));
364
- console.log(chalk.cyan('==============================================\n'));
365
-
366
- // CAWSFIX-31: Surface worktree claim if cwd is inside a worktree.
367
- // Best-effort — failures (no .caws, no registry, etc.) are silent.
368
- try {
369
- const path = require('path');
370
- const { findProjectRoot } = require('../utils/detection');
371
- const { renderClaimPanel } = require('../utils/agent-display');
372
- const root = findProjectRoot();
373
- const cwd = process.cwd();
374
- const worktreesBase = path.join(root, '.caws', 'worktrees');
375
- if (cwd.startsWith(worktreesBase + path.sep)) {
376
- const worktreeName = path.relative(worktreesBase, cwd).split(path.sep)[0];
377
- const panel = renderClaimPanel(root, worktreeName);
378
- if (panel) {
379
- console.log(chalk.green(panel));
380
- console.log('');
381
- }
382
- }
383
- } catch {
384
- // best-effort
385
- }
386
-
387
- // Working Spec Status
388
- if (spec) {
389
- console.log(chalk.green('Working Spec'));
390
- console.log(chalk.gray(` ID: ${spec.id} | Tier: ${spec.risk_tier} | Mode: ${spec.mode}`));
391
- console.log(chalk.gray(` Title: ${spec.title}`));
392
- if (specSelection?.specType) {
393
- console.log(chalk.gray(` Source: ${specSelection.specType} (${specSelection.specPath})`));
394
- }
395
- } else {
396
- console.log(chalk.red('Working Spec'));
397
- console.log(chalk.gray(' No working spec found'));
398
- console.log(chalk.yellow(' Run: caws init . to create one'));
399
- }
400
-
401
- console.log('');
402
-
403
- // Working State (EVLOG-002: from event log)
404
- if (spec && spec.id) {
405
- let ws = null;
406
- try { ws = loadStateFromEvents(spec.id); } catch { /* non-fatal */ }
407
- if (ws && ws.phase !== 'not-started') {
408
- const phaseLabels = {
409
- 'not-started': 'Not Started',
410
- 'spec-authoring': 'Spec Authoring',
411
- 'implementation': 'Implementation',
412
- 'verification': 'Verification',
413
- 'complete': 'Complete',
414
- };
415
- console.log(chalk.green('Working State'));
416
- console.log(chalk.gray(` Phase: ${phaseLabels[ws.phase] || ws.phase}`));
417
- if (ws.validation) {
418
- const vIcon = ws.validation.passed ? chalk.green('pass') : chalk.red('fail');
419
- console.log(chalk.gray(` Validation: ${vIcon}${ws.validation.grade ? ` (Grade ${ws.validation.grade})` : ''}`));
420
- }
421
- if (ws.evaluation) {
422
- console.log(chalk.gray(` Evaluation: ${ws.evaluation.percentage}% (Grade ${ws.evaluation.grade})`));
423
- }
424
- if (ws.gates) {
425
- const gIcon = ws.gates.passed ? chalk.green('pass') : chalk.red('blocked');
426
- const s = ws.gates.summary;
427
- console.log(chalk.gray(` Gates: ${gIcon} (${s.passed} pass, ${s.blocked} blocked, ${s.warned} warned)`));
428
- }
429
- if (ws.acceptance_criteria) {
430
- const ac = ws.acceptance_criteria;
431
- console.log(chalk.gray(` ACs: ${ac.pass}/${ac.total} pass, ${ac.fail} fail, ${ac.unchecked} unchecked`));
432
- }
433
- if (ws.files_touched && ws.files_touched.length > 0) {
434
- console.log(chalk.gray(` Files touched: ${ws.files_touched.length}`));
435
- }
436
- if (ws.blockers && ws.blockers.length > 0) {
437
- console.log(chalk.red(` Blockers: ${ws.blockers.length}`));
438
- ws.blockers.forEach(b => console.log(chalk.red(` - ${b.message}`)));
439
- }
440
- console.log('');
441
- }
442
- }
443
-
444
- // Git Hooks Status
445
- if (hooks.installed) {
446
- console.log(chalk.green(`Git Hooks`));
447
- console.log(chalk.gray(` ${hooks.count}/${hooks.total} active: ${hooks.active.join(', ')}`));
448
- } else {
449
- console.log(chalk.yellow('Git Hooks'));
450
- console.log(chalk.gray(' No CAWS git hooks installed'));
451
- console.log(chalk.yellow(' Run: caws hooks install'));
452
- }
453
-
454
- console.log('');
455
-
456
- // Provenance Status
457
- if (provenance.exists) {
458
- console.log(chalk.green('Provenance'));
459
- console.log(chalk.gray(` Chain: ${provenance.count} entries`));
460
- if (provenance.lastUpdate) {
461
- console.log(chalk.gray(` Last update: ${getTimeSince(provenance.lastUpdate)}`));
462
- }
463
- } else {
464
- console.log(chalk.yellow('Provenance'));
465
- console.log(chalk.gray(' Provenance tracking not initialized'));
466
- console.log(chalk.yellow(' Run: caws provenance init'));
467
- }
468
-
469
- console.log('');
470
-
471
- // Waivers Status
472
- if (waivers.exists && waivers.total > 0) {
473
- console.log(chalk.green('Quality Gate Waivers'));
474
- console.log(
475
- chalk.gray(
476
- ` ${waivers.active} active, ${waivers.expired} expired, ${waivers.revoked} revoked`
477
- )
478
- );
479
- console.log(chalk.gray(` Total: ${waivers.total} waiver${waivers.total > 1 ? 's' : ''}`));
480
- } else if (waivers.exists) {
481
- console.log(chalk.blue('Quality Gate Waivers'));
482
- console.log(chalk.gray(' No waivers configured'));
483
- } else {
484
- console.log(chalk.yellow('Quality Gate Waivers'));
485
- console.log(chalk.gray(' Waiver system not initialized'));
486
- console.log(chalk.yellow(' Run: caws waivers create (when needed)'));
487
- }
488
-
489
- console.log('');
490
-
491
- // Quality Gates Status
492
- console.log(chalk.blue('Quality Gates'));
493
- console.log(chalk.gray(` ${gates.message}`));
494
-
495
- // Suggestions
496
- const suggestions = generateSuggestions(data);
497
- if (suggestions.length > 0) {
498
- console.log(chalk.bold.yellow('\nSuggestions:'));
499
- suggestions.forEach((suggestion) => {
500
- console.log(chalk.yellow(` ${suggestion}`));
501
- });
502
- }
503
-
504
- // Quick Links
505
- console.log(chalk.bold.blue('\nQuick Links:'));
506
- if (spec) {
507
- console.log(chalk.blue(' View spec: .caws/working-spec.yaml'));
508
- }
509
- if (hooks.installed) {
510
- console.log(chalk.blue(' View hooks: .git/hooks/'));
511
- }
512
- if (provenance.exists) {
513
- console.log(chalk.blue(' View provenance: caws provenance show --format=dashboard'));
514
- }
515
- if (waivers.exists && waivers.total > 0) {
516
- console.log(chalk.blue(' View waivers: caws waivers list'));
517
- }
518
- console.log(chalk.blue(' Full documentation: docs/agents/full-guide.md'));
519
-
520
- console.log('');
521
- }
522
-
523
- /**
524
- * Generate actionable suggestions based on status and mode
525
- * @param {Object} data - Status data
526
- * @param {string} currentMode - Current CAWS mode
527
- * @returns {string[]} Array of suggestions
528
- */
529
- function generateSuggestions(data, currentMode) {
530
- const { spec, specs, hooks, provenance, waivers } = data;
531
- const modes = require('../config/modes');
532
- const suggestions = [];
533
-
534
- // Basic setup suggestions
535
- if (!spec && (!specs || specs.length === 0)) {
536
- suggestions.push('Create a spec: caws specs create <id>');
537
- }
538
-
539
- // Mode-specific suggestions
540
- if (modes.isFeatureEnabled('gitHooks', currentMode) && !hooks.installed) {
541
- suggestions.push('Install Git hooks: caws hooks install');
542
- }
543
-
544
- if (modes.isFeatureEnabled('provenance', currentMode) && !provenance.exists) {
545
- suggestions.push('Initialize provenance tracking: caws provenance init');
546
- }
547
-
548
- if (modes.isFeatureEnabled('waivers', currentMode) && !waivers.exists) {
549
- suggestions.push('Initialize waiver system: caws waivers create (when needed)');
550
- }
551
-
552
- // Quality gate suggestions
553
- if (modes.isFeatureEnabled('qualityGates', currentMode)) {
554
- if (spec || (specs && specs.length > 0)) {
555
- suggestions.push('Run quality gates: caws diagnose');
556
- }
557
- }
558
-
559
- // Mode switching suggestion
560
- suggestions.push('Switch modes: caws mode set --interactive');
561
-
562
- return suggestions;
563
- }
564
-
565
- /**
566
- * Create progress bar string
567
- * @param {number} current - Current value
568
- * @param {number} total - Total value
569
- * @param {number} width - Bar width
570
- * @returns {string} Progress bar string
571
- */
572
- function createProgressBar(current, total, width = 20) {
573
- if (total === 0) return '░'.repeat(width);
574
-
575
- const percentage = Math.min(current / total, 1);
576
- const filled = Math.round(percentage * width);
577
- const empty = width - filled;
578
-
579
- return '▓'.repeat(filled) + '░'.repeat(empty);
580
- }
581
-
582
- /**
583
- * Get color for progress percentage
584
- * @param {number} percentage - Progress percentage
585
- * @returns {string} Chalk color function
586
- */
587
- function getProgressColor(percentage) {
588
- if (percentage >= 80) return chalk.green;
589
- if (percentage >= 50) return chalk.yellow;
590
- return chalk.red;
591
- }
592
-
593
- /**
594
- * Display enhanced visual status
595
- * @param {Object} data - Status data
596
- * @param {string} currentMode - Current CAWS mode
597
- */
598
- async function displayVisualStatus(data, currentMode) {
599
- const { spec, specs, hooks, provenance, waivers, gates } = data;
600
- const modes = require('../config/modes');
601
- const tierConfig = modes.getTier(currentMode);
602
-
603
- console.log(
604
- chalk.bold.cyan(
605
- `\nCAWS Project Status (${tierConfig.icon} ${tierConfig.color(currentMode)})`
606
- )
607
- );
608
- console.log(
609
- chalk.cyan(
610
- '=================================================================================\n'
611
- )
612
- );
613
-
614
- // Multi-spec system status
615
- if (specs && specs.length > 0) {
616
- console.log(chalk.green(`Specs System (${specs.length} specs)`));
617
-
618
- // Show active specs first
619
- const activeSpecs = specs.filter((s) => s.status === 'active' || s.status === 'in_progress');
620
- const draftSpecs = specs.filter((s) => s.status === 'draft');
621
- const completedSpecs = specs.filter((s) => s.status === 'completed');
622
- const closedSpecs = specs.filter((s) => s.status === 'closed' || s.status === 'archived');
623
-
624
- if (activeSpecs.length > 0) {
625
- console.log(
626
- chalk.gray(` Active: ${activeSpecs.map((s) => `${s.id}(${s.type})`).join(', ')}`)
627
- );
628
- }
629
- if (draftSpecs.length > 0) {
630
- console.log(
631
- chalk.gray(` Draft: ${draftSpecs.length} spec${draftSpecs.length > 1 ? 's' : ''}`)
632
- );
633
- // Show details for draft specs if not too many
634
- if (draftSpecs.length <= 3) {
635
- draftSpecs.forEach((s) => {
636
- console.log(chalk.gray(` - ${s.id}: ${s.title}`));
637
- });
638
- }
639
- }
640
- if (completedSpecs.length > 0) {
641
- console.log(
642
- chalk.gray(
643
- ` Completed: ${completedSpecs.length} spec${completedSpecs.length > 1 ? 's' : ''}`
644
- )
645
- );
646
- // Show details for completed specs if not too many
647
- if (completedSpecs.length <= 3) {
648
- completedSpecs.forEach((s) => {
649
- console.log(chalk.gray(` - ${s.id}: ${s.title}`));
650
- });
651
- }
652
- }
653
- if (closedSpecs.length > 0) {
654
- console.log(
655
- chalk.gray(
656
- ` Closed: ${closedSpecs.length} spec${closedSpecs.length > 1 ? 's' : ''}`
657
- )
658
- );
659
- }
660
-
661
- // Overall specs progress (completed + closed both count as done)
662
- const totalSpecs = specs.length;
663
- const completedSpecsCount = specs.filter((s) =>
664
- s.status === 'completed' || s.status === 'closed' || s.status === 'archived'
665
- ).length;
666
- const activeSpecsCount = specs.filter((s) => s.status === 'active').length;
667
- const progressPercentage =
668
- totalSpecs > 0 ? Math.round((completedSpecsCount / totalSpecs) * 100) : 0;
669
- const progressBar = createProgressBar(completedSpecsCount, totalSpecs);
670
- const color = getProgressColor(progressPercentage);
671
-
672
- console.log(
673
- chalk.gray(
674
- ` Overall Progress: ${color(`${progressPercentage}%`)} ${progressBar} ${completedSpecsCount}/${totalSpecs} completed`
675
- )
676
- );
677
-
678
- if (activeSpecsCount > 0) {
679
- console.log(chalk.gray(` Active Features: ${activeSpecsCount} in progress`));
680
- }
681
-
682
- // Show risk tier breakdown
683
- const riskBreakdown = {};
684
- specs.forEach((s) => {
685
- const tier = s.risk_tier || 'T3';
686
- riskBreakdown[tier] = (riskBreakdown[tier] || 0) + 1;
687
- });
688
-
689
- if (Object.keys(riskBreakdown).length > 1) {
690
- const tierDisplay = Object.entries(riskBreakdown)
691
- .map(([tier, count]) => `${tier}:${count}`)
692
- .join(', ');
693
- console.log(chalk.gray(` Risk Distribution: ${tierDisplay}`));
694
- }
695
- } else if (spec) {
696
- // Legacy single spec system
697
- console.log(chalk.green('Working Spec'));
698
- console.log(chalk.gray(` ID: ${spec.id} | Tier: ${spec.risk_tier} | Mode: ${spec.mode}`));
699
- console.log(chalk.gray(` Title: ${spec.title}`));
700
-
701
- // Acceptance Criteria Progress
702
- if (spec.acceptance_criteria && spec.acceptance_criteria.length > 0) {
703
- const total = spec.acceptance_criteria.length;
704
- const completed = spec.acceptance_criteria.filter((c) => c.completed).length;
705
- const percentage = Math.round((completed / total) * 100);
706
-
707
- const color = getProgressColor(percentage);
708
- const bar = createProgressBar(completed, total);
709
-
710
- console.log(
711
- chalk.gray(
712
- ` Acceptance Criteria: ${color(`${percentage}%`)} ${bar} ${completed}/${total}`
713
- )
714
- );
715
- }
716
-
717
- // Test Coverage
718
- const coverage = await getTestCoverage();
719
- if (coverage.available && coverage.percentage !== null) {
720
- const coverageColor =
721
- coverage.percentage >= 80
722
- ? chalk.green
723
- : coverage.percentage >= 50
724
- ? chalk.yellow
725
- : chalk.red;
726
- const coverageBar = createProgressBar(coverage.percentage, 100);
727
- console.log(
728
- chalk.gray(
729
- ` Test Coverage: ${coverageColor(`${coverage.percentage}%`)} ${coverageBar}`
730
- )
731
- );
732
- if (coverage.lines !== undefined) {
733
- console.log(
734
- chalk.gray(
735
- ` Lines: ${coverage.lines}% | Branches: ${coverage.branches}% | Functions: ${coverage.functions}%`
736
- )
737
- );
738
- }
739
- } else {
740
- console.log(
741
- chalk.gray(
742
- ` Test Coverage: ${chalk.yellow('N/A')} ${createProgressBar(0, 100)} ${chalk.gray(coverage.message || 'No report')}`
743
- )
744
- );
745
- }
746
-
747
- // Risk Tier Indicator
748
- const riskColor =
749
- spec.risk_tier === 'T1' ? chalk.red : spec.risk_tier === 'T2' ? chalk.yellow : chalk.green;
750
- console.log(
751
- chalk.gray(
752
- ` Risk Tier: ${riskColor(spec.risk_tier)} (Quality Gates: ${riskColor('Active')})`
753
- )
754
- );
755
- } else {
756
- console.log(chalk.red('No Specs Found'));
757
- console.log(chalk.gray(' No working spec or specs directory found'));
758
- console.log(chalk.yellow(' Run: caws specs create <id> to create specs'));
759
- console.log(chalk.yellow(' Or run: caws init . for legacy single spec'));
760
- }
761
-
762
- console.log('');
763
-
764
- // Git Hooks Status (only show in modes that support it)
765
- if (modes.isFeatureEnabled('gitHooks', currentMode)) {
766
- if (hooks.installed) {
767
- const hookBar = createProgressBar(hooks.count, hooks.total);
768
- console.log(chalk.green(`Git Hooks`));
769
- console.log(
770
- chalk.gray(` ${hookBar} ${hooks.count}/${hooks.total} active: ${hooks.active.join(', ')}`)
771
- );
772
- } else {
773
- console.log(chalk.yellow('Git Hooks'));
774
- console.log(chalk.gray(' No CAWS git hooks installed'));
775
- console.log(chalk.yellow(' Run: caws hooks install'));
776
- }
777
- }
778
-
779
- console.log('');
780
-
781
- // Provenance Status (only show in modes that support it)
782
- if (modes.isFeatureEnabled('provenance', currentMode)) {
783
- if (provenance.exists) {
784
- const provenanceBar = createProgressBar(provenance.count, Math.max(provenance.count, 10));
785
- console.log(chalk.green('Provenance'));
786
- console.log(chalk.gray(` ${provenanceBar} ${provenance.count} entries`));
787
- if (provenance.lastUpdate) {
788
- console.log(chalk.gray(` Last update: ${getTimeSince(provenance.lastUpdate)}`));
789
- }
790
- } else {
791
- console.log(chalk.yellow('Provenance'));
792
- console.log(chalk.gray(' Provenance tracking not initialized'));
793
- console.log(chalk.yellow(' Run: caws provenance init'));
794
- }
795
- }
796
-
797
- console.log('');
798
-
799
- // Waivers Status (only show in modes that support it)
800
- if (modes.isFeatureEnabled('waivers', currentMode)) {
801
- if (waivers.exists && waivers.total > 0) {
802
- const waiverBar = createProgressBar(waivers.active, waivers.total);
803
- console.log(chalk.green('Quality Gate Waivers'));
804
- console.log(
805
- chalk.gray(
806
- ` ${waiverBar} ${waivers.active} active, ${waivers.expired} expired, ${waivers.revoked} revoked`
807
- )
808
- );
809
- console.log(chalk.gray(` Total: ${waivers.total} waiver${waivers.total > 1 ? 's' : ''}`));
810
- } else if (waivers.exists) {
811
- console.log(chalk.blue('Quality Gate Waivers'));
812
- console.log(chalk.gray(' No waivers configured'));
813
- } else {
814
- console.log(chalk.yellow('Quality Gate Waivers'));
815
- console.log(chalk.gray(' Waiver system not initialized'));
816
- console.log(chalk.yellow(' Run: caws waivers create (when needed)'));
817
- }
818
- }
819
-
820
- console.log('');
821
-
822
- // Quality Gates Status (only show in modes that support it)
823
- if (modes.isFeatureEnabled('qualityGates', currentMode)) {
824
- console.log(chalk.blue('Quality Gates'));
825
- if (gates.checked) {
826
- if (gates.passed) {
827
- console.log(chalk.green(` ${createProgressBar(1, 1)} All gates passed`));
828
- gates.results?.forEach((gate) => {
829
- const gateStatus = gate.status === 'passed' ? chalk.green('[pass]') : chalk.red('[fail]');
830
- console.log(chalk.gray(` ${gateStatus} ${gate.name}: ${gate.message || 'OK'}`));
831
- });
832
- } else {
833
- console.log(
834
- chalk.red(
835
- ` ${createProgressBar(0, gates.results?.length || 1)} ${gates.failed || 0} gates failed`
836
- )
837
- );
838
- gates.results?.forEach((gate) => {
839
- const gateStatus = gate.status === 'passed' ? chalk.green('[pass]') : chalk.red('[fail]');
840
- console.log(chalk.gray(` ${gateStatus} ${gate.name}: ${gate.message || 'Failed'}`));
841
- });
842
- }
843
- } else {
844
- console.log(chalk.gray(` ${gates.message}`));
845
- }
846
- }
847
-
848
- // Progress Summary
849
- const overallProgress = calculateOverallProgress(data);
850
- const progressColor = getProgressColor(overallProgress);
851
- const progressBar = createProgressBar(overallProgress, 100);
852
-
853
- console.log('');
854
- console.log(chalk.bold.blue('Overall Progress'));
855
- console.log(chalk.gray(` ${progressBar} ${progressColor(`${overallProgress}%`)} complete`));
856
-
857
- // Suggestions (mode-aware)
858
- const suggestions = generateSuggestions(data, currentMode);
859
- if (suggestions.length > 0) {
860
- console.log(chalk.bold.yellow('\nNext Steps:'));
861
- suggestions.forEach((suggestion, index) => {
862
- console.log(chalk.yellow(` ${index + 1}. ${suggestion}`));
863
- });
864
- }
865
-
866
- // Quick Links (mode-aware)
867
- console.log(chalk.bold.blue('\nQuick Actions:'));
868
- if (spec || (specs && specs.length > 0)) {
869
- if (modes.isFeatureEnabled('validate', currentMode)) {
870
- console.log(chalk.blue(' View specs: caws specs list'));
871
- }
872
- if (modes.isFeatureEnabled('validate', currentMode)) {
873
- console.log(chalk.blue(' Validate: caws validate'));
874
- }
875
- }
876
-
877
- if (modes.isFeatureEnabled('gitHooks', currentMode) && hooks.installed) {
878
- console.log(chalk.blue(' View hooks: caws hooks status'));
879
- }
880
-
881
- if (modes.isFeatureEnabled('provenance', currentMode) && provenance.exists) {
882
- console.log(chalk.blue(' View provenance: caws provenance show'));
883
- }
884
-
885
- if (modes.isFeatureEnabled('waivers', currentMode) && waivers.exists && waivers.total > 0) {
886
- console.log(chalk.blue(' View waivers: caws waivers list'));
887
- }
888
-
889
- console.log(chalk.blue(' Get help: caws help'));
890
- console.log(chalk.blue(' Switch mode: caws mode set --interactive'));
891
-
892
- console.log('');
893
- }
894
-
895
- /**
896
- * Calculate overall project progress (mode-aware)
897
- * @param {Object} data - Status data
898
- * @returns {number} Overall progress percentage
899
- */
900
- function calculateOverallProgress(data) {
901
- const { spec, specs, hooks, provenance, waivers, currentMode } = data;
902
- const modes = require('../config/modes');
903
-
904
- let score = 0;
905
-
906
- // Multi-spec system
907
- if (specs && specs.length > 0) {
908
- // Specs system (40%)
909
- const completedSpecs = specs.filter((s) => s.status === 'completed').length;
910
- if (specs.length > 0) {
911
- const percentage = (completedSpecs / specs.length) * 40;
912
- score += percentage;
913
- }
914
-
915
- // Git hooks (20%) - only if enabled in mode
916
- if (modes.isFeatureEnabled('gitHooks', currentMode)) {
917
- if (hooks.installed) score += 20;
918
- }
919
-
920
- // Provenance (20%) - only if enabled in mode
921
- if (modes.isFeatureEnabled('provenance', currentMode)) {
922
- if (provenance.exists) score += 20;
923
- }
924
-
925
- // Waivers (15%) - only if enabled in mode
926
- if (modes.isFeatureEnabled('waivers', currentMode)) {
927
- if (waivers.exists) score += 15;
928
- }
929
-
930
- // Quality gates (5%) - only if enabled in mode
931
- if (modes.isFeatureEnabled('qualityGates', currentMode)) {
932
- if (specs.length > 0) score += 5;
933
- }
934
- } else if (spec) {
935
- // Legacy single spec system (30%)
936
- if (spec) score += 30;
937
-
938
- // Acceptance criteria progress (25%)
939
- if (spec && spec.acceptance_criteria && spec.acceptance_criteria.length > 0) {
940
- const completed = spec.acceptance_criteria.filter((c) => c.completed).length;
941
- const percentage = (completed / spec.acceptance_criteria.length) * 25;
942
- score += percentage;
943
- }
944
-
945
- // Git hooks (15%) - only if enabled in mode
946
- if (modes.isFeatureEnabled('gitHooks', currentMode)) {
947
- if (hooks.installed) score += 15;
948
- }
949
-
950
- // Provenance (15%) - only if enabled in mode
951
- if (modes.isFeatureEnabled('provenance', currentMode)) {
952
- if (provenance.exists) score += 15;
953
- }
954
-
955
- // Waivers (10%) - only if enabled in mode
956
- if (modes.isFeatureEnabled('waivers', currentMode)) {
957
- if (waivers.exists) score += 10;
958
- }
959
-
960
- // Quality gates (5%) - only if enabled in mode
961
- if (modes.isFeatureEnabled('qualityGates', currentMode)) {
962
- if (spec) score += 5;
963
- }
964
- } else {
965
- // No specs system - check basic setup (mode-aware)
966
-
967
- // Git hooks (30%) - only if enabled in mode
968
- if (modes.isFeatureEnabled('gitHooks', currentMode)) {
969
- if (hooks.installed) score += 30;
970
- }
971
-
972
- // Provenance (30%) - only if enabled in mode
973
- if (modes.isFeatureEnabled('provenance', currentMode)) {
974
- if (provenance.exists) score += 30;
975
- }
976
-
977
- // Waivers (20%) - only if enabled in mode
978
- if (modes.isFeatureEnabled('waivers', currentMode)) {
979
- if (waivers.exists) score += 20;
980
- }
981
-
982
- // Quality gates (20%) - only if enabled in mode
983
- if (modes.isFeatureEnabled('qualityGates', currentMode)) {
984
- if (hooks.installed || provenance.exists) score += 20;
985
- }
986
- }
987
-
988
- return Math.min(Math.round(score), 100);
989
- }
990
-
991
- /**
992
- * Status command handler
993
- * @param {Object} options - Command options
994
- */
995
- async function statusCommand(options = {}) {
996
- return safeAsync(
997
- async () => {
998
- // Check current mode and adjust behavior accordingly
999
- const modes = require('../config/modes');
1000
- const currentMode = await modes.getCurrentMode();
1001
-
1002
- // Load all status data in parallel for better performance
1003
- const [resolvedSpec, specs, hooks, provenance, waivers, gates] = await parallel([
1004
- loadResolvedStatusSpec(options),
1005
- loadSpecsFromMultiSpec(),
1006
- checkGitHooks(),
1007
- loadProvenanceChain(),
1008
- loadWaiverStatus(),
1009
- checkQualityGates(),
1010
- ]);
1011
- const spec = resolvedSpec?.spec || null;
1012
- const specSelection = resolvedSpec
1013
- ? {
1014
- specPath: resolvedSpec.path
1015
- ? path.relative(process.cwd(), resolvedSpec.path)
1016
- : null,
1017
- specType: resolvedSpec.type,
1018
- }
1019
- : null;
1020
-
1021
- // Display status (visual mode if requested)
1022
- if (options.visual || options.json) {
1023
- if (options.json) {
1024
- // JSON output for automation
1025
- const result = {
1026
- command: 'status',
1027
- timestamp: new Date().toISOString(),
1028
- system: specs.length > 0 ? 'multi-spec' : 'single-spec',
1029
- specs:
1030
- specs.length > 0
1031
- ? {
1032
- count: specs.length,
1033
- active: specs.filter((s) => s.status === 'active').length,
1034
- draft: specs.filter((s) => s.status === 'draft').length,
1035
- completed: specs.filter((s) => s.status === 'completed').length,
1036
- list: specs.map((s) => ({
1037
- id: s.id,
1038
- type: s.type,
1039
- status: s.status,
1040
- title: s.title,
1041
- })),
1042
- }
1043
- : null,
1044
- legacySpec: spec
1045
- ? {
1046
- id: spec.id,
1047
- title: spec.title,
1048
- riskTier: spec.risk_tier,
1049
- mode: spec.mode,
1050
- specType: specSelection?.specType || null,
1051
- specPath: specSelection?.specPath || null,
1052
- acceptanceCriteria: spec.acceptance_criteria?.length || 0,
1053
- completedCriteria:
1054
- spec.acceptance_criteria?.filter((c) => c.completed).length || 0,
1055
- }
1056
- : null,
1057
- hooks: {
1058
- installed: hooks.installed,
1059
- count: hooks.count,
1060
- total: hooks.total,
1061
- active: hooks.active,
1062
- },
1063
- provenance: {
1064
- exists: provenance.exists,
1065
- count: provenance.count,
1066
- lastUpdate: provenance.lastUpdate,
1067
- },
1068
- waivers: {
1069
- exists: waivers.exists,
1070
- active: waivers.active,
1071
- expired: waivers.expired,
1072
- revoked: waivers.revoked,
1073
- total: waivers.total,
1074
- },
1075
- qualityGates: {
1076
- checked: gates.checked,
1077
- passed: gates.passed,
1078
- message: gates.message,
1079
- },
1080
- workingState: spec && spec.id ? (loadStateFromEvents(spec.id) || null) : null,
1081
- overallProgress: calculateOverallProgress({
1082
- spec,
1083
- specSelection,
1084
- specs,
1085
- hooks,
1086
- provenance,
1087
- waivers,
1088
- gates,
1089
- }),
1090
- };
1091
-
1092
- console.log(JSON.stringify(result, null, 2));
1093
- return result;
1094
- } else {
1095
- // Visual output
1096
- await displayVisualStatus(
1097
- {
1098
- spec,
1099
- specs,
1100
- hooks,
1101
- provenance,
1102
- waivers,
1103
- gates,
1104
- },
1105
- currentMode
1106
- );
1107
- }
1108
- } else {
1109
- // Original text-based output
1110
- displayStatus({
1111
- spec,
1112
- specSelection,
1113
- hooks,
1114
- provenance,
1115
- waivers,
1116
- gates,
1117
- });
1118
- }
1119
-
1120
- if (options.json) {
1121
- return {
1122
- command: 'status',
1123
- mode: 'json',
1124
- };
1125
- }
1126
-
1127
- const result = outputResult({
1128
- command: 'status',
1129
- mode: options.visual ? 'visual' : options.json ? 'json' : 'text',
1130
- system: specs.length > 0 ? 'multi-spec' : 'single-spec',
1131
- currentMode: currentMode,
1132
- specs: specs.length,
1133
- legacySpec: spec ? 'loaded' : 'not found',
1134
- hooks: modes.isFeatureEnabled('gitHooks', currentMode) ? hooks.installed : null,
1135
- provenance: modes.isFeatureEnabled('provenance', currentMode)
1136
- ? provenance.count || 0
1137
- : null,
1138
- waivers: modes.isFeatureEnabled('waivers', currentMode) ? waivers.active || 0 : null,
1139
- gates: modes.isFeatureEnabled('qualityGates', currentMode)
1140
- ? gates.passed
1141
- ? 'passed'
1142
- : 'failed'
1143
- : null,
1144
- overallProgress: calculateOverallProgress({
1145
- spec,
1146
- specs,
1147
- hooks,
1148
- provenance,
1149
- waivers,
1150
- gates,
1151
- currentMode,
1152
- }),
1153
- });
1154
-
1155
- return result;
1156
- },
1157
- 'status check',
1158
- !options.json
1159
- );
1160
- }
1161
-
1162
- module.exports = {
1163
- statusCommand,
1164
- loadWorkingSpec,
1165
- loadResolvedStatusSpec,
1166
- checkGitHooks,
1167
- loadProvenanceChain,
1168
- loadWaiverStatus,
1169
- checkQualityGates,
1170
- displayStatus,
1171
- generateSuggestions,
1172
- };