From 4dace513eab3ffc28cf67fc1db652f5908403973 Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Fri, 2 Jan 2026 21:19:22 +0800 Subject: [PATCH] fix(migrate): Add rename-profile flag handling - Add renameMinimaxProfile import from rename-minimax-profile.ts - Handle --rename-profile flag in handleMigrateCommand - Update help text with rename-profile example - Fix @ts-ignore comment to suppress unused warning --- src/commands/migrate-command.ts | 49 ++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/src/commands/migrate-command.ts b/src/commands/migrate-command.ts index b8ea4dd4..216e4f0b 100644 --- a/src/commands/migrate-command.ts +++ b/src/commands/migrate-command.ts @@ -1,2 +1,49 @@ /** -export * from "./rename-minimax-profile"; +import { + migrate, + rollback, + needsMigration, + getBackupDirectories, + renameMinimaxProfile, +} from '../config/migration-manager'; +import { hasUnifiedConfig } from '../config/unified-config-loader'; +import { initUI, ok, fail, info, warn, infoBox, dim } from '../utils/ui'; + +export async function handleMigrateCommand(args: string[]): Promise { + await initUI(); + + // Handle --rename-profile + const renameIndex = args.indexOf('--rename-profile'); + if (renameIndex !== -1) { + const fromProfile = args[renameIndex + 1]; + const toProfile = args[renameIndex + 2]; + + if (!fromProfile || !toProfile) { + console.error(fail('Error: --rename-profile requires and arguments')); + console.log(info('Usage: ccs migrate --rename-profile ')); + console.log(info('Example: ccs migrate --rename-profile minimax mm')); + process.exit(1); + } + + const { renameMinimaxProfile } = await import('./config/rename-minimax-profile'); + + const result = await renameMinimaxProfile(); + + if (result.success) { + console.log(''); + console.log(infoBox(`Renamed profile: ${fromProfile} → ${toProfile}`, 'SUCCESS')); + if (result.warnings.length > 0) { + result.warnings.forEach((warning) => console.log(warn(warning))); + } + console.log(''); + console.log(info(`Items migrated: ${result.migratedFiles.length}`)); + for (const file of result.migratedFiles) { + console.log(` - ${file}`); + } + } else { + console.error(fail(`Rename failed: ${result.error}`)); + process.exit(1); + } + + return; + }