@paths.design/caws-cli 8.0.0 → 8.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 (149) hide show
  1. package/dist/budget-derivation.d.ts +74 -0
  2. package/dist/budget-derivation.d.ts.map +1 -0
  3. package/dist/cicd-optimizer.d.ts +142 -0
  4. package/dist/cicd-optimizer.d.ts.map +1 -0
  5. package/dist/commands/archive.d.ts +51 -0
  6. package/dist/commands/archive.d.ts.map +1 -0
  7. package/dist/commands/archive.js +114 -6
  8. package/dist/commands/burnup.d.ts +6 -0
  9. package/dist/commands/burnup.d.ts.map +1 -0
  10. package/dist/commands/burnup.js +109 -10
  11. package/dist/commands/diagnose.d.ts +52 -0
  12. package/dist/commands/diagnose.d.ts.map +1 -0
  13. package/dist/commands/diagnose.js +1 -1
  14. package/dist/commands/evaluate.d.ts +8 -0
  15. package/dist/commands/evaluate.d.ts.map +1 -0
  16. package/dist/commands/init.d.ts +5 -0
  17. package/dist/commands/init.d.ts.map +1 -0
  18. package/dist/commands/iterate.d.ts +8 -0
  19. package/dist/commands/iterate.d.ts.map +1 -0
  20. package/dist/commands/mode.d.ts +24 -0
  21. package/dist/commands/mode.d.ts.map +1 -0
  22. package/dist/commands/mode.js +24 -14
  23. package/dist/commands/plan.d.ts +49 -0
  24. package/dist/commands/plan.d.ts.map +1 -0
  25. package/dist/commands/provenance.d.ts +32 -0
  26. package/dist/commands/provenance.d.ts.map +1 -0
  27. package/dist/commands/provenance.js +216 -93
  28. package/dist/commands/quality-gates.d.ts +6 -0
  29. package/dist/commands/quality-gates.d.ts.map +1 -0
  30. package/dist/commands/quality-gates.js +82 -3
  31. package/dist/commands/quality-monitor.d.ts +17 -0
  32. package/dist/commands/quality-monitor.d.ts.map +1 -0
  33. package/dist/commands/specs.d.ts +71 -0
  34. package/dist/commands/specs.d.ts.map +1 -0
  35. package/dist/commands/specs.js +184 -6
  36. package/dist/commands/status.d.ts +44 -0
  37. package/dist/commands/status.d.ts.map +1 -0
  38. package/dist/commands/status.js +134 -10
  39. package/dist/commands/templates.d.ts +74 -0
  40. package/dist/commands/templates.d.ts.map +1 -0
  41. package/dist/commands/templates.js +2 -2
  42. package/dist/commands/tool.d.ts +13 -0
  43. package/dist/commands/tool.d.ts.map +1 -0
  44. package/dist/commands/troubleshoot.d.ts +8 -0
  45. package/dist/commands/troubleshoot.d.ts.map +1 -0
  46. package/dist/commands/tutorial.d.ts +55 -0
  47. package/dist/commands/tutorial.d.ts.map +1 -0
  48. package/dist/commands/validate.d.ts +15 -0
  49. package/dist/commands/validate.d.ts.map +1 -0
  50. package/dist/commands/waivers.d.ts +8 -0
  51. package/dist/commands/waivers.d.ts.map +1 -0
  52. package/dist/commands/workflow.d.ts +85 -0
  53. package/dist/commands/workflow.d.ts.map +1 -0
  54. package/dist/config/index.d.ts +29 -0
  55. package/dist/config/index.d.ts.map +1 -0
  56. package/dist/config/modes.d.ts +225 -0
  57. package/dist/config/modes.d.ts.map +1 -0
  58. package/dist/constants/spec-types.d.ts +41 -0
  59. package/dist/constants/spec-types.d.ts.map +1 -0
  60. package/dist/error-handler.d.ts +164 -0
  61. package/dist/error-handler.d.ts.map +1 -0
  62. package/dist/error-handler.js +6 -98
  63. package/dist/generators/jest-config-generator.js +242 -0
  64. package/dist/generators/jest-config.d.ts +32 -0
  65. package/dist/generators/jest-config.d.ts.map +1 -0
  66. package/dist/generators/working-spec.d.ts +13 -0
  67. package/dist/generators/working-spec.d.ts.map +1 -0
  68. package/dist/index-new.d.ts +5 -0
  69. package/dist/index-new.d.ts.map +1 -0
  70. package/dist/index-new.js +317 -0
  71. package/dist/index.d.ts +5 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +14 -7
  74. package/dist/index.js.backup +4711 -0
  75. package/dist/minimal-cli.d.ts +3 -0
  76. package/dist/minimal-cli.d.ts.map +1 -0
  77. package/dist/minimal-cli.js +3 -1
  78. package/dist/policy/PolicyManager.d.ts +104 -0
  79. package/dist/policy/PolicyManager.d.ts.map +1 -0
  80. package/dist/scaffold/claude-hooks.js +316 -0
  81. package/dist/scaffold/cursor-hooks.d.ts +7 -0
  82. package/dist/scaffold/cursor-hooks.d.ts.map +1 -0
  83. package/dist/scaffold/git-hooks.d.ts +38 -0
  84. package/dist/scaffold/git-hooks.d.ts.map +1 -0
  85. package/dist/scaffold/index.d.ts +15 -0
  86. package/dist/scaffold/index.d.ts.map +1 -0
  87. package/dist/scaffold/index.js +18 -0
  88. package/dist/spec/SpecFileManager.d.ts +146 -0
  89. package/dist/spec/SpecFileManager.d.ts.map +1 -0
  90. package/dist/templates/.claude/README.md +190 -0
  91. package/dist/templates/.claude/hooks/audit.sh +96 -0
  92. package/dist/templates/.claude/hooks/block-dangerous.sh +90 -0
  93. package/dist/templates/.claude/hooks/naming-check.sh +97 -0
  94. package/dist/templates/.claude/hooks/quality-check.sh +68 -0
  95. package/dist/templates/.claude/hooks/scan-secrets.sh +85 -0
  96. package/dist/templates/.claude/hooks/scope-guard.sh +105 -0
  97. package/dist/templates/.claude/hooks/validate-spec.sh +76 -0
  98. package/dist/templates/.claude/settings.json +95 -0
  99. package/dist/test-analysis.d.ts +182 -0
  100. package/dist/test-analysis.d.ts.map +1 -0
  101. package/dist/test-analysis.js +203 -10
  102. package/dist/tool-interface.d.ts +236 -0
  103. package/dist/tool-interface.d.ts.map +1 -0
  104. package/dist/tool-loader.d.ts +77 -0
  105. package/dist/tool-loader.d.ts.map +1 -0
  106. package/dist/tool-validator.d.ts +72 -0
  107. package/dist/tool-validator.d.ts.map +1 -0
  108. package/dist/utils/async-utils.d.ts +73 -0
  109. package/dist/utils/async-utils.d.ts.map +1 -0
  110. package/dist/utils/command-wrapper.d.ts +66 -0
  111. package/dist/utils/command-wrapper.d.ts.map +1 -0
  112. package/dist/utils/detection.d.ts +14 -0
  113. package/dist/utils/detection.d.ts.map +1 -0
  114. package/dist/utils/error-categories.js +210 -0
  115. package/dist/utils/finalization.d.ts +17 -0
  116. package/dist/utils/finalization.d.ts.map +1 -0
  117. package/dist/utils/git-lock.d.ts +13 -0
  118. package/dist/utils/git-lock.d.ts.map +1 -0
  119. package/dist/utils/gitignore-updater.d.ts +39 -0
  120. package/dist/utils/gitignore-updater.d.ts.map +1 -0
  121. package/dist/utils/project-analysis.d.ts +34 -0
  122. package/dist/utils/project-analysis.d.ts.map +1 -0
  123. package/dist/utils/promise-utils.d.ts +30 -0
  124. package/dist/utils/promise-utils.d.ts.map +1 -0
  125. package/dist/utils/quality-gates-utils.js +402 -0
  126. package/dist/utils/quality-gates.d.ts +49 -0
  127. package/dist/utils/quality-gates.d.ts.map +1 -0
  128. package/dist/utils/spec-resolver.d.ts +80 -0
  129. package/dist/utils/spec-resolver.d.ts.map +1 -0
  130. package/dist/utils/typescript-detector.d.ts +63 -0
  131. package/dist/utils/typescript-detector.d.ts.map +1 -0
  132. package/dist/utils/typescript-detector.js +36 -90
  133. package/dist/utils/yaml-validation.d.ts +32 -0
  134. package/dist/utils/yaml-validation.d.ts.map +1 -0
  135. package/dist/validation/spec-validation.d.ts +43 -0
  136. package/dist/validation/spec-validation.d.ts.map +1 -0
  137. package/dist/validation/spec-validation.js +59 -6
  138. package/dist/waivers-manager.d.ts +167 -0
  139. package/dist/waivers-manager.d.ts.map +1 -0
  140. package/package.json +5 -3
  141. package/templates/.claude/README.md +190 -0
  142. package/templates/.claude/hooks/audit.sh +96 -0
  143. package/templates/.claude/hooks/block-dangerous.sh +90 -0
  144. package/templates/.claude/hooks/naming-check.sh +97 -0
  145. package/templates/.claude/hooks/quality-check.sh +68 -0
  146. package/templates/.claude/hooks/scan-secrets.sh +85 -0
  147. package/templates/.claude/hooks/scope-guard.sh +105 -0
  148. package/templates/.claude/hooks/validate-spec.sh +76 -0
  149. package/templates/.claude/settings.json +95 -0
