UNPKG

@ace-sdk/cli

Version:

ACE CLI - Command-line tool for intelligent pattern learning and playbook management

46 lines • 2.1 kB
/** * Status output formatter */ import chalk from 'chalk'; /** * Format status data for human-readable output */ export function formatStatus(status, projectId) { console.log(chalk.bold('\nšŸ“Š Playbook Status\n')); console.log(` ${chalk.cyan('Total Bullets:')} ${status.total_bullets || 0}`); console.log(` ${chalk.cyan('Project ID:')} ${projectId}`); if (status.by_section && Object.keys(status.by_section).length > 0) { console.log(chalk.bold('\nšŸ“‘ By Section:\n')); Object.entries(status.by_section).forEach(([section, count]) => { const label = section.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()); console.log(` ${chalk.dim('•')} ${label}: ${count}`); }); } if (status.top_helpful && status.top_helpful.length > 0) { console.log(chalk.bold('\n⭐ Top Helpful Patterns:\n')); status.top_helpful.slice(0, 5).forEach((bullet, index) => { const preview = bullet.content.substring(0, 60) + (bullet.content.length > 60 ? '...' : ''); console.log(` ${chalk.green(index + 1)}. ${chalk.bold(`[+${bullet.helpful}]`)} ${preview}`); }); } if (status.top_harmful && status.top_harmful.length > 0) { console.log(chalk.bold('\nāš ļø Top Harmful Patterns:\n')); status.top_harmful.slice(0, 3).forEach((bullet, index) => { const preview = bullet.content.substring(0, 60) + (bullet.content.length > 60 ? '...' : ''); console.log(` ${chalk.red(index + 1)}. ${chalk.bold(`[-${bullet.harmful}]`)} ${preview}`); }); } console.log(''); } /** * Format a progress bar */ export function formatProgressBar(current, total, width = 20) { const percentage = total > 0 ? current / total : 0; const filled = Math.round(percentage * width); const empty = width - filled; const bar = chalk.green('ā–ˆ'.repeat(filled)) + chalk.dim('ā–‘'.repeat(empty)); const percent = (percentage * 100).toFixed(0); return `${bar} ${percent}%`; } //# sourceMappingURL=status-formatter.js.map