mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-04 16:16:46 +00:00
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:
@@ -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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user