/** * Writes JSON to disk atomically using write-to-temp-then-rename. * * On POSIX systems, `fs.renameSync()` is atomic — the file is either * the old version or the new version, never half-written. This prevents * corruption if the process crashes mid-write (power loss, OOM, SIGKILL). * * The temp file is created in the same directory as the target to ensure * the rename operation is atomic (cross-device renames are not atomic). */ export declare function safeWriteJson(filePath: string, data: unknown, indent?: number): void; /** * Writes a string to disk atomically using write-to-temp-then-rename. * * Creates parent directories if they don't exist. * Uses `.tmp` extension for the intermediate file, cleaned up on error. */ export declare function safeWriteFile(filePath: string, content: string, _encoding?: BufferEncoding): void; /** * Reads and parses a JSON file with error handling. * Returns the fallback value if the file doesn't exist or is malformed. */ export declare function safeReadJson(filePath: string, fallback: T): T;