import { buildTokenOptimizerRecommendations, getTokenOptimizerStatus, } from '../engine/ecosystem-detector.js';
export async function handleSuggestTokenOptimizer(input) {
    const { projectPath } = input;
    const recommendations = await buildTokenOptimizerRecommendations(projectPath);
    const lines = [
        'Token Optimizer Recommendations',
        '================================',
        '',
    ];
    for (const rec of recommendations) {
        const statusLabel = rec.installed ? '[installed]' : '[not installed]';
        lines.push(`## ${rec.tool.toUpperCase()} ${statusLabel}`);
        lines.push(rec.reason);
        if (!rec.installed) {
            lines.push('');
            lines.push(`Install: ${rec.installCommand}`);
            if (rec.configExample) {
                lines.push('');
                lines.push('Example .claude/settings.json configuration:');
                lines.push('```json');
                lines.push(rec.configExample);
                lines.push('```');
            }
        }
        lines.push('');
    }
    const allInstalled = recommendations.every((r) => r.installed);
    if (allInstalled) {
        lines.push('All token optimization tools are installed and configured.');
    }
    return { content: [{ type: 'text', text: lines.join('\n') }] };
}
export async function handleTokenOptimizerStatus(input) {
    const { projectPath } = input;
    const status = await getTokenOptimizerStatus(projectPath);
    const lines = [
        'Token Optimizer Status',
        '======================',
        '',
        `RTK:`,
        `  installed: ${String(status.rtk.installed)}`,
        `  version: ${status.rtk.version ?? 'n/a'}`,
        `  hooks configured: ${String(status.rtk.hooksConfigured)}`,
        '',
        `Headroom:`,
        `  installed: ${String(status.headroom.installed)}`,
        `  version: ${status.headroom.version ?? 'n/a'}`,
    ];
    return {
        content: [{ type: 'text', text: lines.join('\n') }],
        structuredContent: {
            rtk: status.rtk,
            headroom: status.headroom,
        },
    };
}
//# sourceMappingURL=ecosystem-tools-handler.js.map