import { join } from 'node:path';
import { mkdir, appendFile } from 'node:fs/promises';

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

export { appendDuplicateBypassAudit };
//# sourceMappingURL=duplicate-bypass-audit-BN5w1H2y.js.map
