/** * Template Merger * * Auto-merge strategies for template updates. * Handles safe updates, new file creation, and diff generation. */ import type { FileComparison, MergeResult, MergeMethod } from './types.js'; /** * Merger options */ export interface MergerOptions { /** Whether to create backups before overwriting */ createBackups?: boolean; /** Backup directory path */ backupDir?: string; /** Whether to generate diffs */ generateDiffs?: boolean; /** Number of context lines for diffs */ diffContext?: number; } /** * Auto-merge strategies for template updates */ export declare class TemplateMerger { private projectRoot; private templateRoot; private options; constructor(projectRoot: string | undefined, templateRoot: string, options?: MergerOptions); /** * Process multiple files for merging * * @param comparisons - File comparisons to process * @returns Array of merge results */ mergeFiles(comparisons: FileComparison[]): Promise; /** * Merge a single file based on comparison state * * @param comparison - File comparison * @returns Merge result */ mergeFile(comparison: FileComparison): Promise; /** * Create new file (no local version exists) * * @param templatePath - Path to template file * @param localPath - Path where local file should be created * @param comparison - File comparison * @returns Merge result */ private createNewFile; /** * Safe update (local exists but not user-modified) * * @param templatePath - Path to template file * @param localPath - Path to local file * @param comparison - File comparison * @returns Merge result */ private safeUpdate; /** * Overwrite file with template (for conflict resolution) * * @param templatePath - Path to template file * @param localPath - Path to local file * @returns Merge result */ overwriteFile(templatePath: string, localPath: string): Promise; /** * Create backup of a file * * @param filePath - Path to file to backup */ private createBackup; /** * Generate unified diff between two files * * @param localPath - Path to local file * @param templatePath - Path to template file * @returns Unified diff string */ generateDiff(localPath: string, templatePath: string): Promise; /** * Read file safely, return empty string if not found * * @param filePath - Path to file * @returns File content */ private readFileSafe; /** * Generate unified diff (simplified implementation) * * @param localLines - Local file lines * @param templateLines - Template file lines * @param localPath - Local file path (for header) * @param templatePath - Template file path (for header) * @returns Unified diff string */ private unifiedDiff; /** * Check if context should be shown */ private shouldShowContext; /** * Show context lines before a change */ private showContext; /** * Find end of a change block */ private findChangeEnd; /** * Get merge statistics from results * * @param results - Array of merge results * @returns Statistics */ static getStatistics(results: MergeResult[]): { total: number; successful: number; failed: number; byMethod: Record; }; } //# sourceMappingURL=merger.d.ts.map