import { formatPayloadJson } from '../utils.js';
export function formatChangedFiles(files) {
    return files
        .map(file => {
        const path = file.oldPath ? `${file.oldPath} -> ${file.path}` : file.path;
        const suffix = file.binary ? ' [binary]' : '';
        return `${file.status}\t${path}${suffix}`;
    })
        .join('\n');
}
export function formatDiffSummary(summary) {
    const lines = [
        `${summary.filesChanged} files changed, ${summary.totalAdded} insertions(+), ${summary.totalDeleted} deletions(-)`,
    ];
    const byPath = new Map(summary.numstat.map(entry => [entry.path, entry]));
    for (const file of summary.files) {
        const churn = byPath.get(file.path);
        const counts = churn ? (churn.binary ? 'binary' : `+${churn.added ?? 0}/-${churn.deleted ?? 0}`) : '';
        lines.push(`${file.status}\t${file.oldPath ? `${file.oldPath} -> ${file.path}` : file.path}${counts ? `\t${counts}` : ''}`);
    }
    return lines.join('\n');
}
export function formatDiffPatch(patch) {
    return patch.patch;
}
export function formatCommitHistory(history) {
    return history.commits.map(commit => `${commit.shortHash} ${commit.authorDate} ${commit.subject}`).join('\n');
}
export function formatFileHistory(history) {
    return history.entries.map(entry => `${entry.shortHash} ${entry.authorDate} ${entry.subject}`).join('\n');
}
export function formatChurnSummary(summary) {
    return summary.entries
        .map(entry => `${entry.path}\t${entry.commits} commits\t+${entry.added}/-${entry.deleted}\tchurn ${entry.churn}`)
        .join('\n');
}
export function formatCochange(summary) {
    return summary.pairs
        .map(pair => `${pair.fileA}\t${pair.fileB}\t${pair.count} cochanges\tlift ${pair.lift.toFixed(3)}\t${pair.lastCochangedAt}`)
        .join('\n');
}
export function formatGitJson(value, pretty = false) {
    return formatPayloadJson(value, pretty);
}
//# sourceMappingURL=output.js.map