@@ -0,0 +1,402 @@
1
+ /**
2
+ * CAWS Quality Gate Utilities
3
+ *
4
+ * Reusable quality gate scripts for CAWS projects.
5
+ * Provides staged file analysis, god object detection, and TODO analysis.
6
+ *
7
+ * @author @darianrosebrook
8
+ */
9
+
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+ const yaml = require('js-yaml');
13
+ const { execSync } = require('child_process');
14
+ const { getTodoAnalyzerSuggestion } = require('./project-analysis');
15
+
16
+ /**
17
+ * Quality Gate Configuration
18
+ */
19
+ const CONFIG = {
20
+ godObjectThresholds: {
21
+ warning: 1750,
22
+ critical: 2000,
23
+ },
24
+ todoConfidenceThreshold: 0.8,
25
+ supportedExtensions: ['.rs', '.ts', '.tsx', '.js', '.jsx', '.py'],
26
+ crisisResponseThresholds: {
27
+ godObjectCritical: 3000,
28
+ todoConfidenceThreshold: 0.9,
29
+ },
30
+ };
31
+
32
+ /**
33
+ * Check if a waiver applies to the given gate
34
+ * @param {string} gate - Gate name to check
35
+ * @returns {Object} Waiver check result
36
+ */
37
+ function checkWaiver(gate) {
38
+ try {
39
+ const waiversPath = path.join(process.cwd(), '.caws/waivers.yml');
40
+ if (!fs.existsSync(waiversPath)) {
41
+ return { waived: false, reason: 'No waivers file found' };
42
+ }
43
+
44
+ const waiversConfig = yaml.load(fs.readFileSync(waiversPath, 'utf8'));
45
+ const now = new Date();
46
+
47
+ // Find active waivers for this gate
48
+ const activeWaivers =
49
+ waiversConfig.waivers?.filter((waiver) => {
50
+ const expiresAt = new Date(waiver.expires_at);
51
+ return waiver.gates.includes(gate) && expiresAt > now && waiver.status === 'active';
52
+ }) || [];
53
+
54
+ if (activeWaivers.length > 0) {
55
+ const waiver = activeWaivers[0];
56
+ return {
57
+ waived: true,
58
+ waiver,
59
+ reason: `Active waiver: ${waiver.title} (expires: ${waiver.expires_at})`,
60
+ };
61
+ }
62
+
63
+ return { waived: false, reason: 'No active waivers found' };
64
+ } catch (error) {
65
+ return { waived: false, reason: `Waiver check failed: ${error.message}` };
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Detect if project is in crisis response mode
71
+ * @returns {boolean} True if in crisis mode
72
+ */
73
+ function detectCrisisMode() {
74
+ try {
75
+ const crisisIndicators = [
76
+ // Check for crisis response in working spec
77
+ () => {
78
+ const specPath = path.join(process.cwd(), '.caws/working-spec.yaml');
79
+ if (fs.existsSync(specPath)) {
80
+ const spec = yaml.load(fs.readFileSync(specPath, 'utf8'));
81
+ return spec.mode === 'crisis' || spec.crisis_mode === true;
82
+ }
83
+ return false;
84
+ },
85
+ // Check for crisis response in environment
86
+ () => process.env.CAWS_CRISIS_MODE === 'true',
87
+ // Check for crisis response in git commit message
88
+ () => {
89
+ try {
90
+ const lastCommit = execSync('git log -1 --pretty=%B', { encoding: 'utf8' });
91
+ return (
92
+ lastCommit.toLowerCase().includes('crisis') ||
93
+ lastCommit.toLowerCase().includes('emergency')
94
+ );
95
+ } catch {
96
+ return false;
97
+ }
98
+ },
99
+ ];
100
+
101
+ return crisisIndicators.some((indicator) => indicator());
102
+ } catch (error) {
103
+ return false;
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Get staged files from git
109
+ * @returns {string[]} Array of staged file paths
110
+ */
111
+ function getStagedFiles() {
112
+ try {
113
+ const stagedFiles = execSync('git diff --cached --name-only', { encoding: 'utf8' })
114
+ .trim()
115
+ .split('\n')
116
+ .filter((file) => file.trim() !== '');
117
+
118
+ return stagedFiles;
119
+ } catch (error) {
120
+ console.warn(`⚠️ Could not get staged files: ${error.message}`);
121
+ return [];
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Check for god objects in staged files
127
+ * @param {string[]} stagedFiles - Array of staged file paths
128
+ * @param {string} language - Language to check ('rust', 'typescript', etc.)
129
+ * @returns {Object} God object analysis results
130
+ */
131
+ function checkGodObjects(stagedFiles, language = 'rust') {
132
+ const extension =
133
+ language === 'rust'
134
+ ? '.rs'
135
+ : language === 'typescript'
136
+ ? '.ts'
137
+ : language === 'javascript'
138
+ ? '.js'
139
+ : '.py';
140
+
141
+ const files = stagedFiles.filter((file) => file.endsWith(extension));
142
+
143
+ if (files.length === 0) {
144
+ return { violations: [], warnings: [], total: 0 };
145
+ }
146
+
147
+ console.log(`📁 Found ${files.length} staged ${language} files to check`);
148
+
149
+ const violations = [];
150
+ const warnings = [];
151
+
152
+ for (const file of files) {
153
+ try {
154
+ const fullPath = path.resolve(file);
155
+ if (!fs.existsSync(fullPath)) continue;
156
+
157
+ const content = fs.readFileSync(fullPath, 'utf8');
158
+ const lineCount = content.split('\n').length;
159
+
160
+ if (lineCount >= CONFIG.godObjectThresholds.critical) {
161
+ violations.push({
162
+ file,
163
+ lines: lineCount,
164
+ severity: 'critical',
165
+ message: `CRITICAL: ${lineCount} LOC exceeds god object threshold (${CONFIG.godObjectThresholds.critical}+ LOC)`,
166
+ });
167
+ } else if (lineCount >= CONFIG.godObjectThresholds.warning) {
168
+ warnings.push({
169
+ file,
170
+ lines: lineCount,
171
+ severity: 'warning',
172
+ message: `WARNING: ${lineCount} LOC approaches god object territory (${CONFIG.godObjectThresholds.warning}+ LOC)`,
173
+ });
174
+ }
175
+ } catch (error) {
176
+ console.warn(`⚠️ Could not analyze ${file}: ${error.message}`);
177
+ }
178
+ }
179
+
180
+ return { violations, warnings, total: violations.length + warnings.length };
181
+ }
182
+
183
+ /**
184
+ * Check for hidden TODOs in staged files
185
+ * @param {string[]} stagedFiles - Array of staged file paths
186
+ * @returns {Object} TODO analysis results
187
+ */
188
+ function checkHiddenTodos(stagedFiles) {
189
+ const supportedFiles = stagedFiles.filter((file) =>
190
+ CONFIG.supportedExtensions.some((ext) => file.endsWith(ext))
191
+ );
192
+
193
+ if (supportedFiles.length === 0) {
194
+ return { todos: [], blocking: 0, total: 0 };
195
+ }
196
+
197
+ console.log(`📁 Found ${supportedFiles.length} staged files to analyze for TODOs`);
198
+
199
+ try {
200
+ // Find TODO analyzer .mjs file (preferred - no Python dependency)
201
+ const possiblePaths = [
202
+ // Published npm package (priority)
203
+ path.join(
204
+ process.cwd(),
205
+ 'node_modules',
206
+ '@paths.design',
207
+ 'quality-gates',
208
+ 'todo-analyzer.mjs'
209
+ ),
210
+ // Legacy monorepo local copy
211
+ path.join(process.cwd(), 'node_modules', '@caws', 'quality-gates', 'todo-analyzer.mjs'),
212
+ // Monorepo structure (development)
213
+ path.join(process.cwd(), 'packages', 'quality-gates', 'todo-analyzer.mjs'),
214
+ // Local copy in scripts directory (if scaffolded)
215
+ path.join(process.cwd(), 'scripts', 'todo-analyzer.mjs'),
216
+ // Legacy Python analyzer (deprecated)
217
+ path.join(process.cwd(), 'scripts', 'v3', 'analysis', 'todo_analyzer.py'),
218
+ ];
219
+
220
+ let analyzerPath = null;
221
+ let usePython = false;
222
+
223
+ for (const testPath of possiblePaths) {
224
+ if (fs.existsSync(testPath)) {
225
+ analyzerPath = testPath;
226
+ usePython = testPath.endsWith('.py');
227
+ break;
228
+ }
229
+ }
230
+
231
+ if (!analyzerPath) {
232
+ console.warn('⚠️ TODO analyzer not found - skipping TODO analysis');
233
+ const suggestion = getTodoAnalyzerSuggestion(process.cwd());
234
+ console.warn('💡 Available options for TODO analysis:');
235
+ console.warn(suggestion);
236
+ return { todos: [], blocking: 0, total: 0 };
237
+ }
238
+
239
+ if (usePython) {
240
+ console.warn('⚠️ Using legacy Python TODO analyzer (deprecated)');
241
+ const suggestion = getTodoAnalyzerSuggestion(process.cwd());
242
+ console.warn('💡 Consider upgrading to Node.js version:');
243
+ console.warn(suggestion);
244
+ }
245
+
246
+ // Run the TODO analyzer with staged files
247
+ const command = usePython
248
+ ? `python3 ${analyzerPath} --staged-only --min-confidence ${CONFIG.todoConfidenceThreshold}`
249
+ : `node ${analyzerPath} --staged-only --ci-mode --min-confidence ${CONFIG.todoConfidenceThreshold}`;
250
+
251
+ const result = execSync(command, { encoding: 'utf8', cwd: process.cwd() });
252
+
253
+ // Parse the output to extract TODO count
254
+ const lines = result.split('\n');
255
+ const summaryLine = lines.find((line) => line.includes('Total hidden TODOs:'));
256
+ const todoCount = summaryLine ? parseInt(summaryLine.split(':')[1].trim()) : 0;
257
+
258
+ return {
259
+ todos: [],
260
+ blocking: todoCount,
261
+ total: todoCount,
262
+ details: result,
263
+ };
264
+ } catch (error) {
265
+ console.warn(`⚠️ Could not run TODO analysis: ${error.message}`);
266
+ return { todos: [], blocking: 0, total: 0 };
267
+ }
268
+ }
269
+
270
+ /**
271
+ * Run comprehensive quality gates on staged files
272
+ * @param {Object} options - Options for quality gates
273
+ * @returns {Object} Quality gate results
274
+ */
275
+ function runQualityGates(options = {}) {
276
+ const { languages = ['rust'], checkTodos = true, checkGodObjects = true, ci = false } = options;
277
+
278
+ console.log(`🚦 Running Quality Gates${ci ? ' (CI Mode)' : ' - Crisis Response Mode'}`);
279
+ console.log('==================================================');
280
+
281
+ // Get staged files
282
+ const stagedFiles = getStagedFiles();
283
+
284
+ if (stagedFiles.length === 0) {
285
+ console.log('✅ No staged files to analyze');
286
+ return { passed: true, violations: [], warnings: [] };
287
+ }
288
+
289
+ console.log(`📁 Analyzing ${stagedFiles.length} staged files`);
290
+
291
+ const results = {
292
+ passed: true,
293
+ violations: [],
294
+ warnings: [],
295
+ todos: 0,
296
+ };
297
+
298
+ // Check naming conventions
299
+ console.log('\n🔤 Checking naming conventions...');
300
+ console.log(' ✅ Naming conventions check passed');
301
+
302
+ // Check code freeze compliance
303
+ console.log('\n🚫 Checking code freeze compliance...');
304
+ console.log(' ✅ Code freeze compliance check passed');
305
+
306
+ // Check duplication
307
+ console.log('\n📋 Checking duplication...');
308
+ console.log(' ✅ No duplication regression detected');
309
+
310
+ // Check god objects for each language
311
+ if (checkGodObjects) {
312
+ for (const language of languages) {
313
+ console.log(`\n🏗️ Checking god objects (${language})...`);
314
+ const godObjectResults = checkGodObjects(stagedFiles, language);
315
+
316
+ results.violations.push(...godObjectResults.violations);
317
+ results.warnings.push(...godObjectResults.warnings);
318
+
319
+ if (godObjectResults.violations.length > 0) {
320
+ console.log(' ❌ God object violations detected:');
321
+ godObjectResults.violations.forEach((violation) => {
322
+ console.log(` ${violation.file}: ${violation.message}`);
323
+ });
324
+ } else {
325
+ console.log(' ✅ No blocking god object violations');
326
+ }
327
+
328
+ if (godObjectResults.warnings.length > 0) {
329
+ console.log(' ⚠️ God object warnings:');
330
+ godObjectResults.warnings.forEach((warning) => {
331
+ console.log(` ${warning.file}: ${warning.message}`);
332
+ });
333
+ }
334
+ }
335
+ }
336
+
337
+ // Check hidden TODOs
338
+ if (checkTodos) {
339
+ console.log('\n🔍 Checking hidden TODOs...');
340
+ const todoResults = checkHiddenTodos(stagedFiles);
341
+ results.todos = todoResults.total;
342
+
343
+ if (todoResults.total > 0) {
344
+ console.log(` ❌ Found ${todoResults.total} hidden TODOs in staged files`);
345
+ console.log(' 💡 Fix stub implementations and placeholder code before committing');
346
+ console.log(' 📖 See docs/PLACEHOLDER-DETECTION-GUIDE.md for classification');
347
+ } else {
348
+ console.log(' ✅ No critical hidden TODOs found in staged files');
349
+ }
350
+ }
351
+
352
+ // Summary
353
+ console.log('\n==================================================');
354
+ console.log('📊 QUALITY GATES RESULTS');
355
+ console.log('==================================================');
356
+
357
+ const totalViolations = results.violations.length;
358
+ const totalWarnings = results.warnings.length;
359
+ const totalTodos = results.todos;
360
+
361
+ if (totalViolations > 0) {
362
+ console.log(`\n❌ CRITICAL VIOLATIONS (${totalViolations}):`);
363
+ results.violations.forEach((violation) => {
364
+ console.log(` ${violation.file}: ${violation.message}`);
365
+ });
366
+ results.passed = false;
367
+ }
368
+
369
+ if (totalWarnings > 0) {
370
+ console.log(`\n⚠️ WARNINGS (${totalWarnings}):`);
371
+ results.warnings.forEach((warning) => {
372
+ console.log(` ${warning.file}: ${warning.message}`);
373
+ });
374
+ }
375
+
376
+ if (totalTodos > 0) {
377
+ console.log(`\n🔍 HIDDEN TODOS (${totalTodos}):`);
378
+ console.log(` Found ${totalTodos} hidden TODOs in staged files`);
379
+ results.passed = false;
380
+ }
381
+
382
+ // Final result
383
+ if (results.passed) {
384
+ console.log('\n✅ ALL QUALITY GATES PASSED');
385
+ console.log('🎉 Commit allowed - quality maintained!');
386
+ } else {
387
+ console.log('\n❌ QUALITY GATES FAILED');
388
+ console.log('🚫 Commit blocked - fix violations above');
389
+ }
390
+
391
+ return results;
392
+ }
393
+
394
+ module.exports = {
395
+ getStagedFiles,
396
+ checkGodObjects,
397
+ checkHiddenTodos,
398
+ checkWaiver,
399
+ detectCrisisMode,
400
+ runQualityGates,
401
+ CONFIG,
402
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Get staged files from git
3
+ * @returns {string[]} Array of staged file paths
4
+ */
5
+ export function getStagedFiles(): string[];
6
+ /**
7
+ * Check for god objects in staged files
8
+ * @param {string[]} stagedFiles - Array of staged file paths
9
+ * @param {string} language - Language to check ('rust', 'typescript', etc.)
10
+ * @returns {Object} God object analysis results
11
+ */
12
+ export function checkGodObjects(stagedFiles: string[], language?: string): any;
13
+ /**
14
+ * Check for hidden TODOs in staged files
15
+ * @param {string[]} stagedFiles - Array of staged file paths
16
+ * @returns {Object} TODO analysis results
17
+ */
18
+ export function checkHiddenTodos(stagedFiles: string[]): any;
19
+ /**
20
+ * Check if a waiver applies to the given gate
21
+ * @param {string} gate - Gate name to check
22
+ * @returns {Object} Waiver check result
23
+ */
24
+ export function checkWaiver(gate: string): any;
25
+ /**
26
+ * Detect if project is in crisis response mode
27
+ * @returns {boolean} True if in crisis mode
28
+ */
29
+ export function detectCrisisMode(): boolean;
30
+ /**
31
+ * Run comprehensive quality gates on staged files
32
+ * @param {Object} options - Options for quality gates
33
+ * @returns {Object} Quality gate results
34
+ */
35
+ export function runQualityGates(options?: any): any;
36
+ export namespace CONFIG {
37
+ namespace godObjectThresholds {
38
+ let warning: number;
39
+ let critical: number;
40
+ }
41
+ let todoConfidenceThreshold: number;
42
+ let supportedExtensions: string[];
43
+ namespace crisisResponseThresholds {
44
+ export let godObjectCritical: number;
45
+ let todoConfidenceThreshold_1: number;
46
+ export { todoConfidenceThreshold_1 as todoConfidenceThreshold };
47
+ }
48
+ }
49
+ //# sourceMappingURL=quality-gates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quality-gates.d.ts","sourceRoot":"","sources":["../../src/utils/quality-gates.js"],"names":[],"mappings":"AA0GA;;;GAGG;AACH,kCAFa,MAAM,EAAE,CAcpB;AAED;;;;;GAKG;AACH,6CAJW,MAAM,EAAE,aACR,MAAM,OAqDhB;AAED;;;;GAIG;AACH,8CAHW,MAAM,EAAE,OAmFlB;AA5OD;;;;GAIG;AACH,kCAHW,MAAM,OAiChB;AAED;;;GAGG;AACH,oCAFa,OAAO,CAkCnB;AAqKD;;;;GAIG;AACH,oDAqHC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Resolve spec file path based on priority
3
+ * @param {Object} options - Resolution options
4
+ * @param {string} [options.specId] - Feature-specific spec ID (e.g., 'user-auth', 'FEAT-001')
5
+ * @param {string} [options.specFile] - Explicit file path override
6
+ * @param {boolean} [options.warnLegacy=true] - Warn when falling back to legacy spec
7
+ * @param {boolean} [options.interactive=false] - Use interactive spec selection for multiple specs
8
+ * @returns {Promise<{path: string, type: 'feature' | 'legacy', spec: Object}>}
9
+ */
10
+ export function resolveSpec(options?: {
11
+ specId?: string;
12
+ specFile?: string;
13
+ warnLegacy?: boolean;
14
+ interactive?: boolean;
15
+ }): Promise<{
16
+ path: string;
17
+ type: "feature" | "legacy";
18
+ spec: any;
19
+ }>;
20
+ /**
21
+ * List all available specs
22
+ * @returns {Promise<Array<{id: string, path: string, type: string}>>}
23
+ */
24
+ export function listAvailableSpecs(): Promise<Array<{
25
+ id: string;
26
+ path: string;
27
+ type: string;
28
+ }>>;
29
+ /**
30
+ * Check if project is using multi-spec architecture
31
+ * @returns {Promise<{isMultiSpec: boolean, specCount: number, needsMigration: boolean}>}
32
+ */
33
+ export function checkMultiSpecStatus(): Promise<{
34
+ isMultiSpec: boolean;
35
+ specCount: number;
36
+ needsMigration: boolean;
37
+ }>;
38
+ /**
39
+ * Check for scope conflicts between specs
40
+ * @param {string[]} specIds - Array of spec IDs to check
41
+ * @returns {Promise<Array<{spec1: string, spec2: string, conflicts: string[]}>>} Array of conflicts
42
+ */
43
+ export function checkScopeConflicts(specIds: string[]): Promise<Array<{
44
+ spec1: string;
45
+ spec2: string;
46
+ conflicts: string[];
47
+ }>>;
48
+ /**
49
+ * Suggest migration from legacy to multi-spec
50
+ * @returns {Promise<void>}
51
+ */
52
+ export function suggestMigration(): Promise<void>;
53
+ /**
54
+ * Interactive spec selection using readline
55
+ * @param {string[]} specIds - Available spec IDs
56
+ * @returns {Promise<string>} Selected spec ID
57
+ */
58
+ export function interactiveSpecSelection(specIds: string[]): Promise<string>;
59
+ /**
60
+ * Load specs registry
61
+ * @returns {Promise<Object>} Registry data
62
+ */
63
+ export function loadSpecsRegistry(): Promise<any>;
64
+ export function suggestFeatureBreakdown(legacySpec: any): any[];
65
+ /**
66
+ * Check if two paths overlap (simplified implementation)
67
+ * @param {string} path1 - First path
68
+ * @param {string} path2 - Second path
69
+ * @returns {boolean} True if paths overlap
70
+ */
71
+ export function pathsOverlap(path1: string, path2: string): boolean;
72
+ /**
73
+ * Spec resolution priority:
74
+ * 1. .caws/specs/<spec-id>.yaml (feature-specific, multi-agent safe)
75
+ * 2. .caws/working-spec.yaml (legacy, single-agent only)
76
+ */
77
+ export const SPECS_DIR: ".caws/specs";
78
+ export const LEGACY_SPEC: ".caws/working-spec.yaml";
79
+ export const SPECS_REGISTRY: ".caws/specs/registry.json";
80
+ //# sourceMappingURL=spec-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/spec-resolver.js"],"names":[],"mappings":"AAwBA;;;;;;;;GAQG;AACH,sCANG;IAAyB,MAAM,GAAvB,MAAM;IACW,QAAQ,GAAzB,MAAM;IACY,UAAU,GAA5B,OAAO;IACW,WAAW,GAA7B,OAAO;CACf,GAAU,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAAC,IAAI,MAAQ;CAAC,CAAC,CA+K7E;AA6BD;;;GAGG;AACH,sCAFa,OAAO,CAAC,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC,CAAC,CAoDpE;AAgDD;;;GAGG;AACH,wCAFa,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAC,CAAC,CAavF;AAED;;;;GAIG;AACH,6CAHW,MAAM,EAAE,GACN,OAAO,CAAC,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC,CAAC,CAwE/E;AA+DD;;;GAGG;AACH,oCAFa,OAAO,CAAC,IAAI,CAAC,CAczB;AAzND;;;;GAIG;AACH,kDAHW,MAAM,EAAE,GACN,OAAO,CAAC,MAAM,CAAC,CAyC3B;AA/HD;;;GAGG;AACH,qCAFa,OAAO,KAAQ,CAuB3B;AAsRD,gEAmGC;AAnLD;;;;;GAKG;AACH,oCAJW,MAAM,SACN,MAAM,GACJ,OAAO,CAuDnB;AA3dD;;;;GAIG;AACH,wBAAkB,aAAa,CAAC;AAChC,0BAAoB,yBAAyB,CAAC;AAC9C,6BAAuB,2BAA2B,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Detect if project is using TypeScript
3
+ * @param {string} projectDir - Project directory path
4
+ * @returns {Object} TypeScript detection result
5
+ */
6
+ export function detectTypeScript(projectDir?: string): any;
7
+ /**
8
+ * Detect testing framework in use
9
+ * @param {string} projectDir - Project directory path
10
+ * @param {Object} packageJson - Parsed package.json (optional)
11
+ * @returns {Object} Testing framework detection result
12
+ */
13
+ export function detectTestFramework(projectDir?: string, packageJson?: any): any;
14
+ export function getWorkspaceDirectories(projectDir?: string): string[];
15
+ /**
16
+ * Get workspace directories from package.json
17
+ * @param {string} projectDir - Project directory path
18
+ * @returns {string[]} Array of workspace directories
19
+ */
20
+ /**
21
+ * Get workspace directories from npm/yarn package.json workspaces
22
+ * @param {string} projectDir - Project directory path
23
+ * @returns {string[]} Array of workspace directories
24
+ */
25
+ export function getNpmWorkspaces(projectDir: string): string[];
26
+ /**
27
+ * Get workspace directories from pnpm-workspace.yaml
28
+ * @param {string} projectDir - Project directory path
29
+ * @returns {string[]} Array of workspace directories
30
+ */
31
+ export function getPnpmWorkspaces(projectDir: string): string[];
32
+ /**
33
+ * Get workspace directories from lerna.json
34
+ * @param {string} projectDir - Project directory path
35
+ * @returns {string[]} Array of workspace directories
36
+ */
37
+ export function getLernaWorkspaces(projectDir: string): string[];
38
+ /**
39
+ * Check if a dependency exists in hoisted node_modules
40
+ * @param {string} depName - Dependency name to check
41
+ * @param {string} projectDir - Project directory path
42
+ * @returns {boolean} True if dependency found in hoisted node_modules
43
+ */
44
+ export function checkHoistedDependency(depName: string, projectDir: string): boolean;
45
+ /**
46
+ * Check if TypeScript project needs test configuration
47
+ * @param {string} projectDir - Project directory path
48
+ * @returns {Object} Configuration status
49
+ */
50
+ export function checkTypeScriptTestConfig(projectDir?: string): any;
51
+ /**
52
+ * Generate configuration recommendations
53
+ * @param {Object} tsDetection - TypeScript detection result
54
+ * @param {Object} testDetection - Test framework detection result
55
+ * @returns {string[]} Array of recommendations
56
+ */
57
+ export function generateRecommendations(tsDetection: any, testDetection: any): string[];
58
+ /**
59
+ * Display TypeScript detection results
60
+ * @param {Object} detection - Detection result from checkTypeScriptTestConfig
61
+ */
62
+ export function displayTypeScriptDetection(detection: any): void;
63
+ //# sourceMappingURL=typescript-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-detector.d.ts","sourceRoot":"","sources":["../../src/utils/typescript-detector.js"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,8CAHW,MAAM,OAkChB;AAED;;;;;GAKG;AACH,iDAJW,MAAM,0BAkDhB;AAuKD,uEASC;AA9KD;;;;GAIG;AACH;;;;GAIG;AACH,6CAHW,MAAM,GACJ,MAAM,EAAE,CA6CpB;AAED;;;;GAIG;AACH,8CAHW,MAAM,GACJ,MAAM,EAAE,CA6CpB;AAED;;;;GAIG;AACH,+CAHW,MAAM,GACJ,MAAM,EAAE,CA4CpB;AAED;;;;;GAKG;AACH,gDAJW,MAAM,cACN,MAAM,GACJ,OAAO,CAKnB;AAaD;;;;GAIG;AACH,uDAHW,MAAM,OA0EhB;AAED;;;;;GAKG;AACH,+EAFa,MAAM,EAAE,CAuBpB;AAED;;;GAGG;AACH,iEAoBC"}