@paths.design/caws-cli 9.3.2 → 10.0.1

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 (273) hide show
  1. package/README.md +58 -27
  2. package/dist/commands/archive.js +67 -28
  3. package/dist/commands/burnup.js +20 -11
  4. package/dist/commands/diagnose.js +34 -22
  5. package/dist/commands/evaluate.js +27 -15
  6. package/dist/commands/gates.js +122 -0
  7. package/dist/commands/init.js +143 -15
  8. package/dist/commands/iterate.js +77 -4
  9. package/dist/commands/parallel.js +4 -0
  10. package/dist/commands/plan.js +9 -19
  11. package/dist/commands/provenance.js +53 -17
  12. package/dist/commands/quality-monitor.js +64 -45
  13. package/dist/commands/sidecar.js +71 -0
  14. package/dist/commands/specs.js +233 -44
  15. package/dist/commands/status.js +113 -9
  16. package/dist/commands/tutorial.js +10 -9
  17. package/dist/commands/validate.js +49 -6
  18. package/dist/commands/verify-acs.js +35 -78
  19. package/dist/commands/waivers.js +69 -12
  20. package/dist/commands/worktree.js +50 -25
  21. package/dist/error-handler.js +2 -13
  22. package/dist/gates/budget-limit.js +116 -0
  23. package/dist/gates/feedback.js +260 -0
  24. package/dist/gates/format.js +179 -0
  25. package/dist/gates/god-object.js +117 -0
  26. package/dist/gates/pipeline.js +167 -0
  27. package/dist/gates/scope-boundary.js +93 -0
  28. package/dist/gates/spec-completeness.js +102 -0
  29. package/dist/gates/todo-detection.js +205 -0
  30. package/dist/index.js +130 -151
  31. package/dist/parallel/parallel-manager.js +3 -3
  32. package/dist/policy/PolicyManager.js +42 -10
  33. package/dist/scaffold/claude-hooks.js +24 -1
  34. package/dist/scaffold/git-hooks.js +45 -102
  35. package/dist/scaffold/index.js +4 -3
  36. package/dist/session/session-manager.js +71 -14
  37. package/dist/sidecars/index.js +33 -0
  38. package/dist/sidecars/listeners.js +40 -0
  39. package/dist/sidecars/provenance-summary.js +238 -0
  40. package/dist/sidecars/quality-gaps.js +258 -0
  41. package/dist/sidecars/schema.js +149 -0
  42. package/dist/sidecars/spec-drift.js +151 -0
  43. package/dist/sidecars/waiver-draft.js +176 -0
  44. package/dist/templates/.caws/schemas/policy.schema.json +50 -0
  45. package/dist/templates/.caws/schemas/waivers.schema.json +30 -24
  46. package/dist/templates/.caws/schemas/working-spec.schema.json +51 -8
  47. package/dist/templates/.caws/schemas/worktrees.schema.json +3 -1
  48. package/dist/templates/.caws/templates/working-spec.template.yml +7 -3
  49. package/dist/templates/.claude/hooks/audit.sh +0 -0
  50. package/dist/templates/.claude/hooks/block-dangerous.sh +52 -11
  51. package/dist/templates/.claude/hooks/classify_command.py +592 -0
  52. package/dist/templates/.claude/hooks/doc-frontmatter-check.sh +173 -0
  53. package/dist/templates/.claude/hooks/quality-check.sh +23 -10
  54. package/dist/templates/.claude/hooks/scope-guard.sh +34 -32
  55. package/dist/templates/.claude/hooks/session-caws-status.sh +2 -2
  56. package/dist/templates/.claude/hooks/session-log.sh +76 -3
  57. package/dist/templates/.claude/hooks/stop-worktree-check.sh +1 -1
  58. package/dist/templates/.claude/hooks/test_classify_command.py +370 -0
  59. package/dist/templates/.claude/hooks/test_wrapper_smoke.sh +96 -0
  60. package/dist/templates/.claude/hooks/worktree-guard.sh +2 -2
  61. package/dist/templates/.claude/hooks/worktree-write-guard.sh +1 -1
  62. package/dist/templates/.claude/settings.json +26 -0
  63. package/dist/templates/.cursor/hooks/caws-quality-check.sh +4 -4
  64. package/dist/templates/.cursor/hooks/caws-scope-guard.sh +1 -1
  65. package/dist/templates/.cursor/hooks/session-log.sh +924 -0
  66. package/dist/templates/.cursor/hooks.json +25 -0
  67. package/dist/templates/.cursor/rules/02-quality-gates.mdc +3 -5
  68. package/dist/templates/.cursor/rules/10-documentation-quality-standards.mdc +6 -11
  69. package/dist/templates/.cursor/rules/11-scope-management-waivers.mdc +14 -18
  70. package/dist/templates/.cursor/rules/12-implementation-completeness.mdc +4 -4
  71. package/dist/templates/.cursor/rules/13-language-agnostic-standards.mdc +3 -13
  72. package/dist/templates/.github/copilot-instructions.md +5 -5
  73. package/dist/templates/.idea/runConfigurations/CAWS_Evaluate.xml +1 -1
  74. package/dist/templates/.junie/guidelines.md +2 -2
  75. package/dist/templates/.vscode/settings.json +3 -1
  76. package/dist/templates/.windsurf/rules/caws-quality-standards.md +2 -2
  77. package/dist/templates/.windsurf/workflows/caws-guided-development.md +3 -3
  78. package/dist/templates/CLAUDE.md +43 -8
  79. package/dist/templates/agents.md +29 -9
  80. package/dist/templates/docs/README.md +8 -7
  81. package/dist/templates/scripts/new_feature.sh +80 -0
  82. package/dist/test-analysis.js +43 -30
  83. package/dist/tool-loader.js +1 -1
  84. package/dist/utils/agent-session.js +202 -0
  85. package/dist/utils/detection.js +8 -2
  86. package/dist/utils/finalization.js +7 -6
  87. package/dist/utils/gitignore-updater.js +3 -0
  88. package/dist/utils/lifecycle-events.js +94 -0
  89. package/dist/utils/quality-gates-utils.js +29 -44
  90. package/dist/utils/schema-validator.js +42 -0
  91. package/dist/utils/spec-resolver.js +93 -21
  92. package/dist/utils/working-state.js +505 -0
  93. package/dist/validation/spec-validation.js +92 -22
  94. package/dist/waivers-manager.js +60 -6
  95. package/dist/worktree/worktree-manager.js +390 -93
  96. package/package.json +6 -6
  97. package/templates/.caws/schemas/policy.schema.json +50 -0
  98. package/templates/.caws/schemas/waivers.schema.json +30 -24
  99. package/templates/.caws/schemas/working-spec.schema.json +51 -8
  100. package/templates/.caws/schemas/worktrees.schema.json +3 -1
  101. package/templates/.caws/templates/working-spec.template.yml +7 -3
  102. package/templates/.claude/hooks/block-dangerous.sh +52 -11
  103. package/templates/.claude/hooks/classify_command.py +592 -0
  104. package/templates/.claude/hooks/doc-frontmatter-check.sh +173 -0
  105. package/templates/.claude/hooks/quality-check.sh +23 -10
  106. package/templates/.claude/hooks/scope-guard.sh +34 -32
  107. package/templates/.claude/hooks/session-caws-status.sh +2 -2
  108. package/templates/.claude/hooks/session-log.sh +76 -3
  109. package/templates/.claude/hooks/stop-worktree-check.sh +1 -1
  110. package/templates/.claude/hooks/test_classify_command.py +370 -0
  111. package/templates/.claude/hooks/test_wrapper_smoke.sh +96 -0
  112. package/templates/.claude/hooks/worktree-guard.sh +2 -2
  113. package/templates/.claude/hooks/worktree-write-guard.sh +1 -1
  114. package/templates/.claude/settings.json +26 -0
  115. package/templates/.cursor/hooks/caws-quality-check.sh +4 -4
  116. package/templates/.cursor/hooks/caws-scope-guard.sh +1 -1
  117. package/templates/.cursor/hooks/session-log.sh +924 -0
  118. package/templates/.cursor/hooks.json +25 -0
  119. package/templates/.cursor/rules/02-quality-gates.mdc +3 -5
  120. package/templates/.cursor/rules/10-documentation-quality-standards.mdc +6 -11
  121. package/templates/.cursor/rules/11-scope-management-waivers.mdc +14 -18
  122. package/templates/.cursor/rules/12-implementation-completeness.mdc +4 -4
  123. package/templates/.cursor/rules/13-language-agnostic-standards.mdc +3 -13
  124. package/templates/.github/copilot-instructions.md +5 -5
  125. package/templates/.idea/runConfigurations/CAWS_Evaluate.xml +1 -1
  126. package/templates/.junie/guidelines.md +2 -2
  127. package/templates/.vscode/settings.json +3 -1
  128. package/templates/.windsurf/rules/caws-quality-standards.md +2 -2
  129. package/templates/.windsurf/workflows/caws-guided-development.md +3 -3
  130. package/templates/CLAUDE.md +43 -8
  131. package/templates/{AGENTS.md → agents.md} +29 -9
  132. package/templates/docs/README.md +8 -7
  133. package/templates/scripts/new_feature.sh +80 -0
  134. package/dist/budget-derivation.d.ts +0 -74
  135. package/dist/budget-derivation.d.ts.map +0 -1
  136. package/dist/cicd-optimizer.d.ts +0 -142
  137. package/dist/cicd-optimizer.d.ts.map +0 -1
  138. package/dist/commands/archive.d.ts +0 -51
  139. package/dist/commands/archive.d.ts.map +0 -1
  140. package/dist/commands/burnup.d.ts +0 -6
  141. package/dist/commands/burnup.d.ts.map +0 -1
  142. package/dist/commands/diagnose.d.ts +0 -52
  143. package/dist/commands/diagnose.d.ts.map +0 -1
  144. package/dist/commands/evaluate.d.ts +0 -8
  145. package/dist/commands/evaluate.d.ts.map +0 -1
  146. package/dist/commands/init.d.ts +0 -5
  147. package/dist/commands/init.d.ts.map +0 -1
  148. package/dist/commands/iterate.d.ts +0 -8
  149. package/dist/commands/iterate.d.ts.map +0 -1
  150. package/dist/commands/mode.d.ts +0 -25
  151. package/dist/commands/mode.d.ts.map +0 -1
  152. package/dist/commands/parallel.d.ts +0 -7
  153. package/dist/commands/parallel.d.ts.map +0 -1
  154. package/dist/commands/plan.d.ts +0 -49
  155. package/dist/commands/plan.d.ts.map +0 -1
  156. package/dist/commands/provenance.d.ts +0 -32
  157. package/dist/commands/provenance.d.ts.map +0 -1
  158. package/dist/commands/quality-gates.d.ts +0 -6
  159. package/dist/commands/quality-gates.d.ts.map +0 -1
  160. package/dist/commands/quality-gates.js +0 -444
  161. package/dist/commands/quality-monitor.d.ts +0 -17
  162. package/dist/commands/quality-monitor.d.ts.map +0 -1
  163. package/dist/commands/session.d.ts +0 -7
  164. package/dist/commands/session.d.ts.map +0 -1
  165. package/dist/commands/specs.d.ts +0 -77
  166. package/dist/commands/specs.d.ts.map +0 -1
  167. package/dist/commands/status.d.ts +0 -44
  168. package/dist/commands/status.d.ts.map +0 -1
  169. package/dist/commands/templates.d.ts +0 -74
  170. package/dist/commands/templates.d.ts.map +0 -1
  171. package/dist/commands/tool.d.ts +0 -13
  172. package/dist/commands/tool.d.ts.map +0 -1
  173. package/dist/commands/troubleshoot.d.ts +0 -8
  174. package/dist/commands/troubleshoot.d.ts.map +0 -1
  175. package/dist/commands/troubleshoot.js +0 -104
  176. package/dist/commands/tutorial.d.ts +0 -55
  177. package/dist/commands/tutorial.d.ts.map +0 -1
  178. package/dist/commands/validate.d.ts +0 -15
  179. package/dist/commands/validate.d.ts.map +0 -1
  180. package/dist/commands/waivers.d.ts +0 -8
  181. package/dist/commands/waivers.d.ts.map +0 -1
  182. package/dist/commands/workflow.d.ts +0 -85
  183. package/dist/commands/workflow.d.ts.map +0 -1
  184. package/dist/commands/worktree.d.ts +0 -7
  185. package/dist/commands/worktree.d.ts.map +0 -1
  186. package/dist/config/index.d.ts +0 -29
  187. package/dist/config/index.d.ts.map +0 -1
  188. package/dist/config/lite-scope.d.ts +0 -33
  189. package/dist/config/lite-scope.d.ts.map +0 -1
  190. package/dist/config/modes.d.ts +0 -264
  191. package/dist/config/modes.d.ts.map +0 -1
  192. package/dist/constants/spec-types.d.ts +0 -93
  193. package/dist/constants/spec-types.d.ts.map +0 -1
  194. package/dist/error-handler.d.ts +0 -151
  195. package/dist/error-handler.d.ts.map +0 -1
  196. package/dist/generators/jest-config-generator.d.ts +0 -32
  197. package/dist/generators/jest-config-generator.d.ts.map +0 -1
  198. package/dist/generators/jest-config.d.ts +0 -32
  199. package/dist/generators/jest-config.d.ts.map +0 -1
  200. package/dist/generators/jest-config.js +0 -242
  201. package/dist/generators/working-spec.d.ts +0 -13
  202. package/dist/generators/working-spec.d.ts.map +0 -1
  203. package/dist/index-new.d.ts +0 -5
  204. package/dist/index-new.d.ts.map +0 -1
  205. package/dist/index-new.js +0 -317
  206. package/dist/index.d.ts +0 -5
  207. package/dist/index.d.ts.map +0 -1
  208. package/dist/index.js.backup +0 -4711
  209. package/dist/minimal-cli.d.ts +0 -3
  210. package/dist/minimal-cli.d.ts.map +0 -1
  211. package/dist/parallel/parallel-manager.d.ts +0 -67
  212. package/dist/parallel/parallel-manager.d.ts.map +0 -1
  213. package/dist/policy/PolicyManager.d.ts +0 -104
  214. package/dist/policy/PolicyManager.d.ts.map +0 -1
  215. package/dist/scaffold/claude-hooks.d.ts +0 -28
  216. package/dist/scaffold/claude-hooks.d.ts.map +0 -1
  217. package/dist/scaffold/cursor-hooks.d.ts +0 -7
  218. package/dist/scaffold/cursor-hooks.d.ts.map +0 -1
  219. package/dist/scaffold/git-hooks.d.ts +0 -38
  220. package/dist/scaffold/git-hooks.d.ts.map +0 -1
  221. package/dist/scaffold/index.d.ts +0 -17
  222. package/dist/scaffold/index.d.ts.map +0 -1
  223. package/dist/session/session-manager.d.ts +0 -94
  224. package/dist/session/session-manager.d.ts.map +0 -1
  225. package/dist/spec/SpecFileManager.d.ts +0 -146
  226. package/dist/spec/SpecFileManager.d.ts.map +0 -1
  227. package/dist/templates/.cursor/hooks/caws-tool-validation.sh +0 -121
  228. package/dist/templates/.github/copilot/instructions.md +0 -311
  229. package/dist/test-analysis.d.ts +0 -231
  230. package/dist/test-analysis.d.ts.map +0 -1
  231. package/dist/tool-interface.d.ts +0 -236
  232. package/dist/tool-interface.d.ts.map +0 -1
  233. package/dist/tool-loader.d.ts +0 -77
  234. package/dist/tool-loader.d.ts.map +0 -1
  235. package/dist/tool-validator.d.ts +0 -72
  236. package/dist/tool-validator.d.ts.map +0 -1
  237. package/dist/utils/async-utils.d.ts +0 -73
  238. package/dist/utils/async-utils.d.ts.map +0 -1
  239. package/dist/utils/command-wrapper.d.ts +0 -66
  240. package/dist/utils/command-wrapper.d.ts.map +0 -1
  241. package/dist/utils/detection.d.ts +0 -14
  242. package/dist/utils/detection.d.ts.map +0 -1
  243. package/dist/utils/error-categories.d.ts +0 -52
  244. package/dist/utils/error-categories.d.ts.map +0 -1
  245. package/dist/utils/finalization.d.ts +0 -17
  246. package/dist/utils/finalization.d.ts.map +0 -1
  247. package/dist/utils/git-lock.d.ts +0 -13
  248. package/dist/utils/git-lock.d.ts.map +0 -1
  249. package/dist/utils/gitignore-updater.d.ts +0 -39
  250. package/dist/utils/gitignore-updater.d.ts.map +0 -1
  251. package/dist/utils/ide-detection.d.ts +0 -89
  252. package/dist/utils/ide-detection.d.ts.map +0 -1
  253. package/dist/utils/project-analysis.d.ts +0 -34
  254. package/dist/utils/project-analysis.d.ts.map +0 -1
  255. package/dist/utils/promise-utils.d.ts +0 -30
  256. package/dist/utils/promise-utils.d.ts.map +0 -1
  257. package/dist/utils/quality-gates-utils.d.ts +0 -49
  258. package/dist/utils/quality-gates-utils.d.ts.map +0 -1
  259. package/dist/utils/quality-gates.d.ts +0 -49
  260. package/dist/utils/quality-gates.d.ts.map +0 -1
  261. package/dist/utils/quality-gates.js +0 -402
  262. package/dist/utils/spec-resolver.d.ts +0 -80
  263. package/dist/utils/spec-resolver.d.ts.map +0 -1
  264. package/dist/utils/typescript-detector.d.ts +0 -66
  265. package/dist/utils/typescript-detector.d.ts.map +0 -1
  266. package/dist/utils/yaml-validation.d.ts +0 -32
  267. package/dist/utils/yaml-validation.d.ts.map +0 -1
  268. package/dist/validation/spec-validation.d.ts +0 -43
  269. package/dist/validation/spec-validation.d.ts.map +0 -1
  270. package/dist/waivers-manager.d.ts +0 -167
  271. package/dist/waivers-manager.d.ts.map +0 -1
  272. package/dist/worktree/worktree-manager.d.ts +0 -54
  273. package/dist/worktree/worktree-manager.d.ts.map +0 -1
