INNER CODE UNIT · JavaScript
red
nadimtuhin/claude-token-optimizer · src/commands/audit.js:95
const red = s => useColor ? chalk.red(s) : s;
const yellow = s => useColor ? chalk.yellow(s) : s;
const lines = [];
for (const r of results) {
const icon = r.pass ? green('✓') : r.severity === 'error' ? red('✗') : yellow('⚠');
const label = r.pass ? r.label : r.detail ? `${r.label} — ${r.detail}` : r.label;
lines.push(` ${icon} ${label}`);
}
return lines;
}
export function buildFixSummary(warnings, infos) {
const parts = [];
if (warnings) parts.push(`${warnings} warning${warnings > 1 ? 's' : ''}`);
if (infos) parts.push(`${infos} info item${infos > 1 ? 's' : ''}`);
if (!parts.length) return '';
const total = warnings + infos;
return ` ${parts.join(', ')} ${total === 1 ? 'remains' : 'remain'} — run cto audit for details`;