import { c as getProjectRoot } from './paths-2M_UxD_H.js';
import { join } from 'node:path';
import { mkdir, appendFile } from 'node:fs/promises';
import 'node:fs';
import 'node:os';
import 'node:events';
import 'node:diagnostics_channel';
import 'fs';
import 'events';
import 'util';
import 'path';
import 'assert';
import 'worker_threads';
import 'module';
import 'node:url';
import 'url';
import 'buffer';
import 'node:module';
import 'node:child_process';
import 'node:crypto';
import 'node:process';
import 'node:async_hooks';

//#region ../core/dist/tasks/premature-close-audit.js
/**
* Premature-close audit trail.
*
* Records override entries to `.cleo/audit/premature-close.jsonl` when a caller
* bypasses the `E_EPIC_HAS_PENDING_CHILDREN` guard via `--override-reason`.
*
* Pattern mirrors `nexus-risk-audit.ts` (T1073) — one JSONL file per audit
* concern, created on demand, appended atomically.
*
* @epic T1627
* @task T1632
*/
/**
* Append a premature-close override entry to the audit file.
*
* Creates `.cleo/audit/` if it does not exist and atomically appends a
* single-line JSON record to `.cleo/audit/premature-close.jsonl`.
*
* @param entry - The audit entry to append.
* @param projectRoot - Absolute path to the project root (defaults to `getProjectRoot()`).
*/
async function appendPrematureCloseAudit(entry, projectRoot) {
	const auditDir = join(projectRoot ?? getProjectRoot(), ".cleo", "audit");
	await mkdir(auditDir, { recursive: true });
	await appendFile(join(auditDir, "premature-close.jsonl"), `${JSON.stringify(entry)}\n`, { encoding: "utf8" });
}

export { appendPrematureCloseAudit };
//# sourceMappingURL=premature-close-audit-BR0_Yt4I.js.map
