@paths.design/caws-cli 3.3.1 → 3.5.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 (43) hide show
  1. package/dist/commands/diagnose.d.ts.map +1 -1
  2. package/dist/commands/diagnose.js +39 -4
  3. package/dist/commands/evaluate.d.ts +8 -0
  4. package/dist/commands/evaluate.d.ts.map +1 -0
  5. package/dist/commands/evaluate.js +288 -0
  6. package/dist/commands/iterate.d.ts +8 -0
  7. package/dist/commands/iterate.d.ts.map +1 -0
  8. package/dist/commands/iterate.js +341 -0
  9. package/dist/commands/quality-monitor.d.ts +17 -0
  10. package/dist/commands/quality-monitor.d.ts.map +1 -0
  11. package/dist/commands/quality-monitor.js +265 -0
  12. package/dist/commands/status.d.ts +6 -1
  13. package/dist/commands/status.d.ts.map +1 -1
  14. package/dist/commands/status.js +120 -20
  15. package/dist/commands/troubleshoot.d.ts +8 -0
  16. package/dist/commands/troubleshoot.d.ts.map +1 -0
  17. package/dist/commands/troubleshoot.js +104 -0
  18. package/dist/commands/waivers.d.ts +8 -0
  19. package/dist/commands/waivers.d.ts.map +1 -0
  20. package/dist/commands/waivers.js +293 -0
  21. package/dist/commands/workflow.d.ts +85 -0
  22. package/dist/commands/workflow.d.ts.map +1 -0
  23. package/dist/commands/workflow.js +243 -0
  24. package/dist/error-handler.d.ts +91 -2
  25. package/dist/error-handler.d.ts.map +1 -1
  26. package/dist/error-handler.js +362 -16
  27. package/dist/index.js +95 -0
  28. package/dist/scaffold/git-hooks.d.ts.map +1 -1
  29. package/dist/scaffold/git-hooks.js +27 -6
  30. package/dist/utils/typescript-detector.d.ts +31 -0
  31. package/dist/utils/typescript-detector.d.ts.map +1 -1
  32. package/dist/utils/typescript-detector.js +245 -7
  33. package/package.json +2 -1
  34. package/templates/agents.md +6 -5
  35. package/templates/apps/tools/caws/gates.ts +34 -0
  36. package/templates/apps/tools/caws/shared/gate-checker.ts +265 -13
  37. package/templates/apps/tools/caws/templates/working-spec.template.yml +14 -0
  38. package/dist/index-new.d.ts +0 -5
  39. package/dist/index-new.d.ts.map +0 -1
  40. package/dist/index-new.js +0 -317
  41. package/dist/index.js.backup +0 -4711
  42. package/templates/apps/tools/caws/prompt-lint.js.backup +0 -274
  43. package/templates/apps/tools/caws/provenance.js.backup +0 -73
@@ -113,19 +113,106 @@ class CAWSError extends Error {
113
113
  this.name = 'CAWSError';
114
114
  this.category = category || getErrorCategory(message);
115
115
  this.suggestions = Array.isArray(suggestions) ? suggestions : [suggestions].filter(Boolean);
116
+ this.timestamp = new Date();
117
+ this.executionTime = null;
116
118
  }
117
119
  }
118
120
 
