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/nexus-risk-audit.js
/**
* IVTR Breaking-Change Gate — audit trail for nexus risk acknowledgments.
*
* Records acknowledgments to `.cleo/audit/nexus-risk-ack.jsonl` when a worker
* bypasses the nexusImpact gate with `--acknowledge-risk "<reason>"`.
*
* @task T1073
* @epic T1042
*/
/**
* Append a nexus risk acknowledgment entry to the audit file.
*
* Creates `.cleo/audit/` directory if it does not exist and atomically appends
* a single-line JSON entry to `.cleo/audit/nexus-risk-ack.jsonl`.
*
* @param entry - The acknowledgment entry to audit
* @param projectRoot - Absolute path to project root (defaults to getProjectRoot())
*/
async function appendNexusRiskAck(entry, projectRoot) {
	const auditDir = join(projectRoot ?? getProjectRoot(), ".cleo", "audit");
	try {
		await mkdir(auditDir, { recursive: true });
	} catch (err) {
		if (!(err instanceof Error) || !err.message.includes("EEXIST")) throw err;
	}
	await appendFile(join(auditDir, "nexus-risk-ack.jsonl"), `${JSON.stringify(entry)}\n`, { encoding: "utf8" });
}

export { appendNexusRiskAck };
//# sourceMappingURL=nexus-risk-audit-orjcwn2y.js.map
