import path from 'node:path';
import { writeJsonAtomic, writeTextAtomic } from '../fsx.js';
export async function writeParallelVerificationProof(reportRoot, result) {
    const json = path.join(reportRoot, 'release-parallel-report.json');
    const markdown = path.join(reportRoot, 'release-parallel-report.md');
    await writeJsonAtomic(json, result);
    await writeTextAtomic(markdown, renderParallelVerificationReport(result));
    return { json, markdown };
}
export function renderParallelVerificationReport(result) {
    const rows = result.results.map((task) => `| ${task.id} | ${task.skipped ? 'skipped' : task.ok ? 'passed' : 'failed'} | ${task.duration_ms} | ${task.exit_code ?? 'null'} | ${task.stdout_log || task.stdout_log_summary || ''} | ${task.stderr_log || task.stderr_log_summary || ''} |`);
    return [
        '# Parallel Verification Report',
        '',
        `- Status: ${result.ok ? 'passed' : 'failed'}`,
        `- Tasks: ${result.task_count}`,
        `- Passed: ${result.passed}`,
        `- Failed: ${result.failed}`,
        `- Skipped: ${result.skipped}`,
        '',
        '| Task | Status | Duration ms | Exit | Stdout | Stderr |',
        '| --- | --- | ---: | ---: | --- | --- |',
        ...rows,
        '',
    ].join('\n');
}
//# sourceMappingURL=verification-proof.js.map