/**
 * Migration state tracking and recovery.
 *
 * Provides persistent tracking of migration progress to enable:
 * - Resumable migrations after interruptions
 * - Debugging of failed migrations
 * - Progress monitoring during long operations
 *
 * @task T4726
 * @epic T4454
 */
/** Migration phase - tracks current step in the migration process */
export type MigrationPhase = 'init' | 'backup' | 'validate' | 'import' | 'verify' | 'cleanup' | 'complete' | 'failed';
/** Source file info with checksum for integrity verification */
export interface SourceFileInfo {
    path: string;
    checksum: string;
    taskCount?: number;
    sessionCount?: number;
    archivedCount?: number;
}
/** Migration progress tracking */
export interface MigrationProgress {
    tasksImported: number;
    archivedImported: number;
    sessionsImported: number;
    totalTasks: number;
    totalArchived: number;
    totalSessions: number;
}
/** Complete migration state structure */
export interface MigrationState {
    version: '1.0.0';
    startedAt: string;
    phase: MigrationPhase;
    sourceFiles: {
        todoJson?: SourceFileInfo;
        sessionsJson?: SourceFileInfo;
        archiveJson?: SourceFileInfo;
    };
    backupPath?: string;
    tempPath?: string;
    progress: MigrationProgress;
    errors: string[];
    warnings: string[];
    completedAt?: string;
}
/**
 * Create initial migration state at the start of migration.
 *
 * Captures source file checksums and initializes progress tracking.
 * Uses atomic write pattern to ensure state is never in an inconsistent state.
 *
 * @param cleoDir - Path to .cleo directory
 * @param sourceFiles - Optional pre-computed source file info
 * @returns The created migration state
 * @task T4726
 */
export declare function createMigrationState(cleoDir: string, sourceFiles?: MigrationState['sourceFiles']): Promise<MigrationState>;
/**
 * Update migration state with partial updates.
 *
 * Merges updates with existing state and writes atomically.
 * Automatically adds timestamp to phase transitions.
 *
 * @param cleoDir - Path to .cleo directory
 * @param updates - Partial state updates to apply
 * @returns The updated migration state
 * @task T4726
 */
export declare function updateMigrationState(cleoDir: string, updates: Partial<MigrationState>): Promise<MigrationState>;
/**
 * Update just the migration phase.
 * Convenience wrapper for common phase transition.
 *
 * @param cleoDir - Path to .cleo directory
 * @param phase - New phase
 * @returns The updated migration state
 * @task T4726
 */
export declare function updateMigrationPhase(cleoDir: string, phase: MigrationPhase): Promise<MigrationState>;
/**
 * Update progress counters during import.
 *
 * @param cleoDir - Path to .cleo directory
 * @param progress - Progress updates (only changed counters needed)
 * @returns The updated migration state
 * @task T4726
 */
export declare function updateMigrationProgress(cleoDir: string, progress: Partial<MigrationProgress>): Promise<MigrationState>;
/**
 * Add an error to the migration state.
 *
 * @param cleoDir - Path to .cleo directory
 * @param error - Error message
 * @returns The updated migration state
 * @task T4726
 */
export declare function addMigrationError(cleoDir: string, error: string): Promise<MigrationState>;
/**
 * Add a warning to the migration state.
 *
 * @param cleoDir - Path to .cleo directory
 * @param warning - Warning message
 * @returns The updated migration state
 * @task T4726
 */
export declare function addMigrationWarning(cleoDir: string, warning: string): Promise<MigrationState>;
/**
 * Load existing migration state.
 *
 * @param cleoDir - Path to .cleo directory
 * @returns Migration state, or null if no state file exists
 * @task T4726
 */
export declare function loadMigrationState(cleoDir: string): Promise<MigrationState | null>;
/**
 * Check if a migration is in progress.
 *
 * @param cleoDir - Path to .cleo directory
 * @returns true if migration state exists and is not complete/failed
 * @task T4726
 */
export declare function isMigrationInProgress(cleoDir: string): Promise<boolean>;
/**
 * Check if migration can be resumed.
 *
 * @param cleoDir - Path to .cleo directory
 * @returns Object with resume info, or null if cannot resume
 * @task T4726
 */
export declare function canResumeMigration(cleoDir: string): Promise<{
    canResume: boolean;
    phase: MigrationPhase;
    progress: MigrationProgress;
    errors: string[];
} | null>;
/**
 * Mark migration as complete.
 *
 * @param cleoDir - Path to .cleo directory
 * @returns The completed migration state
 * @task T4726
 */
export declare function completeMigration(cleoDir: string): Promise<MigrationState>;
/**
 * Mark migration as failed with error details.
 *
 * @param cleoDir - Path to .cleo directory
 * @param error - Primary error message
 * @returns The failed migration state
 * @task T4726
 */
export declare function failMigration(cleoDir: string, error: string): Promise<MigrationState>;
/**
 * Clear migration state file.
 * Safe to call even if state doesn't exist.
 *
 * @param cleoDir - Path to .cleo directory
 * @task T4726
 */
export declare function clearMigrationState(cleoDir: string): Promise<void>;
/**
 * Get a summary of migration state for display.
 *
 * @param cleoDir - Path to .cleo directory
 * @returns Human-readable summary, or null if no state
 * @task T4726
 */
export declare function getMigrationSummary(cleoDir: string): Promise<string | null>;
/**
 * Verify source files haven't changed since migration started.
 *
 * Compares current checksums with stored checksums to detect
 * if source files were modified during migration.
 *
 * @param cleoDir - Path to .cleo directory
 * @returns Object with verification results
 * @task T4726
 */
export declare function verifySourceIntegrity(cleoDir: string): Promise<{
    valid: boolean;
    changed: string[];
    missing: string[];
}>;
//# sourceMappingURL=state.d.ts.map