/** * Sync Workflow Types * * Enhanced type definitions for sync operations with per-file progress tracking. * * @since v1.38.0 */ /** * Sync direction */ export type SyncDirection = 'prod-to-test' | 'test-to-prod'; /** * Sync phases */ export type SyncPhase = 'scanning' | 'planning' | 'backup' | 'staging' | 'copying' | 'verifying' | 'committing' | 'rolling-back' | 'cleanup' | 'complete'; /** * Sync action for a plugin */ export interface SyncAction { pluginName: string; action: 'copy' | 'remove' | 'skip' | 'disable' | 'enable'; sourceFile?: string; targetFile?: string; reason?: string; fileSize?: number; /** Files to remove before executing the action (duplicate cleanup) */ filesToClean?: string[]; } /** * File progress information */ export interface FileProgress { /** File name */ name: string; /** Total file size in bytes */ size: number; /** Bytes transferred so far */ transferred: number; /** Progress percentage (0-100) */ percent: number; } /** * Enhanced sync progress event with per-file tracking */ export interface SyncProgress { /** Current sync phase */ phase: SyncPhase; /** Current action index (1-based) */ current: number; /** Total number of actions */ total: number; /** Current plugin being processed */ pluginName: string; /** Current action type */ action: string; /** Action status */ status: 'pending' | 'in_progress' | 'done' | 'error'; /** Optional status message */ message?: string; /** Per-file progress for current file (for large file operations) */ currentFile?: FileProgress; /** Overall progress percentage (0-100) */ overallProgress: number; /** Bytes transferred in current operation */ bytesTransferred?: number; /** Total bytes to transfer */ totalBytes?: number; } /** * Sync result */ export interface SyncResult { direction: SyncDirection; copied: string[]; removed: string[]; skipped: string[]; disabled: string[]; enabled: string[]; errors: Array<{ pluginName: string; error: string; }>; duration: number; backupPath?: string; /** Total bytes transferred */ bytesTransferred?: number; /** Total files processed */ filesProcessed?: number; /** Count of unrecognized JAR-like files found in target (e.g., .jar.old, .jar.bak) */ unrecognizedFileCount?: number; } /** * Sync options */ export interface SyncOptions { /** Production server plugins directory */ prodDir: string; /** Test server plugins directory */ testDir: string; /** Plugins to disable on test server */ disableOnTest?: string[]; /** Plugins to skip when migrating to production (test-to-prod) */ skipMigrateToProd?: string[]; /** * Restrict the sync to EXACTLY these plugins (case-insensitive names). * Source plugins outside the list become 'skip' actions with an explicit * reason (never silently dropped), and removeExtra never touches * non-listed target plugins. Added for the Phase 4.4 promotion engine, * which promotes individual soaked plugins test→prod. */ includePlugins?: string[]; /** Whether to create backup before sync */ createBackup?: boolean; /** Backup directory */ backupDir?: string; /** Whether to remove extra plugins from target */ removeExtra?: boolean; /** Dry run (don't make changes) */ dryRun?: boolean; /** Progress callback (enhanced) */ onProgress?: (progress: SyncProgress) => void; /** Enable per-file byte progress for files larger than this (bytes) */ largeFileThreshold?: number; /** Called when target server is detected as running. Return true to continue, false to abort. */ onServerRunning?: (serverDir: string) => Promise; /** * Optional AbortSignal. When fired, the workflow stops at the next * file-copy boundary. Phase 3 audit, finding API [11] (April 30, 2026). */ signal?: AbortSignal; } /** * Dry run result */ export interface DryRunResult { /** Files that would be copied (new) */ filesToCopy: Array<{ path: string; size: number; }>; /** Files that would be deleted */ filesToDelete: Array<{ path: string; size: number; }>; /** Files that would be updated */ filesToUpdate: Array<{ path: string; oldSize: number; newSize: number; }>; /** Files that would be disabled */ filesToDisable: Array<{ path: string; size: number; }>; /** Files that would be enabled */ filesToEnable: Array<{ path: string; size: number; }>; /** Files that would be skipped */ filesToSkip: Array<{ path: string; reason: string; }>; /** Total bytes that would be transferred */ totalBytesToTransfer: number; /** Disk space required */ spaceRequired: number; } /** * Sync conflict types */ export type ConflictType = 'newer-target' | 'different-content' | 'config-file' | 'size-mismatch'; /** * Sync conflict */ export interface SyncConflict { type: ConflictType; sourcePath: string; targetPath: string; sourceModified: Date; targetModified: Date; sourceSize: number; targetSize: number; } /** * Conflict resolution action */ export interface ConflictResolution { action: 'overwrite' | 'skip' | 'rename' | 'backup-then-overwrite'; applyToAll?: boolean; } /** * Conflict detection options */ export interface ConflictDetectionOptions { /** Check for config file conflicts (plugin config folders) */ checkConfigFiles?: boolean; /** Size difference threshold for size-mismatch conflict (percentage, default 50%) */ sizeMismatchThreshold?: number; /** Time tolerance in milliseconds for considering files as same age (default 1000ms) */ timeTolerance?: number; /** File extensions to check for config conflicts (default: ['.yml', '.yaml', '.json', '.properties']) */ configExtensions?: string[]; } /** * Conflict detection result */ export interface ConflictDetectionResult { /** List of detected conflicts */ conflicts: SyncConflict[]; /** Total files checked */ filesChecked: number; /** Files with no conflicts */ filesClean: number; /** Whether any conflicts were found */ hasConflicts: boolean; } /** * Resolution log entry */ export interface ConflictResolutionLog { /** Timestamp of resolution */ timestamp: Date; /** The conflict that was resolved */ conflict: SyncConflict; /** The resolution applied */ resolution: ConflictResolution; /** Result of applying resolution */ result: 'success' | 'failed'; /** Error message if failed */ error?: string; } /** * Batch conflict resolution options */ export interface BatchResolutionOptions { /** Default action for all conflicts */ defaultAction?: ConflictResolution['action']; /** Actions for specific conflict types */ typeActions?: Partial>; /** Create backups before overwriting */ backupBeforeOverwrite?: boolean; /** Backup directory */ backupDir?: string; } /** * Default large file threshold (1 MB) */ export declare const DEFAULT_LARGE_FILE_THRESHOLD: number; /** * Atomic sync options (extends SyncOptions with two-phase commit support) */ export interface AtomicSyncOptions extends SyncOptions { /** Enable atomic sync with staging directory */ atomic?: boolean; /** Custom staging directory (defaults to .sync-staging-) */ stagingDir?: string; /** Verify staging integrity before commit */ verifyStaging?: boolean; /** Keep staging directory on failure for debugging */ keepStagingOnFailure?: boolean; } /** * Atomic sync result (extends SyncResult with staging info) */ export interface AtomicSyncResult extends SyncResult { /** Whether atomic mode was used */ atomic: boolean; /** Staging directory used (if atomic) */ stagingPath?: string; /** Whether verification passed (if atomic) */ verificationPassed?: boolean; /** Whether rollback was performed */ rolledBack?: boolean; /** Rollback reason if rolled back */ rollbackReason?: string; } /** * Staging state for atomic sync */ export interface StagingState { /** Staging directory path */ stagingDir: string; /** Backup directory path (original target) */ backupDir: string; /** Target directory path */ targetDir: string; /** Timestamp of staging creation */ timestamp: number; /** Whether staging is ready for commit */ readyToCommit: boolean; /** Files staged */ stagedFiles: string[]; /** Verification hash (if verified) */ verificationHash?: string; } //# sourceMappingURL=sync-types.d.ts.map