119
121
  /**
120
- * Wrap async operations with consistent error handling
122
+ * Execution timing utilities
123
+ */
124
+ class ExecutionTimer {
125
+ constructor() {
126
+ this.startTime = null;
127
+ this.endTime = null;
128
+ }
129
+
130
+ start() {
131
+ this.startTime = process.hrtime.bigint();
132
+ }
133
+
134
+ end() {
135
+ this.endTime = process.hrtime.bigint();
136
+ return this.getDuration();
137
+ }
138
+
139
+ getDuration() {
140
+ if (!this.startTime || !this.endTime) return 0;
141
+ const durationNs = Number(this.endTime - this.startTime);
142
+ return durationNs / 1_000_000; // Convert to milliseconds
143
+ }
144
+
145
+ formatDuration() {
146
+ const ms = this.getDuration();
147
+ if (ms < 1000) {
148
+ return `${Math.round(ms)}ms`;
149
+ }
150
+ return `${(ms / 1000).toFixed(2)}s`;
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Wrap async operations with consistent error handling and timing
121
156
  * @param {Function} operation - Async operation to wrap
122
157
  * @param {string} context - Context for error messages
158
+ * @param {boolean} includeTiming - Whether to include timing in results
123
159
  * @returns {Promise<any>} Operation result or throws handled error
124
160
  */
125
- async function safeAsync(operation, context = '') {
161
+ async function safeAsync(operation, context = '', includeTiming = false) {
162
+ const timer = includeTiming ? new ExecutionTimer() : null;
163
+ if (timer) timer.start();
164
+
165
+ try {
166
+ const result = await operation();
167
+
168
+ if (includeTiming && timer) {
169
+ const duration = timer.formatDuration();
170
+ console.log(chalk.gray(` (completed in ${duration})`));
171
+ }
172
+
173
+ return result;
174
+ } catch (error) {
175
+ if (timer) {
176
+ error.executionTime = timer.formatDuration();
177
+ }
178
+
179
+ const category = getErrorCategory(error);
180
+ const enhancedError = new CAWSError(
181
+ `${context}: ${error.message}`,
182
+ category,
183
+ getRecoverySuggestions(error, category)
184
+ );
185
+ enhancedError.originalError = error;
186
+ enhancedError.executionTime = error.executionTime;
187
+ throw enhancedError;
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Wrap sync operations with timing
193
+ * @param {Function} operation - Sync operation to wrap
194
+ * @param {string} context - Context for error messages
195
+ * @param {boolean} includeTiming - Whether to include timing in results
196
+ * @returns {any} Operation result or throws handled error
197
+ */
198
+ function safeSync(operation, context = '', includeTiming = false) {
199
+ const timer = includeTiming ? new ExecutionTimer() : null;
200
+ if (timer) timer.start();
201
+
126
202
  try {
127
- return await operation();
203
+ const result = operation();
204
+
205
+ if (includeTiming && timer) {
206
+ const duration = timer.formatDuration();
207
+ console.log(chalk.gray(` (completed in ${duration})`));
208
+ }
209
+
210
+ return result;
128
211
  } catch (error) {
212
+ if (timer) {
213
+ error.executionTime = timer.formatDuration();
214
+ }
215
+
129
216
  const category = getErrorCategory(error);
130
217
  const enhancedError = new CAWSError(
131
218
  `${context}: ${error.message}`,
@@ -133,6 +220,7 @@ async function safeAsync(operation, context = '') {
133
220
  getRecoverySuggestions(error, category)
134
221
  );
135
222
  enhancedError.originalError = error;
223
+ enhancedError.executionTime = error.executionTime;
136
224
  throw enhancedError;
137
225
  }
138
226
  }
@@ -168,11 +256,16 @@ const COMMAND_SUGGESTIONS = {
168
256
  'validate',
169
257
  'scaffold',
170
258
  'status',
259
+ 'diagnose',
260
+ 'evaluate',
261
+ 'iterate',
262
+ 'waivers',
171
263
  'templates',
172
264
  'provenance',
173
265
  'hooks',
174
- 'burnup',
175
- 'tool',
266
+ 'workflow',
267
+ 'quality-monitor',
268
+ 'test-analysis',
176
269
  ];
177
270
  const similar = findSimilarCommand(command, validCommands);
178
271
 
@@ -180,10 +273,33 @@ const COMMAND_SUGGESTIONS = {
180
273
  if (similar) {
181
274
  suggestions.push(`Did you mean: caws ${similar}?`);
182
275
  }
276
+
277
+ // Context-aware suggestions based on command type
278
+ const commandCategories = {
279
+ setup: ['init', 'scaffold', 'templates'],
280
+ validation: ['validate', 'status', 'diagnose'],
281
+ analysis: ['evaluate', 'iterate', 'test-analysis'],
282
+ compliance: ['waivers', 'workflow', 'quality-monitor'],
283
+ history: ['provenance', 'hooks'],
284
+ };
285
+
286
+ // Suggest category based on what user might be trying to do
287
+ if (command.includes('setup') || command.includes('start') || command.includes('create')) {
288
+ suggestions.push('For project setup: caws init');
289
+ } else if (
290
+ command.includes('check') ||
291
+ command.includes('verify') ||
292
+ command.includes('test')
293
+ ) {
294
+ suggestions.push('For validation: caws validate');
295
+ } else if (command.includes('list') || command.includes('show') || command.includes('get')) {
296
+ suggestions.push('For status: caws status');
297
+ }
298
+
183
299
  suggestions.push(
184
- 'Available commands: init, validate, scaffold, status, templates, provenance, hooks'
300
+ 'Available commands: init, validate, scaffold, status, diagnose, evaluate, iterate, waivers, templates, provenance, hooks, workflow, quality-monitor'
185
301
  );
186
- suggestions.push('Try: caws --help for full command list');
302
+ suggestions.push('Try: caws --help for full command list with descriptions');
187
303
 
188
304
  return suggestions;
189
305
  },
@@ -355,6 +471,46 @@ function getDocumentationLink(category, context = {}) {
355
471
  return categoryLinks[category] || `${baseUrl}/docs/agents/full-guide.md`;
356
472
  }
357
473
 
474
+ /**
475
+ * JSON output formatter for programmatic use
476
+ * @param {Object} data - Data to format as JSON
477
+ * @param {boolean} pretty - Whether to pretty-print (default: true)
478
+ */
479
+ function formatJsonOutput(data, pretty = true) {
480
+ return JSON.stringify(data, null, pretty ? 2 : 0);
481
+ }
482
+
483
+ /**
484
+ * Check if user requested JSON output
485
+ * @returns {boolean} True if --json flag is present
486
+ */
487
+ function isJsonOutput() {
488
+ return (
489
+ process.argv.includes('--json') ||
490
+ process.argv.includes('-j') ||
491
+ process.env.CAWS_OUTPUT_FORMAT === 'json'
492
+ );
493
+ }
494
+
495
+ /**
496
+ * Output data in appropriate format (JSON or human-readable)
497
+ * @param {Object} data - Data to output
498
+ * @param {boolean} success - Whether this is a success response
499
+ */
500
+ function outputResult(data, success = true) {
501
+ if (isJsonOutput()) {
502
+ const jsonData = {
503
+ success,
504
+ timestamp: new Date().toISOString(),
505
+ ...data,
506
+ };
507
+ console.log(formatJsonOutput(jsonData));
508
+ } else {
509
+ // Human-readable output (existing behavior)
510
+ return data;
511
+ }
512
+ }
513
+
358
514
  /**
359
515
  * Handle CLI errors with consistent formatting and user guidance
360
516
  * @param {Error} error - Error to handle
@@ -365,24 +521,205 @@ function handleCliError(error, context = {}, exit = true) {
365
521
  const category = error.category || getErrorCategory(error);
366
522
  const suggestions = error.suggestions || getRecoverySuggestions(error, category, context);
367
523
  const docLink = getDocumentationLink(category, context);
524
+ const troubleshootingGuide = suggestTroubleshootingGuide(error.message);
525
+
526
+ if (isJsonOutput()) {
527
+ // JSON output mode
528
+ const jsonError = {
529
+ success: false,
530
+ error: {
531
+ message: error.message,
532
+ category,
533
+ suggestions,
534
+ documentation: docLink,
535
+ executionTime: error.executionTime,
536
+ timestamp: error.timestamp?.toISOString(),
537
+ troubleshootingGuide: troubleshootingGuide
538
+ ? getTroubleshootingGuide(troubleshootingGuide)
539
+ : null,
540
+ },
541
+ };
542
+ console.log(formatJsonOutput(jsonError));
543
+ } else {
544
+ // Human-readable output
545
+ console.error(chalk.red(`\nāŒ ${error.message}`));
546
+
547
+ if (suggestions && suggestions.length > 0) {
548
+ console.error(chalk.yellow('\nšŸ’” Suggestions:'));
549
+ suggestions.forEach((suggestion) => {
550
+ console.error(chalk.yellow(` ${suggestion}`));
551
+ });
552
+ }
368
553
 
369
- // Format error output
370
- console.error(chalk.red(`\nāŒ ${error.message}`));
554
+ // Add troubleshooting guide suggestion if available
555
+ if (troubleshootingGuide) {
556
+ const guide = getTroubleshootingGuide(troubleshootingGuide);
557
+ console.error(chalk.cyan(`\nšŸ” Troubleshooting Guide: ${guide.title}`));
558
+ console.error(
559
+ chalk.cyan(` Run: caws troubleshoot ${troubleshootingGuide} for detailed guide`)
560
+ );
561
+ }
371
562
 
372
- if (suggestions && suggestions.length > 0) {
373
- console.error(chalk.yellow('\nšŸ’” Suggestions:'));
374
- suggestions.forEach((suggestion) => {
375
- console.error(chalk.yellow(` ${suggestion}`));
376
- });
563
+ console.error(chalk.blue(`\nšŸ“š Documentation: ${docLink}`));
377
564
  }
378
565
 
379
- console.error(chalk.blue(`\nšŸ“š Documentation: ${docLink}`));
380
-
381
566
  if (exit) {
382
567
  process.exit(1);
383
568
  }
384
569
  }
385
570
 
571
+ /**
572
+ * Troubleshooting guide system
573
+ */
574
+ const TROUBLESHOOTING_GUIDES = {
575
+ 'coverage-report-not-found': {
576
+ title: 'Coverage Report Not Found',
577
+ symptoms: [
578
+ 'Coverage check fails with "report not found"',
579
+ 'Tests pass but coverage reports missing',
580
+ 'Jest/Vitest coverage not generating files',
581
+ ],
582
+ rootCauses: [
583
+ 'Tests not run with coverage flag',
584
+ 'Coverage output directory misconfigured',
585
+ 'Test framework not configured for coverage',
586
+ 'Working directory detection issue',
587
+ ],
588
+ solutions: [
589
+ 'Run tests with coverage: npm test -- --coverage --coverageReporters=json',
590
+ 'Check coverage configuration in package.json or jest.config.js',
591
+ 'Ensure coverage output directory exists',
592
+ 'Run from workspace directory in monorepos',
593
+ ],
594
+ commands: [
595
+ 'npm test -- --coverage --coverageReporters=json',
596
+ 'jest --coverage --coverageReporters=json',
597
+ 'vitest run --coverage',
598
+ 'caws status --verbose',
599
+ ],
600
+ },
601
+
602
+ 'mutation-report-not-found': {
603
+ title: 'Mutation Report Not Found',
604
+ symptoms: [
605
+ 'Mutation check fails with "report not found"',
606
+ 'Stryker mutation tests not generating reports',
607
+ 'Mutation testing configured but no results',
608
+ ],
609
+ rootCauses: [
610
+ 'Mutation tests not run',
611
+ 'Stryker configuration incorrect',
612
+ 'Report output path misconfigured',
613
+ 'Working directory detection issue',
614
+ ],
615
+ solutions: [
616
+ 'Run mutation tests: npx stryker run',
617
+ 'Check stryker.conf.json configuration',
618
+ 'Verify report output paths',
619
+ 'Run from workspace directory in monorepos',
620
+ ],
621
+ commands: [
622
+ 'npx stryker run',
623
+ 'npx stryker run --configFile stryker.conf.json',
624
+ 'caws status --verbose',
625
+ ],
626
+ },
627
+
628
+ 'working-spec-validation': {
629
+ title: 'Working Spec Validation Errors',
630
+ symptoms: [
631
+ 'Working spec fails validation',
632
+ 'Schema errors in .caws/working-spec.yaml',
633
+ 'Invalid risk tier or scope configuration',
634
+ ],
635
+ rootCauses: [
636
+ 'Invalid YAML syntax',
637
+ 'Missing required fields',
638
+ 'Incorrect schema structure',
639
+ 'Invalid scope paths',
640
+ ],
641
+ solutions: [
642
+ 'Run validation with suggestions: caws validate --suggestions',
643
+ 'Auto-fix safe issues: caws validate --auto-fix',
644
+ 'Check schema documentation',
645
+ 'Use caws init to generate valid spec',
646
+ ],
647
+ commands: [
648
+ 'caws validate --suggestions',
649
+ 'caws validate --auto-fix',
650
+ 'caws init --interactive',
651
+ ],
652
+ },
653
+
654
+ 'monorepo-detection': {
655
+ title: 'Monorepo Detection Issues',
656
+ symptoms: [
657
+ 'CAWS not detecting workspace structure',
658
+ 'False positives about missing dependencies',
659
+ 'Commands fail from workspace directories',
660
+ ],
661
+ rootCauses: [
662
+ 'Unsupported monorepo tool (not npm/yarn/pnpm/lerna)',
663
+ 'Invalid workspace configuration',
664
+ 'Running from wrong directory',
665
+ 'Missing package.json files in workspaces',
666
+ ],
667
+ solutions: [
668
+ 'Verify workspace configuration in root package.json',
669
+ 'Ensure workspace directories contain package.json',
670
+ 'Run commands from workspace directories',
671
+ 'Check for supported monorepo tools',
672
+ ],
673
+ commands: [
674
+ 'cat package.json | grep workspaces',
675
+ 'find packages -name package.json',
676
+ 'caws diagnose',
677
+ 'caws status',
678
+ ],
679
+ },
680
+ };
681
+
682
+ /**
683
+ * Get troubleshooting guide for a specific issue
684
+ * @param {string} issueKey - Key for the troubleshooting guide
685
+ * @returns {Object|null} Troubleshooting guide or null if not found
686
+ */
687
+ function getTroubleshootingGuide(issueKey) {
688
+ return TROUBLESHOOTING_GUIDES[issueKey] || null;
689
+ }
690
+
691
+ /**
692
+ * Get all available troubleshooting guides
693
+ * @returns {Object} All troubleshooting guides
694
+ */
695
+ function getAllTroubleshootingGuides() {
696
+ return TROUBLESHOOTING_GUIDES;
697
+ }
698
+
699
+ /**
700
+ * Suggest troubleshooting guide based on error message
701
+ * @param {string} errorMessage - Error message to analyze
702
+ * @returns {string|null} Issue key if match found, null otherwise
703
+ */
704
+ function suggestTroubleshootingGuide(errorMessage) {
705
+ const lowerMessage = errorMessage.toLowerCase();
706
+
707
+ if (lowerMessage.includes('coverage') && lowerMessage.includes('not found')) {
708
+ return 'coverage-report-not-found';
709
+ }
710
+ if (lowerMessage.includes('mutation') && lowerMessage.includes('not found')) {
711
+ return 'mutation-report-not-found';
712
+ }
713
+ if (lowerMessage.includes('working spec') || lowerMessage.includes('validation')) {
714
+ return 'working-spec-validation';
715
+ }
716
+ if (lowerMessage.includes('workspace') || lowerMessage.includes('monorepo')) {
717
+ return 'monorepo-detection';
718
+ }
719
+
720
+ return null;
721
+ }
722
+
386
723
  /**
387
724
  * Validate required environment and dependencies
388
725
  * @returns {Object} Validation result with any errors
@@ -413,12 +750,21 @@ function validateEnvironment() {
413
750
  module.exports = {
414
751
  CAWSError,
415
752
  ERROR_CATEGORIES,
753
+ ExecutionTimer,
416
754
  getErrorCategory,
417
755
  safeAsync,
756
+ safeSync,
418
757
  handleCliError,
419
758
  validateEnvironment,
420
759
  getRecoverySuggestions,
421
760
  getDocumentationLink,
422
761
  findSimilarCommand,
423
762
  COMMAND_SUGGESTIONS,
763
+ formatJsonOutput,
764
+ isJsonOutput,
765
+ outputResult,
766
+ TROUBLESHOOTING_GUIDES,
767
+ getTroubleshootingGuide,
768
+ getAllTroubleshootingGuides,
769
+ suggestTroubleshootingGuide,
424
770
  };
package/dist/index.js CHANGED
@@ -36,6 +36,12 @@ const { executeTool } = require('./commands/tool');
36
36
  const { statusCommand } = require('./commands/status');
37
37
  const { templatesCommand } = require('./commands/templates');
38
38
  const { diagnoseCommand } = require('./commands/diagnose');
39
+ const { evaluateCommand } = require('./commands/evaluate');
40
+ const { iterateCommand } = require('./commands/iterate');
41
+ const { waiversCommand } = require('./commands/waivers');
42
+ const { workflowCommand } = require('./commands/workflow');
43
+ const { qualityMonitorCommand } = require('./commands/quality-monitor');
44
+ const { troubleshootCommand } = require('./commands/troubleshoot');
39
45
 
40
46
  // Import scaffold functionality
41
47
  const { scaffoldProject, setScaffoldDependencies } = require('./scaffold');
@@ -118,6 +124,7 @@ program
118
124
  .command('status')
119
125
  .description('Show project health overview')
120
126
  .option('-s, --spec <path>', 'Path to working spec file', '.caws/working-spec.yaml')
127
+ .option('--json', 'Output in JSON format', false)
121
128
  .action(statusCommand);
122
129
 
123
130
  // Templates command
@@ -134,6 +141,87 @@ program
134
141
  .option('--fix', 'Apply automatic fixes', false)
135
142
  .action(diagnoseCommand);
136
143
 
144
+ // Evaluate command
145
+ program
146
+ .command('evaluate [spec-file]')
147
+ .description('Evaluate work against CAWS quality standards')
148
+ .option('-v, --verbose', 'Show detailed error information', false)
149
+ .action(evaluateCommand);
150
+
151
+ // Iterate command
152
+ program
153
+ .command('iterate [spec-file]')
154
+ .description('Get iterative development guidance based on current progress')
155
+ .option('--current-state <json>', 'Current implementation state as JSON', '{}')
156
+ .option('-v, --verbose', 'Show detailed error information', false)
157
+ .action(iterateCommand);
158
+
159
+ // Waivers command group
160
+ const waiversCmd = program.command('waivers').description('Manage CAWS quality gate waivers');
161
+
162
+ // Waivers subcommands
163
+ waiversCmd
164
+ .command('create')
165
+ .description('Create a new quality gate waiver')
166
+ .requiredOption('--title <title>', 'Waiver title')
167
+ .requiredOption(
168
+ '--reason <reason>',
169
+ 'Reason for waiver (emergency_hotfix, legacy_integration, etc.)'
170
+ )
171
+ .requiredOption('--description <description>', 'Detailed description')
172
+ .requiredOption('--gates <gates>', 'Comma-separated list of gates to waive')
173
+ .requiredOption('--expires-at <date>', 'Expiration date (ISO 8601)')
174
+ .requiredOption('--approved-by <approver>', 'Approver name')
175
+ .requiredOption('--impact-level <level>', 'Impact level (low, medium, high, critical)')
176
+ .requiredOption('--mitigation-plan <plan>', 'Risk mitigation plan')
177
+ .option('-v, --verbose', 'Show detailed error information', false)
178
+ .action((options) => waiversCommand('create', options));
179
+
180
+ waiversCmd
181
+ .command('list')
182
+ .description('List all waivers')
183
+ .option('-v, --verbose', 'Show detailed error information', false)
184
+ .action((options) => waiversCommand('list', options));
185
+
186
+ waiversCmd
187
+ .command('show <id>')
188
+ .description('Show waiver details')
189
+ .option('-v, --verbose', 'Show detailed error information', false)
190
+ .action((id, options) => waiversCommand('show', { ...options, id }));
191
+
192
+ waiversCmd
193
+ .command('revoke <id>')
194
+ .description('Revoke a waiver')
195
+ .option('--revoked-by <name>', 'Person revoking the waiver')
196
+ .option('--reason <reason>', 'Revocation reason')
197
+ .option('-v, --verbose', 'Show detailed error information', false)
198
+ .action((id, options) => waiversCommand('revoke', { ...options, id }));
199
+
200
+ // Workflow command group
201
+ const workflowCmd = program
202
+ .command('workflow <type>')
203
+ .description('Get workflow-specific guidance for development tasks')
204
+ .option('--step <number>', 'Current step in workflow', '1')
205
+ .option('--current-state <json>', 'Current implementation state as JSON', '{}')
206
+ .option('-v, --verbose', 'Show detailed error information', false)
207
+ .action((type, options) => workflowCommand(type, options));
208
+
209
+ // Quality Monitor command
210
+ program
211
+ .command('quality-monitor <action>')
212
+ .description('Monitor code quality impact in real-time')
213
+ .option('--files <files>', 'Files affected (comma-separated)')
214
+ .option('--context <json>', 'Additional context as JSON', '{}')
215
+ .option('-v, --verbose', 'Show detailed error information', false)
216
+ .action(qualityMonitorCommand);
217
+
218
+ // Troubleshoot command - temporarily disabled due to registration issue
219
+ // program
220
+ // .command('troubleshoot [guide]')
221
+ // .description('Display troubleshooting guides for common CAWS issues')
222
+ // .option('-l, --list', 'List all available troubleshooting guides', false)
223
+ // .action(troubleshootCommand);
224
+
137
225
  // Tool command
138
226
  program
139
227
  .command('tool')
@@ -291,6 +379,13 @@ program.exitOverride((err) => {
291
379
  'scaffold',
292
380
  'status',
293
381
  'templates',
382
+ 'diagnose',
383
+ 'evaluate',
384
+ 'iterate',
385
+ 'waivers',
386
+ 'workflow',
387
+ 'quality-monitor',
388
+ 'troubleshoot',
294
389
  'provenance',
295
390
  'hooks',
296
391
  'burnup',
@@ -1 +1 @@
1
- {"version":3,"file":"git-hooks.d.ts","sourceRoot":"","sources":["../../src/scaffold/git-hooks.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH,6CAHW,MAAM;;;GAuGhB;AAgND;;;GAGG;AACH,2CAFW,MAAM,iBAkChB;AAED;;;GAGG;AACH,gDAFW,MAAM,iBAgDhB"}
1
+ {"version":3,"file":"git-hooks.d.ts","sourceRoot":"","sources":["../../src/scaffold/git-hooks.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH,6CAHW,MAAM;;;GAwGhB;AAoOD;;;GAGG;AACH,2CAFW,MAAM,iBAkChB;AAED;;;GAGG;AACH,gDAFW,MAAM,iBAgDhB"}
@@ -108,7 +108,8 @@ async function scaffoldGitHooks(projectDir, options = {}) {
108
108
  if (addedCount > 0) {
109
109
  console.log(`\nšŸ”— Git hooks configured: ${addedCount} hooks active`);
110
110
  console.log('šŸ’” Hooks will run automatically on git operations');
111
- console.log('šŸ’” Use --no-verify to skip hooks: git commit --no-verify');
111
+ console.log('šŸ’” Use --no-verify to skip commit hooks: git commit --no-verify');
112
+ console.log('āš ļø Note: --no-verify is BLOCKED on git push for safety');
112
113
  }
113
114
 
114
115
  return { added: addedCount, skipped: skippedCount };
@@ -142,7 +143,7 @@ if command -v caws >/dev/null 2>&1; then
142
143
  echo "āœ… CAWS validation passed"
143
144
  else
144
145
  echo "āŒ CAWS validation failed"
145
- echo "šŸ’” Fix issues or use: git commit --no-verify"
146
+ echo "šŸ’” Fix issues or skip with: git commit --no-verify (allowed)"
146
147
  exit 1
147
148
  fi
148
149
  else
@@ -161,7 +162,8 @@ if [ -f "package.json" ]; then
161
162
  if npx eslint . --quiet; then
162
163
  echo "āœ… ESLint passed"
163
164
  else
164
- echo "āŒ ESLint failed - fix issues or use --no-verify"
165
+ echo "āŒ ESLint failed"
166
+ echo "šŸ’” Fix issues or skip with: git commit --no-verify (allowed)"
165
167
  exit 1
166
168
  fi
167
169
  fi
@@ -172,7 +174,8 @@ if [ -f "package.json" ]; then
172
174
  if npm test; then
173
175
  echo "āœ… Tests passed"
174
176
  else
175
- echo "āŒ Tests failed - fix issues or use --no-verify"
177
+ echo "āŒ Tests failed"
178
+ echo "šŸ’” Fix issues or skip with: git commit --no-verify (allowed)"
176
179
  exit 1
177
180
  fi
178
181
  fi
@@ -227,14 +230,32 @@ function generatePostCommitHook() {
227
230
 
228
231
  /**
229
232
  * Generate pre-push hook content
233
+ * Blocks --no-verify to enforce quality gates before pushing
230
234
  */
231
235
  function generatePrePushHook() {
232
236
  return `#!/bin/bash
233
237
  # CAWS Pre-push Hook
234
238
  # Runs comprehensive checks before pushing
239
+ # BLOCKS --no-verify for safety
235
240
 
236
241
  set -e
237
242
 
243
+ # Block --no-verify on push operations
244
+ for arg in "$@"; do
245
+ if [[ "$arg" == "--no-verify" ]] || [[ "$arg" == "-n" ]]; then
246
+ echo "āŒ Error: --no-verify is BLOCKED on git push"
247
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
248
+ echo "Push operations must pass all quality gates."
249
+ echo ""
250
+ echo "šŸ’” To fix issues locally:"
251
+ echo " 1. Run: caws validate"
252
+ echo " 2. Fix reported issues"
253
+ echo " 3. Commit fixes: git commit --no-verify (allowed)"
254
+ echo " 4. Push again: git push (no --no-verify)"
255
+ exit 1
256
+ fi
257
+ done
258
+
238
259
  echo "šŸš€ CAWS Pre-push Validation"
239
260
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
240
261
 
@@ -251,7 +272,8 @@ if command -v caws >/dev/null 2>&1; then
251
272
  echo "āœ… CAWS validation passed"
252
273
  else
253
274
  echo "āŒ CAWS validation failed"
254
- echo "šŸ’” Fix issues or use: git push --no-verify"
275
+ echo "šŸ’” Fix issues locally, then push again"
276
+ echo "šŸ’” You can commit fixes with: git commit --no-verify"
255
277
  exit 1
256
278
  fi
257
279
  fi
@@ -267,7 +289,6 @@ if [ -f "package.json" ]; then
267
289
  else
268
290
  echo "āš ļø Security vulnerabilities found"
269
291
  echo "šŸ’” Review with: npm audit"
270
- echo "šŸ’” Use --no-verify to push anyway"
271
292
  # Don't fail on warnings, just warn
272
293
  fi
273
294
  fi