@@ -1,444 +0,0 @@
1
- /**
2
- * CAWS Quality Gates Command
3
- *
4
- * Integrates the hardened quality gates system into the CAWS CLI.
5
- * Provides access to enterprise-grade quality enforcement with:
6
- * - Timeout protection and concurrent execution
7
- * - Comprehensive gate coverage (naming, duplication, god objects, documentation)
8
- * - JSON output and CI/CD integration
9
- * - Exception framework with audit trails
10
- *
11
- * @author @darianrosebrook
12
- */
13
-
14
- const fs = require('fs');
15
- const path = require('path');
16
- const { spawn } = require('child_process');
17
- const { commandWrapper, Output } = require('../utils/command-wrapper');
18
- const { withTimeout } = require('../utils/async-utils');
19
-
20
- // Quality gates runner implementation - delegates to external package
21
-
22
- /**
23
- * Run comprehensive quality gates on staged files
24
- * @param {Object} options - Command options
25
- */
26
- async function qualityGatesCommand(options = {}) {
27
- return commandWrapper(
28
- async () => {
29
- Output.section('CAWS Quality Gates - Enterprise Code Quality Enforcement');
30
-
31
- const projectRoot = process.cwd();
32
- let qualityGatesRunner = null;
33
-
34
- // Fallback chain for finding quality gates runner:
35
- // 1. Check monorepo structure (current behavior)
36
- // 2. Check node_modules for @paths.design/quality-gates package
37
- // 3. Check project-local scripts
38
- // 4. Provide helpful error with alternatives
39
-
40
- // Option 1: Check monorepo structure
41
- const cliSrcDir = path.dirname(__filename);
42
- const cliSrcRoot = path.dirname(cliSrcDir);
43
- const cliPackageDir = path.dirname(cliSrcRoot);
44
- const packagesDir = path.dirname(cliPackageDir);
45
- const monorepoRunner = path.join(packagesDir, 'quality-gates', 'run-quality-gates.mjs');
46
-
47
- // Option 2: Check globally installed CLI for bundled quality gates
48
- let globalCliPath = null;
49
- try {
50
- const { execSync } = require('child_process');
51
- const whichCaws = execSync('which caws', { encoding: 'utf8', stdio: 'pipe' }).trim();
52
- if (whichCaws) {
53
- // Resolve symlink to actual path
54
- const realPath = fs.realpathSync(whichCaws);
55
- const globalCliDir = path.dirname(realPath);
56
- // Check for bundled quality gates in global CLI installation
57
- const possibleBundledPaths = [
58
- path.join(
59
- globalCliDir,
60
- '..',
61
- 'lib',
62
- 'node_modules',
63
- '@paths.design',
64
- 'caws-cli',
65
- 'node_modules',
66
- '@paths.design',
67
- 'quality-gates',
68
- 'run-quality-gates.mjs'
69
- ),
70
- path.join(
71
- globalCliDir,
72
- '..',
73
- 'lib',
74
- 'node_modules',
75
- '@paths.design',
76
- 'quality-gates',
77
- 'run-quality-gates.mjs'
78
- ),
79
- path.join(
80
- globalCliDir,
81
- '..',
82
- 'node_modules',
83
- '@paths.design',
84
- 'quality-gates',
85
- 'run-quality-gates.mjs'
86
- ),
87
- ];
88
- for (const bundledPath of possibleBundledPaths) {
89
- if (fs.existsSync(bundledPath)) {
90
- globalCliPath = bundledPath;
91
- break;
92
- }
93
- }
94
- }
95
- } catch (e) {
96
- // Ignore errors finding global CLI
97
- }
98
-
99
- // Option 3: Check VS Code extension bundled (if running from extension context)
100
- const vscodeExtensionPath =
101
- process.env.VSCODE_EXTENSION_PATH || process.env.VSCODE_EXTENSION_DIR;
102
- const bundledRunner = vscodeExtensionPath
103
- ? path.join(vscodeExtensionPath, 'bundled', 'quality-gates', 'run-quality-gates.mjs')
104
- : null;
105
-
106
- // Option 4: Check node_modules for quality-gates package (prioritize published package)
107
- const nodeModulesPaths = [
108
- // Published npm package (priority)
109
- path.join(
110
- projectRoot,
111
- 'node_modules',
112
- '@paths.design',
113
- 'quality-gates',
114
- 'run-quality-gates.mjs'
115
- ),
116
- // Legacy monorepo local copy (fallback)
117
- path.join(projectRoot, 'node_modules', '@caws', 'quality-gates', 'run-quality-gates.mjs'),
118
- path.join(projectRoot, 'node_modules', 'quality-gates', 'run-quality-gates.mjs'),
119
- ];
120
-
121
- // Try all possible paths in order
122
- if (fs.existsSync(monorepoRunner)) {
123
- qualityGatesRunner = monorepoRunner;
124
- } else if (globalCliPath) {
125
- qualityGatesRunner = globalCliPath;
126
- } else if (bundledRunner && fs.existsSync(bundledRunner)) {
127
- qualityGatesRunner = bundledRunner;
128
- } else {
129
- for (const nmPath of nodeModulesPaths) {
130
- if (fs.existsSync(nmPath)) {
131
- qualityGatesRunner = nmPath;
132
- break;
133
- }
134
- }
135
- }
136
-
137
- // Option 4: Check for project-local Python scripts
138
- if (!qualityGatesRunner) {
139
- const pythonScript = path.join(projectRoot, 'scripts', 'simple_gates.py');
140
- const makefile = path.join(projectRoot, 'Makefile');
141
-
142
- if (fs.existsSync(pythonScript)) {
143
- Output.warning(
144
- 'Node.js quality gates runner not found',
145
- 'Found Python script - falling back to Python implementation'
146
- );
147
- Output.info(`Running: python3 ${pythonScript}`);
148
- Output.info(
149
- 'Tip: Install quality gates package for better integration: npm install -g @paths.design/quality-gates'
150
- );
151
-
152
- // Execute Python script instead
153
- const { execSync } = require('child_process');
154
- const pythonArgs = ['all', '--tier', '2', '--profile', 'backend-api'];
155
- if (options.ci) {
156
- pythonArgs.push('--ci');
157
- }
158
- if (options.json) {
159
- pythonArgs.push('--json');
160
- }
161
-
162
- execSync(`python3 ${pythonScript} ${pythonArgs.join(' ')}`, {
163
- stdio: 'inherit',
164
- cwd: projectRoot,
165
- });
166
- Output.success('Quality gates completed successfully');
167
- return;
168
- } else if (fs.existsSync(makefile)) {
169
- Output.warning(
170
- 'Node.js quality gates runner not found',
171
- 'Found Makefile - falling back to Makefile target'
172
- );
173
- Output.info('Running: make caws-gates');
174
- Output.info(
175
- 'Tip: Install quality gates package for better integration: npm install -g @paths.design/quality-gates'
176
- );
177
-
178
- // Execute Makefile target
179
- const { execSync } = require('child_process');
180
- execSync('make caws-gates', {
181
- stdio: 'inherit',
182
- cwd: projectRoot,
183
- });
184
- Output.success('Quality gates completed successfully');
185
- return;
186
- }
187
- }
188
-
189
- // Option 5: Try npx (no installation required) - works if Node.js is available
190
- if (!qualityGatesRunner) {
191
- try {
192
- const { execSync } = require('child_process');
193
- // Check if npx is available
194
- execSync('command -v npx', { encoding: 'utf8', stdio: 'ignore' });
195
-
196
- Output.info('Using npx to run quality gates (no installation required)...');
197
-
198
- // Build npx command - the package exposes 'caws-quality-gates' bin command
199
- // Use npx to download and run without installing
200
- const npxArgs = ['npx', '--yes', '@paths.design/quality-gates'];
201
-
202
- // Map CLI options to runner options
203
- if (options.ci) {
204
- npxArgs.push('--ci');
205
- }
206
- if (options.json) {
207
- npxArgs.push('--json');
208
- }
209
- if (options.gates && options.gates.trim()) {
210
- npxArgs.push('--gates', options.gates.trim());
211
- }
212
- if (options.fix) {
213
- npxArgs.push('--fix');
214
- }
215
- // Handle context options: --all-files takes precedence, then --context
216
- if (options.allFiles) {
217
- npxArgs.push('--context=ci');
218
- } else if (options.context && options.context !== 'commit') {
219
- npxArgs.push(`--context=${options.context}`);
220
- }
221
-
222
- Output.progress('Executing quality gates via npx...');
223
- Output.info(`Command: ${npxArgs.join(' ')}`);
224
-
225
- // Execute via npx
226
- const { execSync: execSyncNpx } = require('child_process');
227
- execSyncNpx(npxArgs.join(' '), {
228
- stdio: 'inherit',
229
- cwd: projectRoot,
230
- env: {
231
- ...process.env,
232
- CAWS_CLI_INTEGRATION: 'true',
233
- CAWS_CLI_VERSION: require(path.join(cliPackageDir, 'package.json')).version,
234
- },
235
- });
236
-
237
- Output.success('Quality gates completed successfully');
238
- return;
239
- } catch (npxError) {
240
- // npx not available or failed - continue to error message
241
- }
242
- }
243
-
244
- // If still no runner found, provide helpful error with language-agnostic suggestions
245
- if (!qualityGatesRunner) {
246
- // Check if Node.js/npx is available (language-agnostic check)
247
- let hasNodeJs = false;
248
- try {
249
- const { execSync } = require('child_process');
250
- execSync('command -v node', { encoding: 'utf8', stdio: 'ignore' });
251
- execSync('command -v npx', { encoding: 'utf8', stdio: 'ignore' });
252
- hasNodeJs = true;
253
- } catch (e) {
254
- // Node.js/npx not available
255
- }
256
-
257
- const suggestions = [];
258
-
259
- if (hasNodeJs) {
260
- // Node.js available - suggest npx (works for any language, no installation)
261
- suggestions.push(
262
- 'Use npx (no installation required): npx --yes @paths.design/quality-gates'
263
- );
264
- suggestions.push('Install globally: npm install -g @paths.design/quality-gates');
265
- suggestions.push('Install locally: npm install --save-dev @paths.design/quality-gates');
266
- } else {
267
- // Node.js not available - suggest installation or alternatives
268
- suggestions.push('Install Node.js to use quality gates: https://nodejs.org/');
269
- suggestions.push(
270
- 'Then use: npx --yes @paths.design/quality-gates (no installation required)'
271
- );
272
- suggestions.push('Or install globally: npm install -g @paths.design/quality-gates');
273
- }
274
-
275
- // Language-agnostic fallback options (if they exist)
276
- const pythonScript = path.join(projectRoot, 'scripts', 'simple_gates.py');
277
- const makefile = path.join(projectRoot, 'Makefile');
278
-
279
- if (fs.existsSync(pythonScript)) {
280
- suggestions.push(`Use project script: python3 ${pythonScript} all --tier 2`);
281
- }
282
- if (fs.existsSync(makefile)) {
283
- suggestions.push('Use Makefile target: make caws-gates');
284
- }
285
-
286
- suggestions.push('Run from CAWS monorepo root (if developing CAWS itself)');
287
-
288
- throw new Error(
289
- 'Quality gates runner not found.\n\n' +
290
- 'Expected locations:\n' +
291
- ` - Monorepo: ${monorepoRunner}\n` +
292
- ` - npm package: ${path.join(projectRoot, 'node_modules', '@paths.design', 'quality-gates', 'run-quality-gates.mjs')}\n` +
293
- ` - Python script: ${path.join(projectRoot, 'scripts', 'simple_gates.py')}\n\n` +
294
- 'Available options:\n' +
295
- suggestions.map((s, i) => ` ${i + 1}. ${s}`).join('\n')
296
- );
297
- }
298
-
299
- // Build command arguments
300
- const args = ['node', qualityGatesRunner];
301
-
302
- // Map CLI options to runner options
303
- if (options.ci) {
304
- args.push('--ci');
305
- }
306
-
307
- if (options.json) {
308
- args.push('--json');
309
- }
310
-
311
- if (options.gates && options.gates.trim()) {
312
- args.push('--gates', options.gates.trim());
313
- }
314
-
315
- if (options.fix) {
316
- args.push('--fix');
317
- }
318
-
319
- // Handle context options: --all-files takes precedence, then --context
320
- if (options.allFiles) {
321
- args.push('--context=ci');
322
- } else if (options.context) {
323
- args.push(`--context=${options.context}`);
324
- }
325
-
326
- // Add CAWS-specific environment variables for integration
327
- const env = {
328
- ...process.env,
329
- CAWS_CLI_INTEGRATION: 'true',
330
- CAWS_CLI_VERSION: require(path.join(cliPackageDir, 'package.json')).version,
331
- };
332
-
333
- // Set GitHub Actions summary if available
334
- if (process.env.GITHUB_STEP_SUMMARY) {
335
- env.GITHUB_STEP_SUMMARY = process.env.GITHUB_STEP_SUMMARY;
336
- }
337
-
338
- Output.progress('Executing quality gates runner...');
339
- Output.info(`Command: ${args.join(' ')}`);
340
-
341
- // Execute the quality gates runner with timeout
342
- // CRITICAL: Must run from projectRoot (user's current directory) so that
343
- // git commands resolve correctly to the user's repository, not the CLI installation
344
- const child = spawn(args[0], args.slice(1), {
345
- stdio: 'inherit',
346
- cwd: projectRoot,
347
- env: env,
348
- });
349
-
350
- // Wait for completion with timeout (30 minutes default for CI)
351
- const timeoutMs = options.timeout || (options.ci ? 30 * 60 * 1000 : 10 * 60 * 1000);
352
-
353
- const completionPromise = new Promise((resolve, reject) => {
354
- let resolved = false;
355
-
356
- // Handle process termination signals
357
- const signalHandlers = {
358
- SIGINT: () => {
359
- if (!resolved && !child.killed && child.pid) {
360
- child.kill('SIGINT');
361
- }
362
- },
363
- SIGTERM: () => {
364
- if (!resolved && !child.killed && child.pid) {
365
- child.kill('SIGTERM');
366
- }
367
- },
368
- };
369
-
370
- process.on('SIGINT', signalHandlers.SIGINT);
371
- process.on('SIGTERM', signalHandlers.SIGTERM);
372
-
373
- const cleanup = () => {
374
- if (resolved) return;
375
- resolved = true;
376
-
377
- // Remove signal handlers
378
- try {
379
- process.removeListener('SIGINT', signalHandlers.SIGINT);
380
- process.removeListener('SIGTERM', signalHandlers.SIGTERM);
381
- } catch (e) {
382
- // Ignore errors removing listeners
383
- }
384
-
385
- // Remove event listeners to prevent memory leaks
386
- try {
387
- child.removeAllListeners();
388
- } catch (e) {
389
- // Ignore errors removing listeners
390
- }
391
- };
392
-
393
- child.on('close', (code) => {
394
- cleanup();
395
- if (code === 0) {
396
- resolve();
397
- } else {
398
- reject(new Error(`Quality gates failed with exit code: ${code}`));
399
- }
400
- });
401
-
402
- child.on('error', (error) => {
403
- cleanup();
404
- reject(new Error(`Failed to execute quality gates runner: ${error.message}`));
405
- });
406
- });
407
-
408
- try {
409
- await withTimeout(completionPromise, timeoutMs, 'Quality gates execution timed out');
410
- Output.success('Quality gates completed successfully');
411
- } catch (error) {
412
- // Ensure child process is killed on timeout or error
413
- try {
414
- if (!child.killed && child.pid) {
415
- child.kill('SIGTERM');
416
- // Give it a moment to exit gracefully, then force kill
417
- // eslint-disable-next-line no-undef
418
- setTimeout(() => {
419
- if (!child.killed && child.pid) {
420
- try {
421
- child.kill('SIGKILL');
422
- } catch (e) {
423
- // Ignore errors killing process
424
- }
425
- }
426
- }, 1000);
427
- }
428
- } catch (killError) {
429
- // Ignore errors killing process
430
- }
431
- throw error;
432
- }
433
- },
434
- {
435
- commandName: 'quality-gates',
436
- context: { options },
437
- exitOnError: !options.ci, // Don't exit in CI mode if we want to handle errors
438
- }
439
- );
440
- }
441
-
442
- module.exports = {
443
- qualityGatesCommand,
444
- };
@@ -1,17 +0,0 @@
1
- /**
2
- * Quality monitor command handler
3
- *
4
- * @param {string} action - Type of action to monitor
5
- * @param {object} options - Command options
6
- */
7
- export function qualityMonitorCommand(action: string, options?: object): Promise<void>;
8
- /**
9
- * Analyze quality impact of an action
10
- *
11
- * @param {string} action - Type of action (file_saved, code_edited, test_run)
12
- * @param {array} files - Files affected by the action
13
- * @param {object} context - Additional context information
14
- * @returns {object} Quality analysis
15
- */
16
- export function analyzeQualityImpact(action: string, files?: any[], context?: object): object;
17
- //# sourceMappingURL=quality-monitor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quality-monitor.d.ts","sourceRoot":"","sources":["../../src/commands/quality-monitor.js"],"names":[],"mappings":"AAoIA;;;;;GAKG;AACH,8CAHW,MAAM,YACN,MAAM,iBA2HhB;AArPD;;;;;;;GAOG;AACH,6CALW,MAAM,2BAEN,MAAM,GACJ,MAAM,CA8GlB"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Handle session subcommands
3
- * @param {string} subcommand - Subcommand name
4
- * @param {Object} options - Command options
5
- */
6
- export function sessionCommand(subcommand: string, options?: any): Promise<void>;
7
- //# sourceMappingURL=session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/commands/session.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,2CAHW,MAAM,gCA2BhB"}
@@ -1,77 +0,0 @@
1
- /**
2
- * Specs command handler
3
- * @param {string} action - Action to perform (list, create, show, update, delete, conflicts, migrate)
4
- * @param {Object} options - Command options
5
- */
6
- export function specsCommand(action: string, options?: any): Promise<any>;
7
- /**
8
- * Load specs registry
9
- * @returns {Promise<Object>} Registry data
10
- */
11
- export function loadSpecsRegistry(): Promise<any>;
12
- /**
13
- * Save specs registry
14
- * @param {Object} registry - Registry data
15
- * @returns {Promise<void>}
16
- */
17
- export function saveSpecsRegistry(registry: any): Promise<void>;
18
- /**
19
- * List all spec files in the specs directory
20
- * @returns {Promise<Array>} Array of spec file info
21
- */
22
- export function listSpecFiles(): Promise<any[]>;
23
- /**
24
- * Create a new spec file
25
- * @param {string} id - Spec identifier
26
- * @param {Object} options - Creation options
27
- * @returns {Promise<Object>} Created spec info
28
- */
29
- export function createSpec(id: string, options?: any): Promise<any>;
30
- /**
31
- * Load a specific spec file
32
- * @param {string} id - Spec identifier
33
- * @returns {Promise<Object|null>} Spec data or null
34
- */
35
- export function loadSpec(id: string): Promise<any | null>;
36
- /**
37
- * Update a spec file
38
- * @param {string} id - Spec identifier
39
- * @param {Object} updates - Updates to apply
40
- * @returns {Promise<boolean>} Success status
41
- */
42
- export function updateSpec(id: string, updates?: any): Promise<boolean>;
43
- /**
44
- * Delete a spec file
45
- * @param {string} id - Spec identifier
46
- * @returns {Promise<boolean>} Success status
47
- */
48
- export function deleteSpec(id: string): Promise<boolean>;
49
- /**
50
- * Close a spec (sets status to 'closed', removing scope enforcement).
51
- * @param {string} id - Spec identifier
52
- * @returns {Promise<boolean>} Success status
53
- */
54
- export function closeSpec(id: string): Promise<boolean>;
55
- /**
56
- * Display specs in a formatted table
57
- * @param {Array} specs - Array of spec objects
58
- */
59
- export function displaySpecsTable(specs: any[]): void;
60
- /**
61
- * Display detailed spec information
62
- * @param {Object} spec - Spec object
63
- */
64
- export function displaySpecDetails(spec: any): void;
65
- /**
66
- * Ask user how to resolve spec creation conflicts
67
- * @returns {Promise<string>} User's choice: 'cancel', 'rename', 'merge', 'override'
68
- */
69
- export function askConflictResolution(): Promise<string>;
70
- /**
71
- * Specs directory structure
72
- */
73
- export const SPECS_DIR: ".caws/specs";
74
- export const SPECS_REGISTRY: ".caws/specs/registry.json";
75
- import { SPEC_TYPES } from "../constants/spec-types";
76
- export { SPEC_TYPES };
77
- //# sourceMappingURL=specs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../src/commands/specs.js"],"names":[],"mappings":"AAq2BA;;;;GAIG;AACH,qCAHW,MAAM,+BAiNhB;AAjiCD;;;GAGG;AACH,qCAFa,OAAO,KAAQ,CAqB3B;AAED;;;;GAIG;AACH,kDAFa,OAAO,CAAC,IAAI,CAAC,CAMzB;AAED;;;GAGG;AACH,iCAFa,OAAO,OAAO,CAmC1B;AAED;;;;;GAKG;AACH,+BAJW,MAAM,kBAEJ,OAAO,KAAQ,CAkO3B;AAED;;;;GAIG;AACH,6BAHW,MAAM,GACJ,OAAO,CAAC,MAAO,IAAI,CAAC,CAiBhC;AAED;;;;;GAKG;AACH,+BAJW,MAAM,kBAEJ,OAAO,CAAC,OAAO,CAAC,CAuC5B;AAiID;;;;GAIG;AACH,+BAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAmB5B;AAED;;;;GAIG;AACH,8BAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAmB5B;AAED;;;GAGG;AACH,sDA2CC;AAED;;;GAGG;AACH,oDAoCC;AAuKD;;;GAGG;AACH,yCAFa,OAAO,CAAC,MAAM,CAAC,CAqC3B;AAl1BD;;GAEG;AACH,wBAAkB,aAAa,CAAC;AAChC,6BAAuB,2BAA2B,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Status command handler
3
- * @param {Object} options - Command options
4
- */
5
- export function statusCommand(options?: any): Promise<any>;
6
- /**
7
- * Load working specification (legacy single file approach)
8
- * @param {string} specPath - Path to working spec
9
- * @returns {Promise<Object|null>} Parsed spec or null
10
- */
11
- export function loadWorkingSpec(specPath?: string): Promise<any | null>;
12
- /**
13
- * Check Git hooks status
14
- * @returns {Promise<Object>} Hooks status
15
- */
16
- export function checkGitHooks(): Promise<any>;
17
- /**
18
- * Load provenance chain
19
- * @returns {Promise<Object>} Provenance status
20
- */
21
- export function loadProvenanceChain(): Promise<any>;
22
- /**
23
- * Load waiver status
24
- * @returns {Promise<Object>} Waiver status
25
- */
26
- export function loadWaiverStatus(): Promise<any>;
27
- /**
28
- * Check quality gates status (simplified)
29
- * @returns {Promise<Object>} Quality gates status
30
- */
31
- export function checkQualityGates(): Promise<any>;
32
- /**
33
- * Display project status
34
- * @param {Object} data - Status data
35
- */
36
- export function displayStatus(data: any): void;
37
- /**
38
- * Generate actionable suggestions based on status and mode
39
- * @param {Object} data - Status data
40
- * @param {string} currentMode - Current CAWS mode
41
- * @returns {string[]} Array of suggestions
42
- */
43
- export function generateSuggestions(data: any, currentMode: string): string[];
44
- //# sourceMappingURL=status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.js"],"names":[],"mappings":"AAo3BA;;;GAGG;AACH,2DA+IC;AAz/BD;;;;GAIG;AACH,2CAHW,MAAM,GACJ,OAAO,CAAC,MAAO,IAAI,CAAC,CAahC;AAgBD;;;GAGG;AACH,iCAFa,OAAO,KAAQ,CAgC3B;AAED;;;GAGG;AACH,uCAFa,OAAO,KAAQ,CA+B3B;AAED;;;GAGG;AACH,oCAFa,OAAO,KAAQ,CA0D3B;AAED;;;GAGG;AACH,qCAFa,OAAO,KAAQ,CAO3B;AA8HD;;;GAGG;AACH,+CAgGC;AAED;;;;;GAKG;AACH,4DAHW,MAAM,GACJ,MAAM,EAAE,CAoCpB"}
@@ -1,74 +0,0 @@
1
- /**
2
- * Templates command handler
3
- * @param {string} subcommand - Subcommand (list, info)
4
- * @param {Object} options - Command options
5
- */
6
- export function templatesCommand(subcommand?: string, options?: any): Promise<void>;
7
- /**
8
- * List all available templates
9
- */
10
- export function listTemplates(): void;
11
- /**
12
- * Show detailed template information
13
- * @param {string} templateId - Template ID
14
- */
15
- export function showTemplateInfo(templateId: string): void;
16
- /**
17
- * Check which templates actually exist
18
- * @returns {Object} Available templates
19
- */
20
- export function getAvailableTemplates(): any;
21
- /**
22
- * Built-in template definitions
23
- */
24
- export const BUILTIN_TEMPLATES: {
25
- 'typescript-library': {
26
- name: string;
27
- description: string;
28
- category: string;
29
- tier: number;
30
- features: string[];
31
- path: string;
32
- };
33
- 'typescript-api': {
34
- name: string;
35
- description: string;
36
- category: string;
37
- tier: number;
38
- features: string[];
39
- path: string;
40
- };
41
- 'typescript-monorepo': {
42
- name: string;
43
- description: string;
44
- category: string;
45
- tier: number;
46
- features: string[];
47
- path: string;
48
- };
49
- 'javascript-package': {
50
- name: string;
51
- description: string;
52
- category: string;
53
- tier: number;
54
- features: string[];
55
- path: string;
56
- };
57
- 'react-component-lib': {
58
- name: string;
59
- description: string;
60
- category: string;
61
- tier: number;
62
- features: string[];
63
- path: string;
64
- };
65
- 'vscode-extension': {
66
- name: string;
67
- description: string;
68
- category: string;
69
- tier: number;
70
- features: string[];
71
- path: string;
72
- };
73
- };
74
- //# sourceMappingURL=templates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/commands/templates.js"],"names":[],"mappings":"AA8MA;;;;GAIG;AACH,8CAHW,MAAM,gCA4BhB;AAvHD;;GAEG;AACH,sCAuCC;AAED;;;GAGG;AACH,6CAFW,MAAM,QAyChB;AA9GD;;;GAGG;AACH,6CAiBC;AAxGD;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDE"}