/** * @fractary/core - Archive Migration * * Migrates locally archived files to cloud storage when a project transitions * from local to cloud-based archiving. * * When a project starts out, archives go to a local folder (e.g., .fractary/logs/archive/). * When cloud storage is configured, this module finds all previously locally archived files * and uploads them to cloud storage, then removes the local copies. */ import { Storage } from './types'; /** * Options for migrating local archives to cloud storage */ export interface MigrateArchiveOptions { /** Local archive directory to scan (e.g., '.fractary/logs/archive') */ localArchiveDir: string; /** Cloud storage prefix for archived files (e.g., 'archive/logs') */ cloudPrefix: string; /** Cloud storage backend to upload to */ cloudStorage: Storage; /** If true, report what would be migrated without actually doing it */ dryRun?: boolean; /** If true, verify file exists in cloud before removing local copy (default: true) */ verify?: boolean; } /** * Result of a single file migration */ export interface MigratedFile { /** Relative path within the local archive */ file: string; /** Cloud URL or path after upload */ cloudUrl: string; } /** * Result of a failed file migration */ export interface FailedFile { /** Path of the file that failed */ file: string; /** Error message */ error: string; } /** * Result of an archive migration operation */ export interface MigrateArchiveResult { /** Number of files successfully migrated */ migrated: number; /** Number of files that failed to migrate */ failed: number; /** ISO timestamp of when migration ran */ migratedAt: string; /** Details of successfully migrated files */ migratedFiles: MigratedFile[]; /** Details of failed files */ failedFiles: FailedFile[]; /** Whether this was a dry run */ dryRun: boolean; /** Message summarizing the result */ message: string; } /** * Migrate locally archived files to cloud storage. * * Scans the local archive directory, uploads each file to the cloud storage * backend using the same relative path structure, verifies the upload, * and removes the local copy. * * This operation is idempotent - if no local archived files exist, it * returns immediately with migrated: 0. * * @example * ```typescript * import { migrateArchive } from '@fractary/core/file'; * import { createStorageFromSource } from '@fractary/core/file'; * import { loadFileConfig } from '@fractary/core/common/config'; * * const fileConfig = loadFileConfig(); * const cloudStorage = createStorageFromSource('logs', fileConfig); * * const result = await migrateArchive({ * localArchiveDir: '.fractary/logs/archive', * cloudPrefix: 'archive/logs', * cloudStorage, * }); * * console.log(`Migrated ${result.migrated} files`); * ``` */ export declare function migrateArchive(options: MigrateArchiveOptions): Promise; //# sourceMappingURL=migration.d.ts.map