// src/tools/spec-obesity-healer.ts — SPEC-971 tool handler
import { runSpecObesityHealer } from '../engine/spec-obesity-healer.js';
export async function handleSpecObesityHealer(args) {
    const result = await runSpecObesityHealer(args);
    const lines = [];
    lines.push(`# Spec Obesity Healer Report`);
    lines.push('');
    lines.push(`**Mode:** ${result.dryRun ? '🔍 DRY-RUN (no changes written)' : '✅ APPLIED'}`);
    lines.push(`**Specs scanned:** ${result.scannedSpecs}`);
    lines.push(`**Obese specs found:** ${result.obeseSpecs}`);
    lines.push(`**Total lines saved:** ${result.totalLinesSaved}`);
    lines.push(`**Total criteria removed:** ${result.totalCriteriaRemoved}`);
    lines.push('');
    if (result.specs.length === 0) {
        lines.push('✨ No bloated specs found. All specs are lean!');
    }
    else {
        lines.push('## Healed Specs');
        lines.push('');
        for (const spec of result.specs) {
            lines.push(`### ${spec.specId}`);
            lines.push(`- **Path:** ${spec.specPath}`);
            lines.push(`- **Before:** ${spec.originalLines} lines`);
            lines.push(`- **After:** ${spec.healedLines} lines`);
            lines.push(`- **Saved:** ${spec.linesSaved} lines (${((spec.linesSaved / spec.originalLines) * 100).toFixed(1)}%)`);
            lines.push(`- **Criteria removed:** ${spec.criteriaRemoved}`);
            if (spec.backupPath) {
                lines.push(`- **Backup:** ${spec.backupPath}`);
            }
            if (spec.bloatSources.length > 0) {
                lines.push(`- **Bloat sources:**`);
                for (const source of spec.bloatSources) {
                    lines.push(`  - ${source.type}: ${source.count} removed`);
                    for (const example of source.examples) {
                        lines.push(`    - \`${example}\``);
                    }
                }
            }
            lines.push('');
        }
    }
    return {
        content: [{ type: 'text', text: lines.join('\n') }],
        structuredContent: result,
        isError: false,
    };
}
//# sourceMappingURL=spec-obesity-healer.js.map