/**
 * Commit audit log — append-only JSONL trail of every commit landed by
 * the server, tagged by source so operators can answer "who committed
 * this?" with one grep.
 *
 * Best-effort: a write failure logs and returns. The audit log is not
 * load-bearing for correctness — it's diagnostic.
 */
import { appendFileSync, mkdirSync } from 'fs';
import { join } from 'path';
export function recordCommitAudit(workspacePath, entry) {
    try {
        mkdirSync(join(workspacePath, '.studiograph'), { recursive: true });
        const auditPath = join(workspacePath, '.studiograph', 'commit-audit.jsonl');
        const record = {
            ts: new Date().toISOString(),
            repo: entry.repo,
            source: entry.source,
            user: entry.user.name,
            email: entry.user.email,
            message: entry.message.slice(0, 200),
            fileCount: entry.fileCount,
        };
        appendFileSync(auditPath, JSON.stringify(record) + '\n', 'utf-8');
    }
    catch (err) {
        console.warn(`[commit-audit] failed to write audit record:`, err.message);
    }
}
//# sourceMappingURL=commit-audit.js.map