@paths.design/caws-cli 3.3.1 → 3.4.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.
- package/dist/commands/diagnose.d.ts.map +1 -1
- package/dist/commands/diagnose.js +39 -4
- package/dist/commands/evaluate.d.ts +8 -0
- package/dist/commands/evaluate.d.ts.map +1 -0
- package/dist/commands/evaluate.js +288 -0
- package/dist/commands/iterate.d.ts +8 -0
- package/dist/commands/iterate.d.ts.map +1 -0
- package/dist/commands/iterate.js +341 -0
- package/dist/commands/quality-monitor.d.ts +17 -0
- package/dist/commands/quality-monitor.d.ts.map +1 -0
- package/dist/commands/quality-monitor.js +265 -0
- package/dist/commands/status.d.ts +6 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +120 -20
- package/dist/commands/troubleshoot.d.ts +8 -0
- package/dist/commands/troubleshoot.d.ts.map +1 -0
- package/dist/commands/troubleshoot.js +104 -0
- package/dist/commands/waivers.d.ts +8 -0
- package/dist/commands/waivers.d.ts.map +1 -0
- package/dist/commands/waivers.js +293 -0
- package/dist/commands/workflow.d.ts +85 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +243 -0
- package/dist/error-handler.d.ts +91 -2
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +362 -16
- package/dist/index.js +95 -0
- package/dist/utils/typescript-detector.d.ts +31 -0
- package/dist/utils/typescript-detector.d.ts.map +1 -1
- package/dist/utils/typescript-detector.js +245 -7
- package/package.json +2 -1
- package/templates/apps/tools/caws/gates.ts +34 -0
- package/templates/apps/tools/caws/shared/gate-checker.ts +265 -13
- package/templates/apps/tools/caws/templates/working-spec.template.yml +14 -0
- package/dist/index-new.d.ts +0 -5
- package/dist/index-new.d.ts.map +0 -1
- package/dist/index-new.js +0 -317
- package/dist/index.js.backup +0 -4711
- package/templates/apps/tools/caws/prompt-lint.js.backup +0 -274
- package/templates/apps/tools/caws/provenance.js.backup +0 -73
package/dist/error-handler.js
CHANGED
|
@@ -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
|
-
*
|
|
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
|
-
|
|
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
|
-
'
|
|
175
|
-
'
|
|
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
|
-
|
|
370
|
-
|
|
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
|
-
|
|
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',
|
|
@@ -11,6 +11,37 @@ export function detectTypeScript(projectDir?: string): any;
|
|
|
11
11
|
* @returns {Object} Testing framework detection result
|
|
12
12
|
*/
|
|
13
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;
|
|
14
45
|
/**
|
|
15
46
|
* Check if TypeScript project needs test configuration
|
|
16
47
|
* @param {string} projectDir - Project directory path
|
|
@@ -1 +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;AAED;;;;GAIG;AACH,uDAHW,MAAM,
|
|
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"}
|