@wundr.io/cli 1.0.3 → 1.0.4
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/ai.d.ts +2 -2
- package/dist/commands/ai.d.ts.map +1 -1
- package/dist/commands/ai.js +93 -29
- package/dist/commands/ai.js.map +1 -1
- package/dist/commands/analyze-optimized.d.ts.map +1 -1
- package/dist/commands/analyze-optimized.js +187 -27
- package/dist/commands/analyze-optimized.js.map +1 -1
- package/package.json +9 -26
- package/src/cli.ts +4 -4
- package/src/commands/ai.ts +141 -35
- package/src/commands/alignment.ts +74 -74
- package/src/commands/analyze-optimized.ts +324 -27
- package/src/commands/computer-setup.ts +33 -33
- package/src/commands/governance.ts +34 -34
- package/src/commands/guardian.ts +56 -56
- package/src/commands/session.ts +35 -35
- package/src/commands/vp.ts +26 -26
- package/src/commands/worktree.ts +49 -49
|
@@ -243,7 +243,7 @@ async function runComplianceCheck(options: CheckOptions): Promise<void> {
|
|
|
243
243
|
'WUNDR_GOV_CHECK_FAILED',
|
|
244
244
|
'Failed to run IPRE compliance check',
|
|
245
245
|
{ options },
|
|
246
|
-
true
|
|
246
|
+
true,
|
|
247
247
|
);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
@@ -289,7 +289,7 @@ async function generateAlignmentReport(options: ReportOptions): Promise<void> {
|
|
|
289
289
|
totalDebt: calculateAlignmentDebt(
|
|
290
290
|
complianceResult,
|
|
291
291
|
alignmentEvalResult,
|
|
292
|
-
driftEvalResult
|
|
292
|
+
driftEvalResult,
|
|
293
293
|
),
|
|
294
294
|
criticalIssues: countCriticalIssues(complianceResult),
|
|
295
295
|
highPriorityItems: countHighPriorityItems(alignmentEvalResult),
|
|
@@ -310,7 +310,7 @@ async function generateAlignmentReport(options: ReportOptions): Promise<void> {
|
|
|
310
310
|
recommendations: generateRecommendations(
|
|
311
311
|
complianceResult,
|
|
312
312
|
alignmentEvalResult,
|
|
313
|
-
driftEvalResult
|
|
313
|
+
driftEvalResult,
|
|
314
314
|
),
|
|
315
315
|
};
|
|
316
316
|
|
|
@@ -327,17 +327,17 @@ async function generateAlignmentReport(options: ReportOptions): Promise<void> {
|
|
|
327
327
|
// Display summary
|
|
328
328
|
console.log(chalk.blue('\n--- Report Summary ---'));
|
|
329
329
|
console.log(
|
|
330
|
-
`Total Alignment Debt: ${chalk.yellow(report.summary.totalDebt.toFixed(2))}
|
|
330
|
+
`Total Alignment Debt: ${chalk.yellow(report.summary.totalDebt.toFixed(2))}`,
|
|
331
331
|
);
|
|
332
332
|
console.log(`Critical Issues: ${chalk.red(report.summary.criticalIssues)}`);
|
|
333
333
|
console.log(
|
|
334
|
-
`High Priority Items: ${chalk.yellow(report.summary.highPriorityItems)}
|
|
334
|
+
`High Priority Items: ${chalk.yellow(report.summary.highPriorityItems)}`,
|
|
335
335
|
);
|
|
336
336
|
console.log(
|
|
337
|
-
`Alignment Score: ${colorScore(report.summary.alignmentScore)}
|
|
337
|
+
`Alignment Score: ${colorScore(report.summary.alignmentScore)}`,
|
|
338
338
|
);
|
|
339
339
|
console.log(
|
|
340
|
-
`Compliance Score: ${colorScore(report.summary.complianceScore)}
|
|
340
|
+
`Compliance Score: ${colorScore(report.summary.complianceScore)}`,
|
|
341
341
|
);
|
|
342
342
|
console.log(`Drift Score: ${colorScore(1 - report.summary.driftScore)}`);
|
|
343
343
|
} catch (error) {
|
|
@@ -345,7 +345,7 @@ async function generateAlignmentReport(options: ReportOptions): Promise<void> {
|
|
|
345
345
|
'WUNDR_GOV_REPORT_FAILED',
|
|
346
346
|
'Failed to generate alignment debt report',
|
|
347
347
|
{ options },
|
|
348
|
-
true
|
|
348
|
+
true,
|
|
349
349
|
);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
@@ -381,7 +381,7 @@ async function showGovernanceStatus(): Promise<void> {
|
|
|
381
381
|
console.log(chalk.bold('Alignment Score:'));
|
|
382
382
|
displayProgressBar(status.alignmentScore);
|
|
383
383
|
console.log(
|
|
384
|
-
` ${colorScore(status.alignmentScore)} (${(status.alignmentScore * 100).toFixed(1)}%)\n
|
|
384
|
+
` ${colorScore(status.alignmentScore)} (${(status.alignmentScore * 100).toFixed(1)}%)\n`,
|
|
385
385
|
);
|
|
386
386
|
|
|
387
387
|
// Policy Violations
|
|
@@ -393,7 +393,7 @@ async function showGovernanceStatus(): Promise<void> {
|
|
|
393
393
|
console.log(` - Security: ${violationStats.byCategory.security}`);
|
|
394
394
|
console.log(` - Compliance: ${violationStats.byCategory.compliance}`);
|
|
395
395
|
console.log(
|
|
396
|
-
` - Operational: ${violationStats.byCategory.operational}
|
|
396
|
+
` - Operational: ${violationStats.byCategory.operational}`,
|
|
397
397
|
);
|
|
398
398
|
}
|
|
399
399
|
console.log();
|
|
@@ -408,7 +408,7 @@ async function showGovernanceStatus(): Promise<void> {
|
|
|
408
408
|
? chalk.green('[RESOLVED]')
|
|
409
409
|
: chalk.yellow('[OPEN]');
|
|
410
410
|
console.log(
|
|
411
|
-
` ${statusIcon} ${intervention.type}: ${intervention.description}
|
|
411
|
+
` ${statusIcon} ${intervention.type}: ${intervention.description}`,
|
|
412
412
|
);
|
|
413
413
|
}
|
|
414
414
|
}
|
|
@@ -424,7 +424,7 @@ async function showGovernanceStatus(): Promise<void> {
|
|
|
424
424
|
const direction = indicator.change > 0 ? '+' : '';
|
|
425
425
|
console.log(
|
|
426
426
|
` ${severityColor(`[${indicator.severity.toUpperCase()}]`)} ` +
|
|
427
|
-
`${indicator.pattern}: ${direction}${(indicator.change * 100).toFixed(1)}
|
|
427
|
+
`${indicator.pattern}: ${direction}${(indicator.change * 100).toFixed(1)}%`,
|
|
428
428
|
);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
@@ -433,13 +433,13 @@ async function showGovernanceStatus(): Promise<void> {
|
|
|
433
433
|
// Last Check
|
|
434
434
|
if (status.lastCheck) {
|
|
435
435
|
console.log(
|
|
436
|
-
chalk.gray(`Last check: ${status.lastCheck.toLocaleString()}`)
|
|
436
|
+
chalk.gray(`Last check: ${status.lastCheck.toLocaleString()}`),
|
|
437
437
|
);
|
|
438
438
|
} else {
|
|
439
439
|
console.log(
|
|
440
440
|
chalk.gray(
|
|
441
|
-
'No previous checks found. Run "wundr governance check" to start.'
|
|
442
|
-
)
|
|
441
|
+
'No previous checks found. Run "wundr governance check" to start.',
|
|
442
|
+
),
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
445
|
} catch (error) {
|
|
@@ -447,7 +447,7 @@ async function showGovernanceStatus(): Promise<void> {
|
|
|
447
447
|
'WUNDR_GOV_STATUS_FAILED',
|
|
448
448
|
'Failed to fetch governance status',
|
|
449
449
|
{},
|
|
450
|
-
true
|
|
450
|
+
true,
|
|
451
451
|
);
|
|
452
452
|
}
|
|
453
453
|
}
|
|
@@ -504,7 +504,7 @@ async function validateIPREConfig(file: string): Promise<void> {
|
|
|
504
504
|
'WUNDR_GOV_VALIDATE_FAILED',
|
|
505
505
|
`Failed to validate IPRE config: ${message}`,
|
|
506
506
|
{ file },
|
|
507
|
-
true
|
|
507
|
+
true,
|
|
508
508
|
);
|
|
509
509
|
}
|
|
510
510
|
}
|
|
@@ -515,7 +515,7 @@ async function validateIPREConfig(file: string): Promise<void> {
|
|
|
515
515
|
|
|
516
516
|
function displayComplianceResult(
|
|
517
517
|
result: ComplianceResult,
|
|
518
|
-
verbose: boolean
|
|
518
|
+
verbose: boolean,
|
|
519
519
|
): void {
|
|
520
520
|
const statusIcon = result.compliant
|
|
521
521
|
? chalk.green('[PASS]')
|
|
@@ -529,7 +529,7 @@ function displayComplianceResult(
|
|
|
529
529
|
console.log(chalk.yellow('\n Violations:'));
|
|
530
530
|
for (const violation of result.violations) {
|
|
531
531
|
console.log(
|
|
532
|
-
` - [${violation.severity.toUpperCase()}] ${violation.policyName}
|
|
532
|
+
` - [${violation.severity.toUpperCase()}] ${violation.policyName}`,
|
|
533
533
|
);
|
|
534
534
|
console.log(` ${violation.description}`);
|
|
535
535
|
if (violation.suggestedFix) {
|
|
@@ -541,7 +541,7 @@ function displayComplianceResult(
|
|
|
541
541
|
|
|
542
542
|
function displayAlignmentResult(
|
|
543
543
|
result: EvaluationResult,
|
|
544
|
-
verbose: boolean
|
|
544
|
+
verbose: boolean,
|
|
545
545
|
): void {
|
|
546
546
|
const statusIcon = result.passed
|
|
547
547
|
? chalk.green('[PASS]')
|
|
@@ -572,7 +572,7 @@ function displayDriftResult(result: EvaluationResult, verbose: boolean): void {
|
|
|
572
572
|
? chalk.green('[PASS]')
|
|
573
573
|
: chalk.red('[FAIL]');
|
|
574
574
|
console.log(
|
|
575
|
-
`${statusIcon} Drift Score: ${colorScore(result.score)} (${(driftScore * 100).toFixed(1)}% drift)
|
|
575
|
+
`${statusIcon} Drift Score: ${colorScore(result.score)} (${(driftScore * 100).toFixed(1)}% drift)`,
|
|
576
576
|
);
|
|
577
577
|
console.log(` Drift Alerts: ${result.issues.length}`);
|
|
578
578
|
|
|
@@ -594,19 +594,19 @@ function displaySummary(result: {
|
|
|
594
594
|
? chalk.green('[PASSED]')
|
|
595
595
|
: chalk.red('[FAILED]');
|
|
596
596
|
console.log(
|
|
597
|
-
`\n${statusIcon} Overall Score: ${colorScore(result.overallScore)}
|
|
597
|
+
`\n${statusIcon} Overall Score: ${colorScore(result.overallScore)}`,
|
|
598
598
|
);
|
|
599
599
|
|
|
600
600
|
if (result.criticalIssues.length > 0) {
|
|
601
601
|
console.log(
|
|
602
|
-
chalk.red(`\nCritical Issues (${result.criticalIssues.length}):`)
|
|
602
|
+
chalk.red(`\nCritical Issues (${result.criticalIssues.length}):`),
|
|
603
603
|
);
|
|
604
604
|
for (const issue of result.criticalIssues.slice(0, 5)) {
|
|
605
605
|
console.log(chalk.red(` - ${issue}`));
|
|
606
606
|
}
|
|
607
607
|
if (result.criticalIssues.length > 5) {
|
|
608
608
|
console.log(
|
|
609
|
-
chalk.gray(` ... and ${result.criticalIssues.length - 5} more`)
|
|
609
|
+
chalk.gray(` ... and ${result.criticalIssues.length - 5} more`),
|
|
610
610
|
);
|
|
611
611
|
}
|
|
612
612
|
}
|
|
@@ -648,7 +648,7 @@ function displayProgressBar(score: number): void {
|
|
|
648
648
|
function calculateAlignmentDebt(
|
|
649
649
|
compliance: ComplianceResult,
|
|
650
650
|
alignment: EvaluationResult,
|
|
651
|
-
drift: EvaluationResult
|
|
651
|
+
drift: EvaluationResult,
|
|
652
652
|
): number {
|
|
653
653
|
// Calculate debt as weighted sum of issues
|
|
654
654
|
const complianceDebt = (1 - compliance.score) * 0.4;
|
|
@@ -666,7 +666,7 @@ function countHighPriorityItems(alignment: EvaluationResult): number {
|
|
|
666
666
|
return alignment.issues.filter(
|
|
667
667
|
issue =>
|
|
668
668
|
issue.toLowerCase().includes('critical') ||
|
|
669
|
-
issue.toLowerCase().includes('high')
|
|
669
|
+
issue.toLowerCase().includes('high'),
|
|
670
670
|
).length;
|
|
671
671
|
}
|
|
672
672
|
|
|
@@ -723,21 +723,21 @@ function extractDriftAlerts(result: EvaluationResult): DriftAlertDetail[] {
|
|
|
723
723
|
function generateRecommendations(
|
|
724
724
|
compliance: ComplianceResult,
|
|
725
725
|
alignment: EvaluationResult,
|
|
726
|
-
drift: EvaluationResult
|
|
726
|
+
drift: EvaluationResult,
|
|
727
727
|
): string[] {
|
|
728
728
|
const recommendations: string[] = [];
|
|
729
729
|
|
|
730
730
|
// Add compliance recommendations
|
|
731
731
|
if (compliance.violations.length > 0) {
|
|
732
732
|
recommendations.push(
|
|
733
|
-
'Address policy violations immediately, especially critical ones'
|
|
733
|
+
'Address policy violations immediately, especially critical ones',
|
|
734
734
|
);
|
|
735
735
|
const criticalCount = compliance.violations.filter(
|
|
736
|
-
v => v.severity === 'critical'
|
|
736
|
+
v => v.severity === 'critical',
|
|
737
737
|
).length;
|
|
738
738
|
if (criticalCount > 0) {
|
|
739
739
|
recommendations.push(
|
|
740
|
-
`Fix ${criticalCount} critical policy violation(s) before deployment
|
|
740
|
+
`Fix ${criticalCount} critical policy violation(s) before deployment`,
|
|
741
741
|
);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
@@ -893,10 +893,10 @@ function displayConfigSummary(config: IPREConfig): void {
|
|
|
893
893
|
console.log(`Values: ${config.intent?.values?.length || 0} defined`);
|
|
894
894
|
console.log(`Security Policies: ${config.policies?.security?.length || 0}`);
|
|
895
895
|
console.log(
|
|
896
|
-
`Compliance Policies: ${config.policies?.compliance?.length || 0}
|
|
896
|
+
`Compliance Policies: ${config.policies?.compliance?.length || 0}`,
|
|
897
897
|
);
|
|
898
898
|
console.log(
|
|
899
|
-
`Operational Policies: ${config.policies?.operational?.length || 0}
|
|
899
|
+
`Operational Policies: ${config.policies?.operational?.length || 0}`,
|
|
900
900
|
);
|
|
901
901
|
console.log(`Evaluators: ${config.evaluators?.length || 0}`);
|
|
902
902
|
if (config.rewards?.threshold) {
|
|
@@ -935,7 +935,7 @@ async function saveGovernanceState(
|
|
|
935
935
|
results: readonly EvaluationResult[];
|
|
936
936
|
criticalIssues: readonly string[];
|
|
937
937
|
};
|
|
938
|
-
}
|
|
938
|
+
},
|
|
939
939
|
): Promise<void> {
|
|
940
940
|
const statePath = path.join(process.cwd(), GOVERNANCE_STATE_PATH);
|
|
941
941
|
await fs.ensureDir(path.dirname(statePath));
|
|
@@ -973,7 +973,7 @@ async function loadRecentInterventions(): Promise<Intervention[]> {
|
|
|
973
973
|
}
|
|
974
974
|
|
|
975
975
|
function extractDriftIndicatorsFromState(
|
|
976
|
-
state: GovernanceState | null
|
|
976
|
+
state: GovernanceState | null,
|
|
977
977
|
): DriftIndicator[] {
|
|
978
978
|
if (!state?.driftResult) {
|
|
979
979
|
return [];
|
package/src/commands/guardian.ts
CHANGED
|
@@ -41,7 +41,7 @@ const SESSIONS_STATE_FILE = path.join(
|
|
|
41
41
|
os.homedir(),
|
|
42
42
|
'.wundr',
|
|
43
43
|
'sessions',
|
|
44
|
-
'state.json'
|
|
44
|
+
'state.json',
|
|
45
45
|
);
|
|
46
46
|
const REPORTS_DIR = path.join(GUARDIAN_BASE_DIR, 'reports');
|
|
47
47
|
|
|
@@ -126,7 +126,7 @@ async function ensureGuardianDir(): Promise<void> {
|
|
|
126
126
|
* Get color function based on severity
|
|
127
127
|
*/
|
|
128
128
|
function getSeverityColor(
|
|
129
|
-
severity: InterventionSeverity
|
|
129
|
+
severity: InterventionSeverity,
|
|
130
130
|
): (str: string) => string {
|
|
131
131
|
switch (severity) {
|
|
132
132
|
case 'critical':
|
|
@@ -184,7 +184,7 @@ async function loadGuardianState(): Promise<GuardianState> {
|
|
|
184
184
|
try {
|
|
185
185
|
const interventionsContent = await fs.readFile(
|
|
186
186
|
INTERVENTIONS_FILE,
|
|
187
|
-
'utf-8'
|
|
187
|
+
'utf-8',
|
|
188
188
|
);
|
|
189
189
|
interventions = JSON.parse(interventionsContent) as StoredIntervention[];
|
|
190
190
|
} catch {
|
|
@@ -211,11 +211,11 @@ async function saveGuardianState(state: GuardianState): Promise<void> {
|
|
|
211
211
|
await ensureGuardianDir();
|
|
212
212
|
await fs.writeFile(
|
|
213
213
|
INTERVENTIONS_FILE,
|
|
214
|
-
JSON.stringify(state.interventions, null, 2)
|
|
214
|
+
JSON.stringify(state.interventions, null, 2),
|
|
215
215
|
);
|
|
216
216
|
await fs.writeFile(
|
|
217
217
|
REVIEW_QUEUE_FILE,
|
|
218
|
-
JSON.stringify(state.reviewQueue, null, 2)
|
|
218
|
+
JSON.stringify(state.reviewQueue, null, 2),
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
|
|
@@ -338,7 +338,7 @@ async function generateReport(options: ReportOptions): Promise<void> {
|
|
|
338
338
|
dateStr,
|
|
339
339
|
report,
|
|
340
340
|
recommendations,
|
|
341
|
-
guardianState
|
|
341
|
+
guardianState,
|
|
342
342
|
);
|
|
343
343
|
|
|
344
344
|
if (options.output) {
|
|
@@ -351,7 +351,7 @@ async function generateReport(options: ReportOptions): Promise<void> {
|
|
|
351
351
|
} catch (error) {
|
|
352
352
|
spinner.fail('Failed to generate report');
|
|
353
353
|
console.error(
|
|
354
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
354
|
+
chalk.red(error instanceof Error ? error.message : String(error)),
|
|
355
355
|
);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -363,7 +363,7 @@ function generateMarkdownReport(
|
|
|
363
363
|
dateStr: string,
|
|
364
364
|
report: AggregatedDriftReport,
|
|
365
365
|
recommendations: InterventionRecommendation[],
|
|
366
|
-
guardianState: GuardianState
|
|
366
|
+
guardianState: GuardianState,
|
|
367
367
|
): string {
|
|
368
368
|
let md = '# Guardian Daily Alignment Report\n\n';
|
|
369
369
|
md += `**Date:** ${dateStr}\n`;
|
|
@@ -411,7 +411,7 @@ function displayTerminalReport(
|
|
|
411
411
|
dateStr: string,
|
|
412
412
|
report: AggregatedDriftReport,
|
|
413
413
|
recommendations: InterventionRecommendation[],
|
|
414
|
-
guardianState: GuardianState
|
|
414
|
+
guardianState: GuardianState,
|
|
415
415
|
): void {
|
|
416
416
|
console.log(chalk.cyan('\n' + '='.repeat(70)));
|
|
417
417
|
console.log(chalk.cyan.bold(' GUARDIAN DAILY ALIGNMENT REPORT'));
|
|
@@ -427,15 +427,15 @@ function displayTerminalReport(
|
|
|
427
427
|
const statusColor = getStatusColor(report.overallStatus);
|
|
428
428
|
console.log(`Total Sessions: ${chalk.white(report.totalSessions)}`);
|
|
429
429
|
console.log(
|
|
430
|
-
`Average Drift Score: ${chalk.white(report.averageScore.toFixed(1))}
|
|
430
|
+
`Average Drift Score: ${chalk.white(report.averageScore.toFixed(1))}`,
|
|
431
431
|
);
|
|
432
432
|
console.log(`Overall Status: ${statusColor(report.overallStatus)}`);
|
|
433
433
|
console.log(`Trend: ${chalk.white(report.trend)}`);
|
|
434
434
|
console.log(
|
|
435
|
-
`Critical Sessions: ${report.criticalSessions.length > 0 ? chalk.red(report.criticalSessions.length) : chalk.green('0')}
|
|
435
|
+
`Critical Sessions: ${report.criticalSessions.length > 0 ? chalk.red(report.criticalSessions.length) : chalk.green('0')}`,
|
|
436
436
|
);
|
|
437
437
|
console.log(
|
|
438
|
-
`Concerning Sessions: ${report.concerningSessions.length > 0 ? chalk.yellow(report.concerningSessions.length) : chalk.green('0')}
|
|
438
|
+
`Concerning Sessions: ${report.concerningSessions.length > 0 ? chalk.yellow(report.concerningSessions.length) : chalk.green('0')}`,
|
|
439
439
|
);
|
|
440
440
|
console.log('');
|
|
441
441
|
|
|
@@ -447,7 +447,7 @@ function displayTerminalReport(
|
|
|
447
447
|
for (const rec of recommendations) {
|
|
448
448
|
const severityColor = getSeverityColor(rec.severity);
|
|
449
449
|
console.log(
|
|
450
|
-
`${severityColor(getSeverityBadge(rec.severity))} ${chalk.white(rec.dimension)}
|
|
450
|
+
`${severityColor(getSeverityBadge(rec.severity))} ${chalk.white(rec.dimension)}`,
|
|
451
451
|
);
|
|
452
452
|
console.log(` Action: ${rec.action}`);
|
|
453
453
|
console.log(` Urgency: ${rec.urgency}h`);
|
|
@@ -465,8 +465,8 @@ function displayTerminalReport(
|
|
|
465
465
|
console.log(chalk.gray('-'.repeat(40)));
|
|
466
466
|
console.log(
|
|
467
467
|
chalk.yellow(
|
|
468
|
-
`${pendingReviews.length} session(s) flagged for Guardian attention
|
|
469
|
-
)
|
|
468
|
+
`${pendingReviews.length} session(s) flagged for Guardian attention.`,
|
|
469
|
+
),
|
|
470
470
|
);
|
|
471
471
|
console.log(chalk.gray('Run "wundr guardian review" for details.\n'));
|
|
472
472
|
}
|
|
@@ -492,7 +492,7 @@ async function showReviewQueue(): Promise<void> {
|
|
|
492
492
|
if (pendingReviews.length === 0) {
|
|
493
493
|
console.log(chalk.green('\nNo sessions require Guardian review.'));
|
|
494
494
|
console.log(
|
|
495
|
-
chalk.gray('All systems operating within acceptable parameters.\n')
|
|
495
|
+
chalk.gray('All systems operating within acceptable parameters.\n'),
|
|
496
496
|
);
|
|
497
497
|
return;
|
|
498
498
|
}
|
|
@@ -504,8 +504,8 @@ async function showReviewQueue(): Promise<void> {
|
|
|
504
504
|
padRight('Severity', 12) +
|
|
505
505
|
padRight('Drift Score', 14) +
|
|
506
506
|
padRight('Flagged At', 22) +
|
|
507
|
-
padRight('Reason', 22)
|
|
508
|
-
)
|
|
507
|
+
padRight('Reason', 22),
|
|
508
|
+
),
|
|
509
509
|
);
|
|
510
510
|
console.log(chalk.gray('-'.repeat(90)));
|
|
511
511
|
|
|
@@ -519,22 +519,22 @@ async function showReviewQueue(): Promise<void> {
|
|
|
519
519
|
severityColor(padRight(getSeverityBadge(item.severity), 12)) +
|
|
520
520
|
padRight(item.driftScore.toFixed(1), 14) +
|
|
521
521
|
padRight(flaggedAt, 22) +
|
|
522
|
-
chalk.gray(truncate(item.reason, 22))
|
|
522
|
+
chalk.gray(truncate(item.reason, 22)),
|
|
523
523
|
);
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
console.log(chalk.gray('-'.repeat(90)));
|
|
527
527
|
console.log(
|
|
528
|
-
chalk.gray(`Total: ${pendingReviews.length} session(s) pending review\n`)
|
|
528
|
+
chalk.gray(`Total: ${pendingReviews.length} session(s) pending review\n`),
|
|
529
529
|
);
|
|
530
530
|
|
|
531
531
|
// Show summary by severity
|
|
532
532
|
const criticalCount = pendingReviews.filter(
|
|
533
|
-
r => r.severity === 'critical'
|
|
533
|
+
r => r.severity === 'critical',
|
|
534
534
|
).length;
|
|
535
535
|
const highCount = pendingReviews.filter(r => r.severity === 'high').length;
|
|
536
536
|
const mediumCount = pendingReviews.filter(
|
|
537
|
-
r => r.severity === 'medium'
|
|
537
|
+
r => r.severity === 'medium',
|
|
538
538
|
).length;
|
|
539
539
|
|
|
540
540
|
if (criticalCount > 0) {
|
|
@@ -550,7 +550,7 @@ async function showReviewQueue(): Promise<void> {
|
|
|
550
550
|
} catch (error) {
|
|
551
551
|
spinner.fail('Failed to load review queue');
|
|
552
552
|
console.error(
|
|
553
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
553
|
+
chalk.red(error instanceof Error ? error.message : String(error)),
|
|
554
554
|
);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
@@ -571,20 +571,20 @@ async function listInterventions(options: InterventionsOptions): Promise<void> {
|
|
|
571
571
|
cutoffDate.setDate(cutoffDate.getDate() - days);
|
|
572
572
|
|
|
573
573
|
interventions = interventions.filter(
|
|
574
|
-
i => new Date(i.timestamp) >= cutoffDate
|
|
574
|
+
i => new Date(i.timestamp) >= cutoffDate,
|
|
575
575
|
);
|
|
576
576
|
|
|
577
577
|
// Filter by session
|
|
578
578
|
if (options.session) {
|
|
579
579
|
interventions = interventions.filter(
|
|
580
|
-
i => i.sessionId === options.session
|
|
580
|
+
i => i.sessionId === options.session,
|
|
581
581
|
);
|
|
582
582
|
}
|
|
583
583
|
|
|
584
584
|
// Sort by timestamp descending (most recent first)
|
|
585
585
|
interventions.sort(
|
|
586
586
|
(a, b) =>
|
|
587
|
-
new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
|
|
587
|
+
new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(),
|
|
588
588
|
);
|
|
589
589
|
|
|
590
590
|
spinner.stop();
|
|
@@ -592,14 +592,14 @@ async function listInterventions(options: InterventionsOptions): Promise<void> {
|
|
|
592
592
|
console.log(chalk.cyan('\nGuardian Interventions'));
|
|
593
593
|
console.log(
|
|
594
594
|
chalk.gray(
|
|
595
|
-
`Last ${days} days${options.session ? ` - Session: ${options.session}` : ''}
|
|
596
|
-
)
|
|
595
|
+
`Last ${days} days${options.session ? ` - Session: ${options.session}` : ''}`,
|
|
596
|
+
),
|
|
597
597
|
);
|
|
598
598
|
console.log(chalk.gray('='.repeat(100)));
|
|
599
599
|
|
|
600
600
|
if (interventions.length === 0) {
|
|
601
601
|
console.log(
|
|
602
|
-
chalk.green('\nNo interventions recorded in the specified time period.')
|
|
602
|
+
chalk.green('\nNo interventions recorded in the specified time period.'),
|
|
603
603
|
);
|
|
604
604
|
console.log('');
|
|
605
605
|
return;
|
|
@@ -613,8 +613,8 @@ async function listInterventions(options: InterventionsOptions): Promise<void> {
|
|
|
613
613
|
padRight('Severity', 12) +
|
|
614
614
|
padRight('Dimension', 20) +
|
|
615
615
|
padRight('Status', 12) +
|
|
616
|
-
padRight('Time', 18)
|
|
617
|
-
)
|
|
616
|
+
padRight('Time', 18),
|
|
617
|
+
),
|
|
618
618
|
);
|
|
619
619
|
console.log(chalk.gray('-'.repeat(100)));
|
|
620
620
|
|
|
@@ -635,7 +635,7 @@ async function listInterventions(options: InterventionsOptions): Promise<void> {
|
|
|
635
635
|
severityColor(padRight(getSeverityBadge(intervention.severity), 12)) +
|
|
636
636
|
padRight(truncate(intervention.dimension, 18), 20) +
|
|
637
637
|
statusColor(padRight(`[${intervention.status.toUpperCase()}]`, 12)) +
|
|
638
|
-
chalk.gray(padRight(timestamp, 18))
|
|
638
|
+
chalk.gray(padRight(timestamp, 18)),
|
|
639
639
|
);
|
|
640
640
|
}
|
|
641
641
|
|
|
@@ -646,18 +646,18 @@ async function listInterventions(options: InterventionsOptions): Promise<void> {
|
|
|
646
646
|
const applied = interventions.filter(i => i.status === 'applied').length;
|
|
647
647
|
const pending = interventions.filter(i => i.status === 'pending').length;
|
|
648
648
|
const dismissed = interventions.filter(
|
|
649
|
-
i => i.status === 'dismissed'
|
|
649
|
+
i => i.status === 'dismissed',
|
|
650
650
|
).length;
|
|
651
651
|
|
|
652
652
|
console.log(chalk.gray('Summary:'));
|
|
653
653
|
console.log(
|
|
654
|
-
` Applied: ${chalk.green(applied)} Pending: ${chalk.yellow(pending)} Dismissed: ${chalk.gray(dismissed)}
|
|
654
|
+
` Applied: ${chalk.green(applied)} Pending: ${chalk.yellow(pending)} Dismissed: ${chalk.gray(dismissed)}`,
|
|
655
655
|
);
|
|
656
656
|
console.log('');
|
|
657
657
|
} catch (error) {
|
|
658
658
|
spinner.fail('Failed to load interventions');
|
|
659
659
|
console.error(
|
|
660
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
660
|
+
chalk.red(error instanceof Error ? error.message : String(error)),
|
|
661
661
|
);
|
|
662
662
|
}
|
|
663
663
|
}
|
|
@@ -692,13 +692,13 @@ async function displayDashboard(): Promise<void> {
|
|
|
692
692
|
|
|
693
693
|
console.log(chalk.cyan.bold('\n' + '='.repeat(80)));
|
|
694
694
|
console.log(
|
|
695
|
-
chalk.cyan.bold(' GUARDIAN ALIGNMENT DASHBOARD')
|
|
695
|
+
chalk.cyan.bold(' GUARDIAN ALIGNMENT DASHBOARD'),
|
|
696
696
|
);
|
|
697
697
|
console.log(chalk.cyan.bold('='.repeat(80)));
|
|
698
698
|
console.log(
|
|
699
699
|
chalk.gray(
|
|
700
|
-
` Last Updated: ${new Date().toLocaleString()}
|
|
701
|
-
)
|
|
700
|
+
` Last Updated: ${new Date().toLocaleString()}`,
|
|
701
|
+
),
|
|
702
702
|
);
|
|
703
703
|
console.log('');
|
|
704
704
|
|
|
@@ -708,7 +708,7 @@ async function displayDashboard(): Promise<void> {
|
|
|
708
708
|
|
|
709
709
|
const statusColor = getStatusColor(report.overallStatus);
|
|
710
710
|
console.log(
|
|
711
|
-
` Overall Status: ${statusColor(report.overallStatus.padEnd(12))} Avg Drift Score: ${chalk.white(report.averageScore.toFixed(1).padEnd(8))} Trend: ${chalk.white(report.trend)}
|
|
711
|
+
` Overall Status: ${statusColor(report.overallStatus.padEnd(12))} Avg Drift Score: ${chalk.white(report.averageScore.toFixed(1).padEnd(8))} Trend: ${chalk.white(report.trend)}`,
|
|
712
712
|
);
|
|
713
713
|
console.log('');
|
|
714
714
|
|
|
@@ -716,7 +716,7 @@ async function displayDashboard(): Promise<void> {
|
|
|
716
716
|
console.log(chalk.cyan.bold(' SESSIONS'));
|
|
717
717
|
console.log(chalk.gray(' ' + '-'.repeat(78)));
|
|
718
718
|
console.log(
|
|
719
|
-
` Total: ${chalk.white(report.totalSessions.toString().padEnd(6))} Critical: ${report.criticalSessions.length > 0 ? chalk.red(report.criticalSessions.length.toString().padEnd(4)) : chalk.green('0'.padEnd(4))} Concerning: ${report.concerningSessions.length > 0 ? chalk.yellow(report.concerningSessions.length.toString().padEnd(4)) : chalk.green('0'.padEnd(4))} Healthy: ${chalk.green((report.totalSessions - report.criticalSessions.length - report.concerningSessions.length).toString())}
|
|
719
|
+
` Total: ${chalk.white(report.totalSessions.toString().padEnd(6))} Critical: ${report.criticalSessions.length > 0 ? chalk.red(report.criticalSessions.length.toString().padEnd(4)) : chalk.green('0'.padEnd(4))} Concerning: ${report.concerningSessions.length > 0 ? chalk.yellow(report.concerningSessions.length.toString().padEnd(4)) : chalk.green('0'.padEnd(4))} Healthy: ${chalk.green((report.totalSessions - report.criticalSessions.length - report.concerningSessions.length).toString())}`,
|
|
720
720
|
);
|
|
721
721
|
console.log('');
|
|
722
722
|
|
|
@@ -725,16 +725,16 @@ async function displayDashboard(): Promise<void> {
|
|
|
725
725
|
console.log(chalk.gray(' ' + '-'.repeat(78)));
|
|
726
726
|
|
|
727
727
|
const pendingInterventions = guardianState.interventions.filter(
|
|
728
|
-
i => i.status === 'pending'
|
|
728
|
+
i => i.status === 'pending',
|
|
729
729
|
);
|
|
730
730
|
const recentApplied = guardianState.interventions.filter(
|
|
731
731
|
i =>
|
|
732
732
|
i.status === 'applied' &&
|
|
733
|
-
new Date(i.timestamp) > new Date(Date.now() - 24 * 60 * 60 * 1000)
|
|
733
|
+
new Date(i.timestamp) > new Date(Date.now() - 24 * 60 * 60 * 1000),
|
|
734
734
|
);
|
|
735
735
|
|
|
736
736
|
console.log(
|
|
737
|
-
` Pending: ${pendingInterventions.length > 0 ? chalk.yellow(pendingInterventions.length.toString().padEnd(6)) : chalk.green('0'.padEnd(6))} Applied (24h): ${chalk.white(recentApplied.length.toString().padEnd(6))} Recommended: ${recommendations.length > 0 ? chalk.yellow(recommendations.length.toString()) : chalk.green('0')}
|
|
737
|
+
` Pending: ${pendingInterventions.length > 0 ? chalk.yellow(pendingInterventions.length.toString().padEnd(6)) : chalk.green('0'.padEnd(6))} Applied (24h): ${chalk.white(recentApplied.length.toString().padEnd(6))} Recommended: ${recommendations.length > 0 ? chalk.yellow(recommendations.length.toString()) : chalk.green('0')}`,
|
|
738
738
|
);
|
|
739
739
|
console.log('');
|
|
740
740
|
|
|
@@ -748,14 +748,14 @@ async function displayDashboard(): Promise<void> {
|
|
|
748
748
|
console.log(chalk.green(' No sessions require Guardian review.'));
|
|
749
749
|
} else {
|
|
750
750
|
const criticalReviews = pendingReviews.filter(
|
|
751
|
-
r => r.severity === 'critical'
|
|
751
|
+
r => r.severity === 'critical',
|
|
752
752
|
).length;
|
|
753
753
|
const highReviews = pendingReviews.filter(
|
|
754
|
-
r => r.severity === 'high'
|
|
754
|
+
r => r.severity === 'high',
|
|
755
755
|
).length;
|
|
756
756
|
|
|
757
757
|
console.log(
|
|
758
|
-
` Pending: ${chalk.yellow(pendingReviews.length.toString().padEnd(6))} Critical: ${criticalReviews > 0 ? chalk.red(criticalReviews.toString().padEnd(6)) : chalk.green('0'.padEnd(6))} High: ${highReviews > 0 ? chalk.yellow(highReviews.toString()) : chalk.green('0')}
|
|
758
|
+
` Pending: ${chalk.yellow(pendingReviews.length.toString().padEnd(6))} Critical: ${criticalReviews > 0 ? chalk.red(criticalReviews.toString().padEnd(6)) : chalk.green('0'.padEnd(6))} High: ${highReviews > 0 ? chalk.yellow(highReviews.toString()) : chalk.green('0')}`,
|
|
759
759
|
);
|
|
760
760
|
}
|
|
761
761
|
console.log('');
|
|
@@ -768,13 +768,13 @@ async function displayDashboard(): Promise<void> {
|
|
|
768
768
|
for (const rec of recommendations.slice(0, 3)) {
|
|
769
769
|
const severityColor = getSeverityColor(rec.severity);
|
|
770
770
|
console.log(
|
|
771
|
-
` ${severityColor(getSeverityBadge(rec.severity))} ${rec.dimension}: ${truncate(rec.action, 50)}
|
|
771
|
+
` ${severityColor(getSeverityBadge(rec.severity))} ${rec.dimension}: ${truncate(rec.action, 50)}`,
|
|
772
772
|
);
|
|
773
773
|
}
|
|
774
774
|
|
|
775
775
|
if (recommendations.length > 3) {
|
|
776
776
|
console.log(
|
|
777
|
-
chalk.gray(` ... and ${recommendations.length - 3} more`)
|
|
777
|
+
chalk.gray(` ... and ${recommendations.length - 3} more`),
|
|
778
778
|
);
|
|
779
779
|
}
|
|
780
780
|
console.log('');
|
|
@@ -785,16 +785,16 @@ async function displayDashboard(): Promise<void> {
|
|
|
785
785
|
console.log(chalk.gray(' ' + '-'.repeat(78)));
|
|
786
786
|
console.log(
|
|
787
787
|
chalk.gray(
|
|
788
|
-
' wundr guardian report - Generate full alignment report'
|
|
789
|
-
)
|
|
788
|
+
' wundr guardian report - Generate full alignment report',
|
|
789
|
+
),
|
|
790
790
|
);
|
|
791
791
|
console.log(
|
|
792
792
|
chalk.gray(
|
|
793
|
-
' wundr guardian review - View sessions requiring attention'
|
|
794
|
-
)
|
|
793
|
+
' wundr guardian review - View sessions requiring attention',
|
|
794
|
+
),
|
|
795
795
|
);
|
|
796
796
|
console.log(
|
|
797
|
-
chalk.gray(' wundr guardian interventions - List recent interventions')
|
|
797
|
+
chalk.gray(' wundr guardian interventions - List recent interventions'),
|
|
798
798
|
);
|
|
799
799
|
console.log('');
|
|
800
800
|
|
|
@@ -803,7 +803,7 @@ async function displayDashboard(): Promise<void> {
|
|
|
803
803
|
} catch (error) {
|
|
804
804
|
spinner.fail('Failed to load dashboard');
|
|
805
805
|
console.error(
|
|
806
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
806
|
+
chalk.red(error instanceof Error ? error.message : String(error)),
|
|
807
807
|
);
|
|
808
808
|
}
|
|
809
809
|
}
|
|
@@ -818,7 +818,7 @@ async function displayDashboard(): Promise<void> {
|
|
|
818
818
|
export function createGuardianCommand(): Command {
|
|
819
819
|
const guardian = new Command('guardian')
|
|
820
820
|
.description(
|
|
821
|
-
'Guardian Dashboard - AI alignment monitoring and intervention management'
|
|
821
|
+
'Guardian Dashboard - AI alignment monitoring and intervention management',
|
|
822
822
|
)
|
|
823
823
|
.addHelpText(
|
|
824
824
|
'after',
|
|
@@ -831,7 +831,7 @@ Examples:
|
|
|
831
831
|
${chalk.green('wundr guardian review')} Show sessions requiring Guardian review
|
|
832
832
|
${chalk.green('wundr guardian interventions')} List recent interventions
|
|
833
833
|
${chalk.green('wundr guardian interventions --days 14')} Show interventions from last 14 days
|
|
834
|
-
`)
|
|
834
|
+
`),
|
|
835
835
|
);
|
|
836
836
|
|
|
837
837
|
// Default action - show dashboard
|