/** * Safe JSON file mutation primitives. * * Two disciplines the whole codebase must share when it edits a JSON file it * does not exclusively own (Claude Code's settings.json / .claude.json, the * Nori config): never silently discard content you failed to parse, and never * expose a half-written file to a concurrent reader. * * - `readJsonObjectFile` distinguishes "absent" (return the caller's default) * from "present but corrupt" (throw). It must never fall back to an empty * object for a file that exists — that is how a stray comment or a partial * write turns into total data loss when the caller writes the result back. * - `writeJsonFileAtomic` writes to a unique sibling temp file and renames it * into place. If the destination is a symlink, the temp/rename sequence * happens beside the resolved target so the link itself survives. rename(2) * is atomic within a filesystem, so a crash or a concurrent read sees either * the old file or the new one, never a truncated mix, and concurrent writers * do not collide on a shared temp name. */ /** * Read a JSON object from disk, distinguishing absence from corruption. * * @param args - Arguments * @param args.filePath - Path to the JSON file * @param args.ifAbsent - Value to return when the file does not exist * * @throws When the file exists but is not valid JSON, or parses to something * other than a plain object — so callers abort instead of overwriting it. * * @returns The parsed object, or `ifAbsent` when the file is missing * */ export declare const readJsonObjectFile: (args: { filePath: string; ifAbsent: Record; }) => Promise>; /** * Write a value as pretty-printed JSON, atomically. * * @param args - Arguments * @param args.filePath - Destination path (parent dirs are created) * @param args.value - The value to serialize */ export declare const writeJsonFileAtomic: (args: { filePath: string; value: unknown; }) => Promise; //# sourceMappingURL=jsonFile.d.ts.map