/** * File Writer * Creates .ralph directory structure and writes processed templates */ /** * Options for file writing */ export interface WriteOptions { /** How to handle existing files: 'backup', 'skip', 'overwrite' */ existingFiles: 'backup' | 'skip' | 'overwrite'; /** Whether to create backup files */ createBackups: boolean; /** Verbose output */ verbose: boolean; } /** * Default write options */ export declare const DEFAULT_WRITE_OPTIONS: WriteOptions; /** * Result of a write operation */ export interface WriteResult { /** Path that was written */ path: string; /** Whether the write was successful */ success: boolean; /** Action taken: created, backed_up, skipped, overwritten */ action: 'created' | 'backed_up' | 'skipped' | 'overwritten' | 'error'; /** Error message if any */ error?: string; /** Backup path if created */ backupPath?: string; } /** * Summary of all write operations */ export interface WriteSummary { /** Total files processed */ total: number; /** Files created (new) */ created: number; /** Files backed up and replaced */ backedUp: number; /** Files skipped (already existed) */ skipped: number; /** Files overwritten */ overwritten: number; /** Files that failed */ errors: number; /** Individual results */ results: WriteResult[]; } /** * Create a directory and all parent directories */ export declare function ensureDir(dirPath: string): Promise; /** * Check if a file exists */ export declare function fileExists(filePath: string): Promise; /** * Create a backup of an existing file */ export declare function backupFile(filePath: string): Promise; /** * Write a single file with options */ export declare function writeFileWithOptions(filePath: string, content: string, options?: WriteOptions): Promise; /** * Write multiple files from a Map */ export declare function writeFiles(files: Map, baseDir: string, options?: WriteOptions): Promise; /** * Directory structure for .ralph */ export declare const RALPH_DIRECTORY_STRUCTURE: { root: string; directories: string[]; }; /** * Create the .ralph directory structure */ export declare function createDirectoryStructure(projectRoot: string): Promise; /** * Map template output paths to their final locations in .ralph */ export declare function mapTemplateOutputPaths(templateOutputs: Map): Map; /** * Format write summary for display */ export declare function formatWriteSummary(summary: WriteSummary): string;