coder-config 0.44.49 → 0.44.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config-loader.js +91 -0
- package/lib/cli.js +12 -0
- package/lib/constants.js +1 -1
- package/package.json +1 -1
package/config-loader.js
CHANGED
|
@@ -346,6 +346,97 @@ class ClaudeConfigManager {
|
|
|
346
346
|
return updated > 0;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
+
// Migrate from legacy to new directory
|
|
350
|
+
migrate(options = {}) {
|
|
351
|
+
const home = process.env.HOME || '';
|
|
352
|
+
const legacyDir = path.join(home, '.claude-config');
|
|
353
|
+
const newDir = path.join(home, '.coder-config');
|
|
354
|
+
|
|
355
|
+
// Check if legacy exists
|
|
356
|
+
if (!fs.existsSync(legacyDir)) {
|
|
357
|
+
console.log('No legacy directory found (~/.claude-config)');
|
|
358
|
+
console.log(`Already using: ${this.installDir}`);
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Check what's in legacy
|
|
363
|
+
const legacyFiles = fs.readdirSync(legacyDir);
|
|
364
|
+
if (legacyFiles.length === 0) {
|
|
365
|
+
console.log('Legacy directory is empty');
|
|
366
|
+
if (options.removeEmpty) {
|
|
367
|
+
fs.rmdirSync(legacyDir);
|
|
368
|
+
console.log('✓ Removed empty legacy directory');
|
|
369
|
+
}
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
console.log(`\nMigrating from ~/.claude-config to ~/.coder-config\n`);
|
|
374
|
+
console.log('Legacy contents:');
|
|
375
|
+
legacyFiles.forEach(f => console.log(` - ${f}`));
|
|
376
|
+
console.log('');
|
|
377
|
+
|
|
378
|
+
// Ensure new directory exists
|
|
379
|
+
if (!fs.existsSync(newDir)) {
|
|
380
|
+
fs.mkdirSync(newDir, { recursive: true });
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Copy each item
|
|
384
|
+
let migrated = 0;
|
|
385
|
+
let skipped = 0;
|
|
386
|
+
for (const item of legacyFiles) {
|
|
387
|
+
const src = path.join(legacyDir, item);
|
|
388
|
+
const dest = path.join(newDir, item);
|
|
389
|
+
|
|
390
|
+
if (fs.existsSync(dest)) {
|
|
391
|
+
if (options.force) {
|
|
392
|
+
// Remove existing and replace
|
|
393
|
+
if (fs.statSync(dest).isDirectory()) {
|
|
394
|
+
fs.rmSync(dest, { recursive: true });
|
|
395
|
+
} else {
|
|
396
|
+
fs.unlinkSync(dest);
|
|
397
|
+
}
|
|
398
|
+
} else {
|
|
399
|
+
console.log(` ⊘ Skipped ${item} (already exists in new location)`);
|
|
400
|
+
skipped++;
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Copy file or directory
|
|
406
|
+
if (fs.statSync(src).isDirectory()) {
|
|
407
|
+
copyDirRecursive(src, dest);
|
|
408
|
+
} else {
|
|
409
|
+
fs.copyFileSync(src, dest);
|
|
410
|
+
}
|
|
411
|
+
console.log(` ✓ Migrated ${item}`);
|
|
412
|
+
migrated++;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
console.log('');
|
|
416
|
+
|
|
417
|
+
if (migrated > 0) {
|
|
418
|
+
console.log(`✅ Migrated ${migrated} item(s)`);
|
|
419
|
+
|
|
420
|
+
// Update installDir for this session
|
|
421
|
+
this.installDir = newDir;
|
|
422
|
+
|
|
423
|
+
if (options.removeLegacy) {
|
|
424
|
+
fs.rmSync(legacyDir, { recursive: true });
|
|
425
|
+
console.log('✓ Removed legacy directory');
|
|
426
|
+
} else {
|
|
427
|
+
console.log('\nTo complete migration, remove the legacy directory:');
|
|
428
|
+
console.log(' rm -rf ~/.claude-config');
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (skipped > 0) {
|
|
433
|
+
console.log(`\n⚠️ ${skipped} item(s) skipped (already exist)`);
|
|
434
|
+
console.log('Use --force to overwrite existing files');
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return migrated > 0;
|
|
438
|
+
}
|
|
439
|
+
|
|
349
440
|
// Version
|
|
350
441
|
version() {
|
|
351
442
|
console.log(`claude-config v${VERSION}`);
|
package/lib/cli.js
CHANGED
|
@@ -283,6 +283,15 @@ function runCli(manager) {
|
|
|
283
283
|
break;
|
|
284
284
|
|
|
285
285
|
// Maintenance
|
|
286
|
+
case 'migrate':
|
|
287
|
+
const migrateOptions = {
|
|
288
|
+
force: args.includes('--force') || args.includes('-f'),
|
|
289
|
+
removeLegacy: args.includes('--remove') || args.includes('-r'),
|
|
290
|
+
removeEmpty: true
|
|
291
|
+
};
|
|
292
|
+
manager.migrate(migrateOptions);
|
|
293
|
+
break;
|
|
294
|
+
|
|
286
295
|
case 'update':
|
|
287
296
|
manager.update(args.slice(1)).catch(err => {
|
|
288
297
|
console.error('Update error:', err.message);
|
|
@@ -412,6 +421,9 @@ Registry Commands:
|
|
|
412
421
|
registry remove <name> Remove MCP from registry
|
|
413
422
|
|
|
414
423
|
Maintenance:
|
|
424
|
+
migrate Migrate from ~/.claude-config to ~/.coder-config
|
|
425
|
+
migrate --force Overwrite existing files in new location
|
|
426
|
+
migrate --remove Remove legacy directory after migration
|
|
415
427
|
update Check npm for updates and install if available
|
|
416
428
|
update --check Check for updates without installing
|
|
417
429
|
update /path/to/source Update from local development source
|
package/lib/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coder-config",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.50",
|
|
4
4
|
"description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
|
|
5
5
|
"author": "regression.io",
|
|
6
6
|
"main": "config-loader.js",
|