/**
 * Sync Workflow Utilities
 *
 * Utility functions for sync operations including per-file progress tracking
 * and atomic two-phase commit support.
 *
 * @since v1.38.0
 * @updated v1.41.0 - Added atomic sync utilities
 */
import type { BatchResolutionOptions, ConflictDetectionOptions, ConflictDetectionResult, ConflictResolution, ConflictResolutionLog, ConflictType, DryRunResult, FileProgress, StagingState, SyncAction, SyncConflict, SyncDirection } from './sync-types.js';
/**
 * Copy a file with progress tracking
 *
 * Uses streams to report byte-level progress for large files.
 */
export declare function copyFileWithProgress(sourcePath: string, targetPath: string, onProgress?: (progress: FileProgress) => void): Promise<number>;
/**
 * Get file size
 */
export declare function getFileSize(filePath: string): Promise<number>;
/**
 * Calculate total bytes for a list of sync actions
 */
export declare function calculateTotalBytes(actions: SyncAction[]): Promise<number>;
/**
 * Enhance sync actions with file size information
 */
export declare function enhanceActionsWithSize(actions: SyncAction[]): Promise<SyncAction[]>;
/**
 * Generate dry run result from sync actions
 */
export declare function generateDryRunResult(actions: SyncAction[]): DryRunResult;
/**
 * Format bytes to human-readable string
 */
export declare function formatBytes(bytes: number): string;
/**
 * Format transfer speed
 */
export declare function formatSpeed(bytesPerSecond: number): string;
/**
 * Calculate overall progress from current action and file progress
 */
export declare function calculateOverallProgress(currentAction: number, totalActions: number, currentFileProgress?: FileProgress): number;
/**
 * Create a staging directory for atomic sync
 */
export declare function createStagingDirectory(targetDir: string, customPath?: string): Promise<StagingState>;
/**
 * Copy a single file to staging directory
 */
export declare function stageFile(sourcePath: string, stagingDir: string, relativePath: string, onProgress?: (progress: FileProgress) => void): Promise<number>;
/**
 * Copy all files to staging directory
 */
export declare function copyToStaging(actions: SyncAction[], stagingDir: string, onProgress?: (current: number, total: number, fileName: string) => void): Promise<string[]>;
/**
 * Verify staging directory integrity by comparing hashes
 */
export declare function verifyStagingIntegrity(stagingState: StagingState, actions: SyncAction[]): Promise<{
    valid: boolean;
    hash?: string;
    errors: string[];
}>;
/**
 * Commit staging to target (atomic swap)
 *
 * This performs the "commit" phase of two-phase commit:
 * 1. Rename current target to backup
 * 2. Rename staging to target
 *
 * If Phase 2 fails, automatically rolls back by restoring the backup.
 */
export declare function commitStaging(stagingState: StagingState): Promise<void>;
/**
 * Rollback to previous state
 *
 * Restores the backup directory to the target location.
 */
export declare function rollbackStaging(stagingState: StagingState): Promise<void>;
/**
 * Clean up staging and backup directories after successful sync
 */
export declare function cleanupStaging(stagingState: StagingState, keepBackup?: boolean): Promise<void>;
/**
 * Check if a directory is a staging or backup directory from a previous failed sync
 */
export declare function isOrphanedSyncDirectory(dirName: string): boolean;
/**
 * Find and list orphaned staging/backup directories
 */
export declare function findOrphanedSyncDirectories(parentDir: string): Promise<string[]>;
/**
 * Clean up orphaned staging/backup directories from failed syncs
 */
export declare function cleanupOrphanedSyncDirectories(parentDir: string): Promise<number>;
/**
 * Scan file info for dry run comparison
 */
interface FileInfo {
    path: string;
    name: string;
    size: number;
    modified: Date;
    checksum?: string;
}
/**
 * Scan a plugins directory for dry run comparison
 */
export declare function scanPluginsDirectory(dir: string): Promise<Map<string, FileInfo>>;
/**
 * Compare source and target directories to generate dry run result
 */
export declare function compareDirsForDryRun(sourceDir: string, targetDir: string, options: {
    direction: SyncDirection;
    disableOnTarget?: string[];
    removeExtra?: boolean;
}): Promise<DryRunResult>;
/**
 * Format a dry run result for console output
 */
export declare function formatDryRunResult(result: DryRunResult, direction: SyncDirection): string;
/**
 * Get a summary of dry run changes for UI display
 */
export declare function getDryRunSummary(result: DryRunResult): {
    totalChanges: number;
    newFiles: number;
    updatedFiles: number;
    deletedFiles: number;
    disabledFiles: number;
    enabledFiles: number;
    skippedFiles: number;
    bytesToTransfer: number;
    spaceRequired: number;
};
/**
 * Default conflict detection options
 */
export declare const DEFAULT_CONFLICT_OPTIONS: Required<ConflictDetectionOptions>;
/**
 * Classify a conflict between source and target files
 */
export declare function classifyConflict(sourceInfo: FileInfo, targetInfo: FileInfo, options: Required<ConflictDetectionOptions>): ConflictType | null;
/**
 * Detect conflicts between source and target directories
 */
export declare function detectConflicts(sourceDir: string, targetDir: string, options?: ConflictDetectionOptions): Promise<ConflictDetectionResult>;
/**
 * Detect config file conflicts in plugin config directories
 */
export declare function detectConfigConflicts(sourceDir: string, targetDir: string, pluginName: string, options?: ConflictDetectionOptions): Promise<SyncConflict[]>;
/**
 * Get human-readable description for a conflict type
 */
export declare function getConflictTypeDescription(type: ConflictType): string;
/**
 * Get icon for a conflict type
 */
export declare function getConflictTypeIcon(type: ConflictType): string;
/**
 * Format conflicts for console output
 */
export declare function formatConflicts(conflicts: SyncConflict[]): string;
/**
 * Format a conflict for single-line display
 */
export declare function formatConflictShort(conflict: SyncConflict): string;
/**
 * Apply a resolution to a conflict
 */
export declare function applyResolution(conflict: SyncConflict, resolution: ConflictResolution, backupDir?: string): Promise<ConflictResolutionLog>;
/**
 * Apply batch resolutions to multiple conflicts
 */
export declare function applyBatchResolutions(conflicts: SyncConflict[], options: BatchResolutionOptions): Promise<ConflictResolutionLog[]>;
/**
 * Format resolution logs for display
 */
export declare function formatResolutionLogs(logs: ConflictResolutionLog[]): string;
/**
 * Filter conflicts by type
 */
export declare function filterConflictsByType(conflicts: SyncConflict[], types: ConflictType[]): SyncConflict[];
/**
 * Sort conflicts by severity (higher severity first)
 */
export declare function sortConflictsBySeverity(conflicts: SyncConflict[]): SyncConflict[];
/**
 * Get conflict statistics
 */
export declare function getConflictStats(conflicts: SyncConflict[]): {
    total: number;
    byType: Record<ConflictType, number>;
    totalSourceBytes: number;
    totalTargetBytes: number;
};
export {};
//# sourceMappingURL=sync-utils.d.ts.map