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/cancelled-child-waiver-audit.js
/**
* Cancelled-child-waiver audit trail.
*
* Records waiver entries to `.cleo/audit/cancelled-child-waiver.jsonl` when a
* caller completes a parent that has `cancelled` children by supplying
* `--waive-cancelled-children "<reason>"` to bypass the
* `E_CANCELLED_CHILD_NO_WAIVER` gate.
*
* Pattern mirrors `premature-close-audit.ts` (T1632) — one JSONL file per audit
* concern, created on demand, appended atomically.
*
* @saga T10538 (PM-Core V2 agent-trust)
*/
/**
* Append a cancelled-child-waiver entry to the audit file.
*
* Creates `.cleo/audit/` if it does not exist and atomically appends a
* single-line JSON record to `.cleo/audit/cancelled-child-waiver.jsonl`.
*
* @param entry - The audit entry to append.
* @param projectRoot - Absolute path to the project root (defaults to `getProjectRoot()`).
*/
async function appendCancelledChildWaiverAudit(entry, projectRoot) {
	const auditDir = join(projectRoot ?? getProjectRoot(), ".cleo", "audit");
	await mkdir(auditDir, { recursive: true });
	await appendFile(join(auditDir, "cancelled-child-waiver.jsonl"), `${JSON.stringify(entry)}\n`, { encoding: "utf8" });
}

export { appendCancelledChildWaiverAudit };
//# sourceMappingURL=cancelled-child-waiver-audit-DHilCj01.js.map
