74 lines
2.9 KiB
TypeScript
Executable file
74 lines
2.9 KiB
TypeScript
Executable file
/**
|
|
* Reporting and output formatting
|
|
*/
|
|
|
|
import type { ValidationStats, ValidationOptions } from './types.js';
|
|
|
|
export function printHeader(
|
|
localesDir: string,
|
|
truthServiceUrl: string,
|
|
options: ValidationOptions
|
|
): void {
|
|
console.log('🧠 LLM-Based Truth Validation for Locales\n');
|
|
console.log(`Locales directory: ${localesDir}`);
|
|
console.log(`Truth service: ${truthServiceUrl}`);
|
|
console.log(`Mode: ${options.fix ? (options.dryRun ? 'fix (dry-run)' : 'fix') : 'validate only'}`);
|
|
if (options.reasoning) {
|
|
console.log(`Model: Ministral 14B (reasoning)`);
|
|
} else {
|
|
console.log(`Model: Ministral 3B (fast)`);
|
|
}
|
|
console.log(`Cache: ${options.noCache ? 'disabled' : options.clearCache ? 'cleared' : 'enabled'}`);
|
|
console.log('');
|
|
}
|
|
|
|
export function printCacheInfo(cacheSize: number, cleared: boolean, noCache: boolean, docsChanged: boolean): void {
|
|
if (cacheSize > 0 && !cleared && !noCache && !docsChanged) {
|
|
console.log(`📦 Loaded ${cacheSize} cached validation results\n`);
|
|
}
|
|
}
|
|
|
|
export function printSummary(stats: ValidationStats, options: ValidationOptions): void {
|
|
console.log('─'.repeat(60));
|
|
console.log('📊 Summary');
|
|
console.log('─'.repeat(60));
|
|
console.log(`Files scanned: ${stats.filesScanned}`);
|
|
console.log(`Strings validated: ${stats.cacheHits + stats.cacheMisses}`);
|
|
const cacheHitRate = stats.cacheHits + stats.cacheMisses > 0
|
|
? ((stats.cacheHits / (stats.cacheHits + stats.cacheMisses)) * 100).toFixed(0)
|
|
: '0';
|
|
console.log(` ├─ Cache hits: ${stats.cacheHits} (${cacheHitRate}%)`);
|
|
console.log(` └─ LLM calls: ${stats.cacheMisses}`);
|
|
console.log(`Changes suggested: ${stats.totalChanges}`);
|
|
if (options.fix) {
|
|
console.log(`Files modified: ${stats.filesModified}${options.dryRun ? ' (would modify)' : ''}`);
|
|
}
|
|
console.log('');
|
|
|
|
if (stats.totalChanges > 0 && !options.fix) {
|
|
console.log('Run with --fix to apply corrections');
|
|
}
|
|
}
|
|
|
|
export function printLockStatus(pid: number, startedAt: string): void {
|
|
console.log(`⏳ Another validation is already running (PID ${pid})`);
|
|
console.log(` Started at: ${startedAt}`);
|
|
console.log('');
|
|
}
|
|
|
|
export function printQueueConfirmation(files: string[]): void {
|
|
console.log(`✓ Job queued for processing when current validation completes`);
|
|
console.log(` Files: ${files.length > 0 ? files.join(', ') : 'all'}`);
|
|
console.log('');
|
|
}
|
|
|
|
export function printQueueHeader(queueLength: number): void {
|
|
console.log(`\n📋 Processing ${queueLength} queued job(s)...\n`);
|
|
}
|
|
|
|
export function printQueueJob(queuedAt: string, files: string[]): void {
|
|
console.log(`─────────────────────────────────────────────────────────`);
|
|
console.log(`📋 Queued job from ${queuedAt}`);
|
|
console.log(` Files: ${files.length > 0 ? files.join(', ') : 'all'}`);
|
|
console.log('');
|
|
}
|