fix(migrate): Add rename-profile flag handling

- Add renameMinimaxProfile import from rename-minimax-profile.ts
- Handle --rename-profile <from> <to> flag in handleMigrateCommand
- Update help text with rename-profile example
- Fix @ts-ignore comment to suppress unused warning
This commit is contained in:
Huynh Duc Dung
2026-01-02 21:19:22 +08:00
parent 267599d09d
commit 4dace513ea
+48 -1
View File
@@ -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<void> {
await initUI();
// Handle --rename-profile <from> <to>
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 <from> and <to> arguments'));
console.log(info('Usage: ccs migrate --rename-profile <from> <to>'));
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;
}