mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-19 12:16:10 +00:00
feat(config): add unified YAML config with migration support
Implements unified config.yaml format consolidating: - config.json (API profiles) - profiles.json (account metadata) - *.settings.json (env vars) Features: - Auto-migration from v1 JSON to v2 YAML with backup - Secrets separation into secrets.yaml (chmod 600) - Enhanced YAML output with section comments - CLIProxy OAuth settings migration with env var support - Feature flag for gradual rollout (CCS_UNIFIED_CONFIG=1) - Rollback support via ccs migrate --rollback New commands: - ccs migrate - Run migration - ccs migrate --dry-run - Preview changes - ccs migrate --rollback <path> - Restore from backup - ccs migrate --list-backups - List available backups Closes #75
This commit is contained in:
1 parent
0e46b6ba10
commit
b621b8e47b
21 files changed
+2575
-141
No files matched your search
+18
@@ -202,6 +202,10 @@ interface ProfileError extends Error {
|
||||
async function main(): Promise<void> {
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
// Auto-migrate to unified config format (silent if already migrated)
|
||||
const { autoMigrate } = await import('./config/migration-manager');
|
||||
await autoMigrate();
|
||||
|
||||
// Special case: version command (check BEFORE profile detection)
|
||||
const firstArg = args[0];
|
||||
if (firstArg === 'version' || firstArg === '--version' || firstArg === '-v') {
|
||||
@@ -245,6 +249,20 @@ async function main(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
// Special case: migrate command
|
||||
if (firstArg === 'migrate' || firstArg === '--migrate') {
|
||||
const { handleMigrateCommand, printMigrateHelp } = await import('./commands/migrate-command');
|
||||
const migrateArgs = args.slice(1);
|
||||
|
||||
if (migrateArgs.includes('--help') || migrateArgs.includes('-h')) {
|
||||
printMigrateHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
await handleMigrateCommand(migrateArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
// Special case: update command
|
||||
if (firstArg === 'update' || firstArg === '--update') {
|
||||
const updateArgs = args.slice(1);
|
||||
|
||||
Reference in new issue
Block a user