/** * File Writer with Atomic Writes * * Writes projection results to disk with atomic operations, * backup support, and directory creation. */ /** * Input for file writing operation * Represents content to be written to a target file */ export interface FileProjection { /** Target file path (absolute or relative) */ path: string; /** Content to write */ content: string; } /** * Options for writing projections */ export interface WriteOptions { /** When true, report what would be done without making changes */ dryRun: boolean; /** When true, create .bak file before overwriting existing files */ backup: boolean; } /** * Error information for a failed write operation */ export interface WriteError { /** Path that failed to write */ path: string; /** Human-readable error message */ error: string; } /** * Result of a write operation */ export interface WriteResult { /** Whether all write operations completed successfully */ success: boolean; /** Paths that were successfully written */ written: string[]; /** Paths that were skipped (e.g., content unchanged) */ skipped: string[]; /** Errors encountered during write operations */ errors: WriteError[]; } /** * Write projection results to disk with atomic operations * * Features: * - Atomic writes: content is written to a temp file first, then renamed * - Backup support: creates .bak files before overwriting * - Directory creation: creates parent directories as needed * - Dry-run mode: reports what would be done without making changes * - Content comparison: skips unchanged files * * @param projections - Array of projection results to write * @param options - Write options (dryRun, backup) * @returns WriteResult with success status, written paths, skipped paths, and errors * * @example * ```ts * const projections = [ * { path: '/path/to/file.md', content: '# Header\nContent here' } * ]; * * // Normal write with backup * const result = writeProjections(projections, { dryRun: false, backup: true }); * * // Dry-run to preview changes * const preview = writeProjections(projections, { dryRun: true, backup: false }); * ``` */ export declare function writeProjections(projections: FileProjection[], options: WriteOptions): WriteResult;