/** * Storage backend migration CLI — see §4.7a + §14.9a of * docs/berth-recommender-and-pdf-plan.md. * * pnpm tsx scripts/migrate-storage.ts --from s3 --to filesystem [--dry-run] * pnpm tsx scripts/migrate-storage.ts --from filesystem --to s3 * * The actual migration logic lives in `src/lib/storage/migrate.ts` so the * admin UI's "Switch backend" button can run the exact same code path. This * file is a thin CLI wrapper. */ import { logger } from '@/lib/logger'; import { parseArgs, runMigration } from '@/lib/storage/migrate'; async function main(): Promise { const args = parseArgs(process.argv.slice(2)); logger.info({ args }, 'Starting storage migration'); const result = await runMigration(args); logger.info({ result }, 'Storage migration complete'); console.log(JSON.stringify(result, null, 2)); process.exit(0); } main().catch((err) => { logger.error({ err }, 'Storage migration failed'); console.error(err); process.exit(2); });