// CLI progress bar utility export class ProgressBar { private total: number; private current: number = 0; private width: number; private message: string; constructor(total: number, width: number = 40, message: string = 'Progress') { this.total = total; this.width = width; this.message = message; } update(current: number, customMessage?: string): void { this.current = Math.min(current, this.total); const percentage = (this.current / this.total) * 100; const filled = Math.floor((this.current / this.total) * this.width); const empty = this.width - filled; const bar = '█'.repeat(filled) + '░'.repeat(empty); const msg = customMessage || this.message; process.stdout.write( `\r${msg}: [${bar}] ${percentage.toFixed(1)}% (${this.current}/${this.total})` ); if (this.current === this.total) { process.stdout.write('\n'); } } increment(customMessage?: string): void { this.update(this.current + 1, customMessage); } complete(message?: string): void { this.update(this.total); if (message) { console.log(`✅ ${message}`); } } fail(message?: string): void { process.stdout.write('\n'); if (message) { console.log(`❌ ${message}`); } } } export function createProgressBar(total: number, message?: string): ProgressBar { return new ProgressBar(total, 40, message); }