// tools/suggest-tooling/dora-output.ts — DORA metrics output formatting
import { calculateDoraMetrics, hasEnoughHistory, generateRecommendations, classifyMetric, } from '../../engine/dora-metrics.js';
export async function fetchDoraMetrics(projectPath) {
    const hasDoraHistory = await hasEnoughHistory(projectPath, 90);
    const doraMetrics = hasDoraHistory ? await calculateDoraMetrics(projectPath, 30) : null;
    return { doraMetrics };
}
export function buildDoraOutputLines(doraMetrics) {
    const doraRecs = generateRecommendations(doraMetrics);
    const lines = [
        '',
        '### DORA Metrics (Engineering Performance)',
        '',
        '> Note: Calculated from local git history — not equivalent to CI/CD-integrated tools.',
        '',
        '| Metric | Value | Tier |',
        '|--------|-------|------|',
        `| Deployment Frequency | ${doraMetrics.deploymentFrequency.toFixed(2)}/week | ${classifyMetric('deploymentFrequency', doraMetrics.deploymentFrequency).toUpperCase()} |`,
        `| Lead Time | ${doraMetrics.leadTimeHours.toFixed(1)}h | ${classifyMetric('leadTimeHours', doraMetrics.leadTimeHours).toUpperCase()} |`,
        `| Change Failure Rate | ${doraMetrics.changeFailureRate.toFixed(1)}% | ${classifyMetric('changeFailureRate', doraMetrics.changeFailureRate).toUpperCase()} |`,
        `| MTTR | ${doraMetrics.mttrHours.toFixed(1)}h | ${classifyMetric('mttrHours', doraMetrics.mttrHours).toUpperCase()} |`,
        '',
        `**Overall tier:** ${doraMetrics.tier.toUpperCase()}`,
        '',
    ];
    if (doraRecs.length > 0) {
        lines.push('**Recommendations:**');
        for (const rec of doraRecs) {
            lines.push(`- ${rec}`);
        }
        lines.push('');
    }
    return lines;
}
//# sourceMappingURL=dora-output.js.map