@paths.design/caws-cli 8.2.0 ā 8.2.3
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/budget-derivation.js +10 -10
- package/dist/commands/archive.js +22 -22
- package/dist/commands/burnup.js +7 -7
- package/dist/commands/diagnose.js +25 -25
- package/dist/commands/evaluate.js +20 -20
- package/dist/commands/init.js +71 -72
- package/dist/commands/iterate.js +21 -21
- package/dist/commands/mode.js +11 -11
- package/dist/commands/plan.js +5 -5
- package/dist/commands/provenance.js +86 -86
- package/dist/commands/quality-gates.js +4 -4
- package/dist/commands/quality-monitor.js +17 -17
- package/dist/commands/session.js +312 -0
- package/dist/commands/specs.js +44 -44
- package/dist/commands/status.js +43 -43
- package/dist/commands/templates.js +14 -14
- package/dist/commands/tool.js +1 -1
- package/dist/commands/troubleshoot.js +11 -11
- package/dist/commands/tutorial.js +119 -119
- package/dist/commands/validate.js +6 -6
- package/dist/commands/waivers.js +93 -60
- package/dist/commands/workflow.js +17 -17
- package/dist/commands/worktree.js +13 -13
- package/dist/config/index.js +5 -5
- package/dist/config/modes.js +7 -7
- package/dist/constants/spec-types.js +5 -5
- package/dist/error-handler.js +4 -4
- package/dist/generators/jest-config-generator.js +3 -3
- package/dist/generators/working-spec.js +4 -4
- package/dist/index.js +79 -27
- package/dist/minimal-cli.js +9 -9
- package/dist/policy/PolicyManager.js +1 -1
- package/dist/scaffold/claude-hooks.js +7 -7
- package/dist/scaffold/cursor-hooks.js +8 -8
- package/dist/scaffold/git-hooks.js +152 -152
- package/dist/scaffold/index.js +48 -48
- package/dist/session/session-manager.js +548 -0
- package/dist/test-analysis.js +20 -20
- package/dist/utils/command-wrapper.js +8 -8
- package/dist/utils/detection.js +7 -7
- package/dist/utils/finalization.js +21 -21
- package/dist/utils/git-lock.js +3 -3
- package/dist/utils/gitignore-updater.js +1 -1
- package/dist/utils/project-analysis.js +7 -7
- package/dist/utils/quality-gates-utils.js +35 -35
- package/dist/utils/spec-resolver.js +8 -8
- package/dist/utils/typescript-detector.js +5 -5
- package/dist/utils/yaml-validation.js +1 -1
- package/dist/validation/spec-validation.js +4 -4
- package/dist/worktree/worktree-manager.js +11 -5
- package/package.json +1 -1
package/dist/commands/plan.js
CHANGED
|
@@ -116,7 +116,7 @@ async function generateAndDisplayPlan(spec, specId, options) {
|
|
|
116
116
|
// Display plan summary
|
|
117
117
|
displayGeneratedPlan(plan);
|
|
118
118
|
|
|
119
|
-
console.log(chalk.green(
|
|
119
|
+
console.log(chalk.green(`Plan generated: ${outputPath}`));
|
|
120
120
|
|
|
121
121
|
return outputResult({
|
|
122
122
|
command: 'plan generate',
|
|
@@ -344,8 +344,8 @@ function generatePlanMarkdown(plan) {
|
|
|
344
344
|
* @param {Object} plan - Plan data
|
|
345
345
|
*/
|
|
346
346
|
function displayGeneratedPlan(plan) {
|
|
347
|
-
console.log(chalk.bold.cyan(`\
|
|
348
|
-
console.log(chalk.cyan('
|
|
347
|
+
console.log(chalk.bold.cyan(`\nGenerated Implementation Plan`));
|
|
348
|
+
console.log(chalk.cyan('===================================================\n'));
|
|
349
349
|
|
|
350
350
|
console.log(chalk.bold(`Title: ${plan.title}`));
|
|
351
351
|
console.log(chalk.gray(`Spec: ${plan.spec_id}`));
|
|
@@ -371,7 +371,7 @@ function displayGeneratedPlan(plan) {
|
|
|
371
371
|
console.log('');
|
|
372
372
|
|
|
373
373
|
// Next steps
|
|
374
|
-
console.log(chalk.bold.yellow('
|
|
374
|
+
console.log(chalk.bold.yellow('Next Steps:'));
|
|
375
375
|
console.log(chalk.yellow(' 1. Review and customize the generated plan'));
|
|
376
376
|
console.log(chalk.yellow(' 2. Update task priorities and dependencies'));
|
|
377
377
|
console.log(chalk.yellow(' 3. Start implementation following the task order'));
|
|
@@ -400,7 +400,7 @@ async function planCommand(action, options = {}) {
|
|
|
400
400
|
// Use the single spec automatically
|
|
401
401
|
const registry = await require('../utils/spec-resolver').loadSpecsRegistry();
|
|
402
402
|
const singleSpecId = Object.keys(registry.specs)[0];
|
|
403
|
-
console.log(chalk.blue(
|
|
403
|
+
console.log(chalk.blue(`Auto-detected single spec: ${singleSpecId}`));
|
|
404
404
|
|
|
405
405
|
const spec = await loadSpecForPlanning(singleSpecId);
|
|
406
406
|
if (!spec) {
|
|
@@ -147,7 +147,7 @@ async function updateProvenance(options) {
|
|
|
147
147
|
await saveProvenanceChain(provenanceChain, output);
|
|
148
148
|
|
|
149
149
|
if (!quiet) {
|
|
150
|
-
console.log(
|
|
150
|
+
console.log(`Provenance updated for commit ${commit.substring(0, 8)}`);
|
|
151
151
|
console.log(` Chain length: ${provenanceChain.length} entries`);
|
|
152
152
|
console.log(` Hash: ${newEntry.hash.substring(0, 16)}...`);
|
|
153
153
|
}
|
|
@@ -164,14 +164,14 @@ async function showProvenance(options) {
|
|
|
164
164
|
|
|
165
165
|
if (chain.length === 0) {
|
|
166
166
|
if (format === 'dashboard') {
|
|
167
|
-
console.log('
|
|
168
|
-
console.log('ā
|
|
167
|
+
console.log('ā- CAWS Provenance Dashboard ----------------------ā');
|
|
168
|
+
console.log('ā No provenance data found ā');
|
|
169
169
|
console.log('ā ā');
|
|
170
|
-
console.log('ā
|
|
171
|
-
console.log('
|
|
170
|
+
console.log('ā Run "caws provenance init" to get started ā');
|
|
171
|
+
console.log('ā-------------------------------------------------ā');
|
|
172
172
|
} else {
|
|
173
|
-
console.log('
|
|
174
|
-
console.log(
|
|
173
|
+
console.log('No provenance data found');
|
|
174
|
+
console.log(`Run "caws provenance init" to get started`);
|
|
175
175
|
}
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
@@ -186,8 +186,8 @@ async function showProvenance(options) {
|
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
console.log('
|
|
190
|
-
console.log('
|
|
189
|
+
console.log('CAWS Provenance Chain');
|
|
190
|
+
console.log('==============================================');
|
|
191
191
|
console.log(`Total entries: ${chain.length}`);
|
|
192
192
|
console.log('');
|
|
193
193
|
|
|
@@ -212,16 +212,16 @@ async function showProvenance(options) {
|
|
|
212
212
|
if (entry.cursor_tracking && entry.cursor_tracking.available) {
|
|
213
213
|
const tracking = entry.cursor_tracking;
|
|
214
214
|
console.log(
|
|
215
|
-
`
|
|
215
|
+
` AI Code: ${tracking.ai_code_breakdown.composer_chat.percentage}% composer, ${tracking.ai_code_breakdown.tab_completions.percentage}% tab-complete, ${tracking.ai_code_breakdown.manual_human.percentage}% manual`
|
|
216
216
|
);
|
|
217
217
|
console.log(
|
|
218
|
-
`
|
|
218
|
+
` Quality: ${Math.round(tracking.quality_metrics.ai_code_quality_score * 100)}% AI score, ${Math.round(tracking.quality_metrics.acceptance_rate * 100)}% acceptance`
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
// Display checkpoint info if available
|
|
223
223
|
if (entry.checkpoints && entry.checkpoints.available && entry.checkpoints.checkpoints) {
|
|
224
|
-
console.log(`
|
|
224
|
+
console.log(` Checkpoints: ${entry.checkpoints.checkpoints.length} created`);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
console.log('');
|
|
@@ -242,11 +242,11 @@ async function verifyProvenance(options) {
|
|
|
242
242
|
const chain = await loadProvenanceChain(output);
|
|
243
243
|
|
|
244
244
|
if (chain.length === 0) {
|
|
245
|
-
console.log('
|
|
245
|
+
console.log('No provenance data to verify');
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
console.log('
|
|
249
|
+
console.log('Verifying provenance chain integrity...');
|
|
250
250
|
|
|
251
251
|
let valid = true;
|
|
252
252
|
for (let i = 0; i < chain.length; i++) {
|
|
@@ -255,7 +255,7 @@ async function verifyProvenance(options) {
|
|
|
255
255
|
// Verify hash integrity
|
|
256
256
|
const expectedPreviousHash = i === 0 ? '' : chain[i - 1].hash;
|
|
257
257
|
if (entry.previous_hash !== expectedPreviousHash) {
|
|
258
|
-
console.error(
|
|
258
|
+
console.error(`Chain break at entry ${i + 1}: previous hash mismatch`);
|
|
259
259
|
valid = false;
|
|
260
260
|
}
|
|
261
261
|
|
|
@@ -268,7 +268,7 @@ async function verifyProvenance(options) {
|
|
|
268
268
|
const calculatedHash = crypto.createHash('sha256').update(hashContent).digest('hex');
|
|
269
269
|
|
|
270
270
|
if (calculatedHash !== entry.hash) {
|
|
271
|
-
console.error(
|
|
271
|
+
console.error(`Hash verification failed at entry ${i + 1}`);
|
|
272
272
|
console.error(` Expected: ${entry.hash}`);
|
|
273
273
|
console.error(` Calculated: ${calculatedHash}`);
|
|
274
274
|
valid = false;
|
|
@@ -276,10 +276,10 @@ async function verifyProvenance(options) {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
if (valid) {
|
|
279
|
-
console.log('
|
|
279
|
+
console.log('Provenance chain integrity verified');
|
|
280
280
|
console.log(` ${chain.length} entries, all hashes valid`);
|
|
281
281
|
} else {
|
|
282
|
-
console.error('
|
|
282
|
+
console.error('Provenance chain integrity compromised');
|
|
283
283
|
process.exit(1);
|
|
284
284
|
}
|
|
285
285
|
}
|
|
@@ -325,12 +325,12 @@ async function analyzeAIProvenance(options) {
|
|
|
325
325
|
const chain = await loadProvenanceChain(output);
|
|
326
326
|
|
|
327
327
|
if (chain.length === 0) {
|
|
328
|
-
console.log('
|
|
328
|
+
console.log('No provenance data to analyze');
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
console.log('
|
|
333
|
-
console.log('
|
|
332
|
+
console.log('AI Code Effectiveness Analysis');
|
|
333
|
+
console.log('==============================================');
|
|
334
334
|
|
|
335
335
|
// Filter entries with AI tracking data
|
|
336
336
|
const aiEntries = chain.filter(
|
|
@@ -342,8 +342,8 @@ async function analyzeAIProvenance(options) {
|
|
|
342
342
|
);
|
|
343
343
|
|
|
344
344
|
if (aiEntries.length === 0) {
|
|
345
|
-
console.log('
|
|
346
|
-
console.log('
|
|
345
|
+
console.log('No AI tracking data found in provenance');
|
|
346
|
+
console.log('Configure CURSOR_TRACKING_API and CURSOR_CHECKPOINT_API environment variables');
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
349
|
|
|
@@ -355,7 +355,7 @@ async function analyzeAIProvenance(options) {
|
|
|
355
355
|
const qualityMetrics = analyzeQualityMetrics(aiEntries);
|
|
356
356
|
const checkpointAnalysis = analyzeCheckpointUsage(aiEntries);
|
|
357
357
|
|
|
358
|
-
console.log('
|
|
358
|
+
console.log('AI Contribution Patterns:');
|
|
359
359
|
console.log(` Average Composer/Chat contribution: ${contributionPatterns.avgComposerPercent}%`);
|
|
360
360
|
console.log(
|
|
361
361
|
` Average Tab completion contribution: ${contributionPatterns.avgTabCompletePercent}%`
|
|
@@ -363,7 +363,7 @@ async function analyzeAIProvenance(options) {
|
|
|
363
363
|
console.log(` Average Manual override rate: ${contributionPatterns.avgManualPercent}%`);
|
|
364
364
|
console.log('');
|
|
365
365
|
|
|
366
|
-
console.log('
|
|
366
|
+
console.log('Quality Metrics:');
|
|
367
367
|
console.log(
|
|
368
368
|
` Average AI code quality score: ${Math.round(qualityMetrics.avgQualityScore * 100)}%`
|
|
369
369
|
);
|
|
@@ -373,7 +373,7 @@ async function analyzeAIProvenance(options) {
|
|
|
373
373
|
);
|
|
374
374
|
console.log('');
|
|
375
375
|
|
|
376
|
-
console.log('
|
|
376
|
+
console.log('Checkpoint Analysis:');
|
|
377
377
|
console.log(
|
|
378
378
|
` Commits with checkpoints: ${checkpointAnalysis.entriesWithCheckpoints}/${aiEntries.length}`
|
|
379
379
|
);
|
|
@@ -521,29 +521,29 @@ function analyzeCheckpointUsage(aiEntries) {
|
|
|
521
521
|
async function installHooks(options) {
|
|
522
522
|
const { output = '.caws/provenance', skipPreCommit = false, skipPostCommit = false } = options;
|
|
523
523
|
|
|
524
|
-
console.log('
|
|
525
|
-
console.log('
|
|
524
|
+
console.log('Installing CAWS Provenance Git Hooks');
|
|
525
|
+
console.log('==================================================');
|
|
526
526
|
|
|
527
527
|
// Check if we're in a git repository
|
|
528
528
|
if (!(await fs.pathExists('.git'))) {
|
|
529
|
-
console.log('
|
|
530
|
-
console.log('
|
|
529
|
+
console.log('Not in a git repository');
|
|
530
|
+
console.log('Initialize git first: git init');
|
|
531
531
|
process.exit(1);
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
// Check if provenance is initialized
|
|
535
535
|
if (!(await fs.pathExists(path.join(output, 'chain.json')))) {
|
|
536
|
-
console.log('
|
|
537
|
-
console.log('
|
|
536
|
+
console.log('Provenance not initialized');
|
|
537
|
+
console.log('Run "caws provenance init" first');
|
|
538
538
|
process.exit(1);
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
-
console.log('
|
|
541
|
+
console.log('Found git repository and provenance setup');
|
|
542
542
|
|
|
543
543
|
// Ensure hooks directory exists
|
|
544
544
|
const hooksDir = '.git/hooks';
|
|
545
545
|
await fs.ensureDir(hooksDir);
|
|
546
|
-
console.log('
|
|
546
|
+
console.log('Ensured hooks directory exists');
|
|
547
547
|
|
|
548
548
|
let hooksInstalled = 0;
|
|
549
549
|
|
|
@@ -555,10 +555,10 @@ async function installHooks(options) {
|
|
|
555
555
|
|
|
556
556
|
await fs.writeFile(preCommitPath, preCommitHook);
|
|
557
557
|
await fs.chmod(preCommitPath, '755');
|
|
558
|
-
console.log('
|
|
558
|
+
console.log('Installed pre-commit hook for provenance validation');
|
|
559
559
|
hooksInstalled++;
|
|
560
560
|
} catch (error) {
|
|
561
|
-
console.warn('
|
|
561
|
+
console.warn('Failed to install pre-commit hook:', error.message);
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
|
|
@@ -570,25 +570,25 @@ async function installHooks(options) {
|
|
|
570
570
|
|
|
571
571
|
await fs.writeFile(postCommitPath, postCommitHook);
|
|
572
572
|
await fs.chmod(postCommitPath, '755');
|
|
573
|
-
console.log('
|
|
573
|
+
console.log('Installed post-commit hook for provenance updates');
|
|
574
574
|
hooksInstalled++;
|
|
575
575
|
} catch (error) {
|
|
576
|
-
console.warn('
|
|
576
|
+
console.warn('Failed to install post-commit hook:', error.message);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
console.log('');
|
|
581
|
-
console.log('
|
|
581
|
+
console.log('Git hooks installation complete!');
|
|
582
582
|
console.log('');
|
|
583
583
|
console.log(`Installed ${hooksInstalled} hook(s):`);
|
|
584
584
|
if (!skipPreCommit) {
|
|
585
|
-
console.log('
|
|
585
|
+
console.log(' - pre-commit: Validates provenance before commits');
|
|
586
586
|
}
|
|
587
587
|
if (!skipPostCommit) {
|
|
588
|
-
console.log('
|
|
588
|
+
console.log(' - post-commit: Updates provenance after commits');
|
|
589
589
|
}
|
|
590
590
|
console.log('');
|
|
591
|
-
console.log('
|
|
591
|
+
console.log('Your commits will now automatically maintain provenance!');
|
|
592
592
|
console.log(' Run "caws provenance show" to view the updated chain');
|
|
593
593
|
}
|
|
594
594
|
|
|
@@ -605,7 +605,7 @@ async function createPreCommitHook(outputDir) {
|
|
|
605
605
|
# CAWS Provenance Pre-commit Hook
|
|
606
606
|
# Validates provenance integrity before allowing commits
|
|
607
607
|
|
|
608
|
-
echo "
|
|
608
|
+
echo "Validating CAWS provenance..."
|
|
609
609
|
|
|
610
610
|
# Find caws CLI
|
|
611
611
|
if command -v caws >/dev/null 2>&1; then
|
|
@@ -615,17 +615,17 @@ elif [ -x "${scriptPath}" ]; then
|
|
|
615
615
|
elif [ -x "${fallbackPath}" ]; then
|
|
616
616
|
CAWS_CMD="node ${fallbackPath}"
|
|
617
617
|
else
|
|
618
|
-
echo "
|
|
618
|
+
echo "CAWS CLI not found, skipping provenance validation"
|
|
619
619
|
exit 0
|
|
620
620
|
fi
|
|
621
621
|
|
|
622
622
|
# Run provenance verification
|
|
623
623
|
if $CAWS_CMD provenance verify --output "${outputDir}" >/dev/null 2>&1; then
|
|
624
|
-
echo "
|
|
624
|
+
echo "Provenance validation passed"
|
|
625
625
|
exit 0
|
|
626
626
|
else
|
|
627
|
-
echo "
|
|
628
|
-
echo "
|
|
627
|
+
echo "Provenance validation failed"
|
|
628
|
+
echo "Run 'caws provenance show' to investigate"
|
|
629
629
|
exit 1
|
|
630
630
|
fi
|
|
631
631
|
`;
|
|
@@ -644,7 +644,7 @@ async function createPostCommitHook(outputDir) {
|
|
|
644
644
|
# CAWS Provenance Post-commit Hook
|
|
645
645
|
# Updates provenance chain after successful commits
|
|
646
646
|
|
|
647
|
-
echo "
|
|
647
|
+
echo "Updating CAWS provenance..."
|
|
648
648
|
|
|
649
649
|
# Get the current commit hash
|
|
650
650
|
COMMIT_HASH=$(git rev-parse HEAD)
|
|
@@ -659,15 +659,15 @@ elif [ -x "${scriptPath}" ]; then
|
|
|
659
659
|
elif [ -x "${fallbackPath}" ]; then
|
|
660
660
|
CAWS_CMD="node ${fallbackPath}"
|
|
661
661
|
else
|
|
662
|
-
echo "
|
|
662
|
+
echo "CAWS CLI not found, skipping provenance update"
|
|
663
663
|
exit 0
|
|
664
664
|
fi
|
|
665
665
|
|
|
666
666
|
# Update provenance
|
|
667
667
|
if $CAWS_CMD provenance update --commit "$COMMIT_HASH" --message "$COMMIT_MSG" --author "$AUTHOR" --output "${outputDir}" --quiet; then
|
|
668
|
-
echo "
|
|
668
|
+
echo "Provenance updated for commit \${COMMIT_HASH:0:8}"
|
|
669
669
|
else
|
|
670
|
-
echo "
|
|
670
|
+
echo "Failed to update provenance (non-fatal)"
|
|
671
671
|
fi
|
|
672
672
|
|
|
673
673
|
exit 0
|
|
@@ -707,7 +707,7 @@ async function showDashboardFormat(chain, outputDir) {
|
|
|
707
707
|
: 0;
|
|
708
708
|
|
|
709
709
|
// Check config
|
|
710
|
-
let configStatus = '
|
|
710
|
+
let configStatus = 'Not configured';
|
|
711
711
|
try {
|
|
712
712
|
const configPath = path.join(outputDir, 'config.json');
|
|
713
713
|
if (await fs.pathExists(configPath)) {
|
|
@@ -717,24 +717,24 @@ async function showDashboardFormat(chain, outputDir) {
|
|
|
717
717
|
config.cursor_checkpoint_api !== 'not_configured',
|
|
718
718
|
config.cursor_project_id !== 'not_configured',
|
|
719
719
|
].filter(Boolean).length;
|
|
720
|
-
configStatus = configured === 3 ? '
|
|
720
|
+
configStatus = configured === 3 ? 'Fully configured' : `${configured}/3 configured`;
|
|
721
721
|
}
|
|
722
722
|
} catch (error) {
|
|
723
723
|
// Ignore config read errors
|
|
724
724
|
}
|
|
725
725
|
|
|
726
726
|
// Display dashboard
|
|
727
|
-
console.log('
|
|
728
|
-
console.log(`ā
|
|
729
|
-
console.log(`ā
|
|
727
|
+
console.log('ā- CAWS Provenance Dashboard ----------------------ā');
|
|
728
|
+
console.log(`ā Total Entries: ${totalEntries.toString().padEnd(33)} ā`);
|
|
729
|
+
console.log(`ā AI-Assisted: ${aiEntries.toString().padEnd(35)} ā`);
|
|
730
730
|
console.log(
|
|
731
|
-
`ā
|
|
731
|
+
`ā Avg Quality: ${(avgQualityScore * 100).toFixed(0).padEnd(2)}%${' '.repeat(33)} ā`
|
|
732
732
|
);
|
|
733
733
|
console.log(
|
|
734
|
-
`ā
|
|
734
|
+
`ā Avg Acceptance: ${(avgAcceptanceRate * 100).toFixed(0).padEnd(2)}%${' '.repeat(30)} ā`
|
|
735
735
|
);
|
|
736
|
-
console.log(`ā
|
|
737
|
-
console.log('
|
|
736
|
+
console.log(`ā Config Status: ${configStatus.padEnd(31)} ā`);
|
|
737
|
+
console.log('ā-------------------------------------------------ā¤');
|
|
738
738
|
|
|
739
739
|
if (totalEntries > 0) {
|
|
740
740
|
console.log('ā Recent Activity: ā');
|
|
@@ -748,7 +748,7 @@ async function showDashboardFormat(chain, outputDir) {
|
|
|
748
748
|
});
|
|
749
749
|
|
|
750
750
|
if (aiEntries > 0) {
|
|
751
|
-
console.log('
|
|
751
|
+
console.log('ā-------------------------------------------------ā¤');
|
|
752
752
|
console.log('ā AI Contribution Breakdown: ā');
|
|
753
753
|
|
|
754
754
|
const contributions = chain
|
|
@@ -783,20 +783,20 @@ async function showDashboardFormat(chain, outputDir) {
|
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
|
|
786
|
-
console.log('
|
|
786
|
+
console.log('ā-------------------------------------------------ā');
|
|
787
787
|
|
|
788
788
|
// Add insights
|
|
789
789
|
if (aiEntries > 0) {
|
|
790
790
|
console.log('');
|
|
791
|
-
console.log('
|
|
791
|
+
console.log('Insights:');
|
|
792
792
|
if (avgAcceptanceRate > 0.9) {
|
|
793
|
-
console.log('
|
|
793
|
+
console.log(' High AI acceptance rate indicates effective collaboration');
|
|
794
794
|
} else if (avgAcceptanceRate < 0.7) {
|
|
795
|
-
console.log('
|
|
795
|
+
console.log(' Lower acceptance rate may indicate AI refinement needed');
|
|
796
796
|
}
|
|
797
797
|
|
|
798
798
|
if (avgQualityScore > 0.8) {
|
|
799
|
-
console.log('
|
|
799
|
+
console.log(' Excellent AI code quality - great results!');
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
}
|
|
@@ -805,37 +805,37 @@ async function showDashboardFormat(chain, outputDir) {
|
|
|
805
805
|
* Provide insights and recommendations based on AI analysis
|
|
806
806
|
*/
|
|
807
807
|
function provideAIInsights(contributionPatterns, qualityMetrics, checkpointAnalysis) {
|
|
808
|
-
console.log('
|
|
808
|
+
console.log('AI Effectiveness Insights:');
|
|
809
809
|
|
|
810
810
|
if (contributionPatterns.avgComposerPercent > 60) {
|
|
811
|
-
console.log('
|
|
811
|
+
console.log(' High Composer usage suggests complex feature development');
|
|
812
812
|
console.log(' ā Consider breaking large features into smaller, focused sessions');
|
|
813
813
|
}
|
|
814
814
|
|
|
815
815
|
if (qualityMetrics.avgOverrideRate > 0.2) {
|
|
816
|
-
console.log('
|
|
816
|
+
console.log(' High human override rate indicates AI suggestions need refinement');
|
|
817
817
|
console.log(' ā Review AI confidence thresholds or provide clearer requirements');
|
|
818
818
|
}
|
|
819
819
|
|
|
820
820
|
if (checkpointAnalysis.avgCheckpointsPerEntry < 2) {
|
|
821
|
-
console.log('
|
|
821
|
+
console.log(' Low checkpoint usage may limit ability to recover from bad AI directions');
|
|
822
822
|
console.log(' ā Encourage more frequent checkpointing in Composer sessions');
|
|
823
823
|
}
|
|
824
824
|
|
|
825
825
|
if (qualityMetrics.avgAcceptanceRate > 0.9) {
|
|
826
|
-
console.log('
|
|
826
|
+
console.log(' High acceptance rate indicates effective AI assistance');
|
|
827
827
|
console.log(' ā Current AI integration is working well');
|
|
828
828
|
}
|
|
829
829
|
|
|
830
830
|
console.log('');
|
|
831
|
-
console.log('
|
|
831
|
+
console.log('Recommendations:');
|
|
832
832
|
console.log(
|
|
833
|
-
`
|
|
833
|
+
` - Target Composer contribution: ${Math.max(40, contributionPatterns.avgComposerPercent - 10)}-${Math.min(80, contributionPatterns.avgComposerPercent + 10)}%`
|
|
834
834
|
);
|
|
835
835
|
console.log(
|
|
836
|
-
`
|
|
836
|
+
` - Acceptable override rate: <${Math.round((qualityMetrics.avgOverrideRate + 0.1) * 100)}%`
|
|
837
837
|
);
|
|
838
|
-
console.log('
|
|
838
|
+
console.log(' - Checkpoint frequency: Every 10-15 minutes in active sessions');
|
|
839
839
|
}
|
|
840
840
|
|
|
841
841
|
/**
|
|
@@ -913,37 +913,37 @@ async function getCursorTrackingData(commitHash) {
|
|
|
913
913
|
async function initProvenance(options) {
|
|
914
914
|
const { output = '.caws/provenance', cursorApi } = options;
|
|
915
915
|
|
|
916
|
-
console.log('
|
|
917
|
-
console.log('
|
|
916
|
+
console.log('Initializing CAWS Provenance Tracking');
|
|
917
|
+
console.log('===================================================');
|
|
918
918
|
|
|
919
919
|
// Check if already initialized
|
|
920
920
|
if (await fs.pathExists(path.join(output, 'chain.json'))) {
|
|
921
|
-
console.log('
|
|
921
|
+
console.log('Provenance already initialized');
|
|
922
922
|
console.log(` Chain exists at: ${output}/chain.json`);
|
|
923
923
|
console.log('');
|
|
924
|
-
console.log('
|
|
924
|
+
console.log('To reset, delete the provenance directory and run again');
|
|
925
925
|
return;
|
|
926
926
|
}
|
|
927
927
|
|
|
928
928
|
// Ensure output directory exists
|
|
929
929
|
await fs.ensureDir(output);
|
|
930
|
-
console.log(
|
|
930
|
+
console.log(`Created provenance directory: ${output}`);
|
|
931
931
|
|
|
932
932
|
// Load working spec to validate CAWS project
|
|
933
933
|
const specPath = '.caws/working-spec.yaml';
|
|
934
934
|
if (!(await fs.pathExists(specPath))) {
|
|
935
935
|
console.log('');
|
|
936
|
-
console.log('
|
|
937
|
-
console.log('
|
|
936
|
+
console.log('Not in a CAWS project - missing working spec');
|
|
937
|
+
console.log('Run "caws init" first to create a CAWS project');
|
|
938
938
|
process.exit(1);
|
|
939
939
|
}
|
|
940
940
|
|
|
941
|
-
console.log('
|
|
941
|
+
console.log('Found CAWS working spec');
|
|
942
942
|
|
|
943
943
|
// Initialize empty chain
|
|
944
944
|
const initialChain = [];
|
|
945
945
|
await saveProvenanceChain(initialChain, output);
|
|
946
|
-
console.log('
|
|
946
|
+
console.log('Initialized empty provenance chain');
|
|
947
947
|
|
|
948
948
|
// Create environment configuration hints
|
|
949
949
|
const envConfig = {
|
|
@@ -958,10 +958,10 @@ async function initProvenance(options) {
|
|
|
958
958
|
};
|
|
959
959
|
|
|
960
960
|
await fs.writeFile(path.join(output, 'config.json'), JSON.stringify(envConfig, null, 2));
|
|
961
|
-
console.log('
|
|
961
|
+
console.log('Created configuration template');
|
|
962
962
|
|
|
963
963
|
console.log('');
|
|
964
|
-
console.log('
|
|
964
|
+
console.log('Provenance tracking initialized!');
|
|
965
965
|
console.log('');
|
|
966
966
|
console.log('Next steps:');
|
|
967
967
|
console.log('1. Install git hooks for automatic provenance (recommended):');
|
|
@@ -288,9 +288,9 @@ async function qualityGatesCommand(options = {}) {
|
|
|
288
288
|
throw new Error(
|
|
289
289
|
'Quality gates runner not found.\n\n' +
|
|
290
290
|
'Expected locations:\n' +
|
|
291
|
-
`
|
|
292
|
-
`
|
|
293
|
-
`
|
|
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
294
|
'Available options:\n' +
|
|
295
295
|
suggestions.map((s, i) => ` ${i + 1}. ${s}`).join('\n')
|
|
296
296
|
);
|
|
@@ -319,7 +319,7 @@ async function qualityGatesCommand(options = {}) {
|
|
|
319
319
|
// Handle context options: --all-files takes precedence, then --context
|
|
320
320
|
if (options.allFiles) {
|
|
321
321
|
args.push('--context=ci');
|
|
322
|
-
} else if (options.context
|
|
322
|
+
} else if (options.context) {
|
|
323
323
|
args.push(`--context=${options.context}`);
|
|
324
324
|
}
|
|
325
325
|
|
|
@@ -154,17 +154,17 @@ async function qualityMonitorCommand(action, options = {}) {
|
|
|
154
154
|
context =
|
|
155
155
|
typeof options.context === 'string' ? JSON.parse(options.context) : options.context;
|
|
156
156
|
} catch (e) {
|
|
157
|
-
console.warn(chalk.yellow('
|
|
157
|
+
console.warn(chalk.yellow('Invalid context JSON, ignoring'));
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
// Validate action
|
|
162
162
|
const validActions = ['file_saved', 'code_edited', 'test_run'];
|
|
163
163
|
if (!validActions.includes(action)) {
|
|
164
|
-
console.error(chalk.red(`\
|
|
165
|
-
console.log(chalk.blue('\
|
|
164
|
+
console.error(chalk.red(`\nInvalid action: ${action}`));
|
|
165
|
+
console.log(chalk.blue('\nValid actions:'));
|
|
166
166
|
validActions.forEach((a) => {
|
|
167
|
-
console.log(chalk.blue(`
|
|
167
|
+
console.log(chalk.blue(` - ${a}`));
|
|
168
168
|
});
|
|
169
169
|
process.exit(1);
|
|
170
170
|
}
|
|
@@ -173,8 +173,8 @@ async function qualityMonitorCommand(action, options = {}) {
|
|
|
173
173
|
const analysis = analyzeQualityImpact(action, files, context);
|
|
174
174
|
|
|
175
175
|
// Display results
|
|
176
|
-
console.log(chalk.bold('\
|
|
177
|
-
console.log('
|
|
176
|
+
console.log(chalk.bold('\nCAWS Quality Monitor\n'));
|
|
177
|
+
console.log('-'.repeat(60));
|
|
178
178
|
|
|
179
179
|
// Action info
|
|
180
180
|
console.log(chalk.bold(`\nAction: ${action}`));
|
|
@@ -184,11 +184,11 @@ async function qualityMonitorCommand(action, options = {}) {
|
|
|
184
184
|
console.log(chalk.bold(`\nFiles Affected: ${analysis.files_affected}`));
|
|
185
185
|
if (files.length > 0 && files.length <= 10) {
|
|
186
186
|
files.forEach((file) => {
|
|
187
|
-
console.log(chalk.gray(`
|
|
187
|
+
console.log(chalk.gray(` - ${file}`));
|
|
188
188
|
});
|
|
189
189
|
} else if (files.length > 10) {
|
|
190
190
|
files.slice(0, 10).forEach((file) => {
|
|
191
|
-
console.log(chalk.gray(`
|
|
191
|
+
console.log(chalk.gray(` - ${file}`));
|
|
192
192
|
});
|
|
193
193
|
console.log(chalk.gray(` ... and ${files.length - 10} more`));
|
|
194
194
|
}
|
|
@@ -202,7 +202,7 @@ async function qualityMonitorCommand(action, options = {}) {
|
|
|
202
202
|
? chalk.yellow
|
|
203
203
|
: chalk.blue;
|
|
204
204
|
|
|
205
|
-
console.log(chalk.bold('\
|
|
205
|
+
console.log(chalk.bold('\nQuality Impact:'));
|
|
206
206
|
console.log(impactColor(` ${analysis.quality_impact}`));
|
|
207
207
|
|
|
208
208
|
// Risk level
|
|
@@ -213,31 +213,31 @@ async function qualityMonitorCommand(action, options = {}) {
|
|
|
213
213
|
? chalk.yellow
|
|
214
214
|
: chalk.green;
|
|
215
215
|
|
|
216
|
-
console.log(chalk.bold('\
|
|
216
|
+
console.log(chalk.bold('\nRisk Level:'));
|
|
217
217
|
console.log(riskColor(` ${analysis.risk_level.toUpperCase()}`));
|
|
218
218
|
|
|
219
219
|
// Project tier
|
|
220
220
|
if (analysis.project_tier) {
|
|
221
|
-
console.log(chalk.bold(`\
|
|
221
|
+
console.log(chalk.bold(`\nProject Tier: ${analysis.project_tier}`));
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
// Quality gates
|
|
225
225
|
if (analysis.quality_gates && analysis.quality_gates.length > 0) {
|
|
226
|
-
console.log(chalk.bold('\
|
|
226
|
+
console.log(chalk.bold('\nQuality Gates to Check:\n'));
|
|
227
227
|
analysis.quality_gates.forEach((gate) => {
|
|
228
228
|
console.log(chalk.gray(` ā” ${gate}`));
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
// Recommendations
|
|
233
|
-
console.log(chalk.bold('\
|
|
233
|
+
console.log(chalk.bold('\nRecommendations:\n'));
|
|
234
234
|
analysis.recommendations.forEach((rec, idx) => {
|
|
235
|
-
const icon = idx === 0 ? '
|
|
235
|
+
const icon = idx === 0 ? '' : ' -';
|
|
236
236
|
console.log(chalk.blue(` ${icon} ${rec}`));
|
|
237
237
|
});
|
|
238
238
|
|
|
239
239
|
// Suggested commands
|
|
240
|
-
console.log(chalk.bold('\
|
|
240
|
+
console.log(chalk.bold('\nSuggested Commands:\n'));
|
|
241
241
|
switch (action) {
|
|
242
242
|
case 'file_saved':
|
|
243
243
|
case 'code_edited':
|
|
@@ -251,9 +251,9 @@ async function qualityMonitorCommand(action, options = {}) {
|
|
|
251
251
|
break;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
console.log('\n' + '
|
|
254
|
+
console.log('\n' + '-'.repeat(60) + '\n');
|
|
255
255
|
} catch (error) {
|
|
256
|
-
console.error(chalk.red(`\
|
|
256
|
+
console.error(chalk.red(`\nQuality monitoring failed: ${error.message}`));
|
|
257
257
|
console.error(chalk.gray(error.stack));
|
|
258
258
|
process.exit(1);
|
|
259
259
|
}
|