mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-17 16:16:37 +00:00
fix(migration): run migration during install, not on first execution (v3.1.1)
Fixed:
- Migration now runs during installation across all methods (npm, bash, PowerShell)
- Guarantees ~/.ccs/shared/ populated immediately with ~/.claude/ content
- Users no longer need to run ccs command to trigger migration
Changed:
- Refactored SharedManager with _needsMigration() and _performMigration() methods
- _copyDirectory() returns {copied, skipped} stats and preserves existing files
- Shows detailed migration output: '[OK] Migrated 5 commands, 19 skills'
- Removed lazy migration from bin/ccs.js, lib/ccs, lib/ccs.ps1
Implementation:
- npm: Migration in scripts/postinstall.js
- bash: Migration in installers/install.sh (migrate_shared_data function)
- PowerShell: Migration in installers/install.ps1 (Invoke-SharedDataMigration)
- Fixed arithmetic expansion with set -e (changed ((var++)) to var=$((var + 1)))
Cross-platform parity maintained across all installation methods.
This commit is contained in:
@@ -89,6 +89,18 @@ function createConfigFiles() {
|
||||
}
|
||||
}
|
||||
|
||||
// Migrate from ~/.claude/ to ~/.ccs/shared/ (v3.1.1)
|
||||
console.log('');
|
||||
try {
|
||||
const SharedManager = require('../bin/shared-manager');
|
||||
const sharedManager = new SharedManager();
|
||||
sharedManager.migrateToSharedStructure();
|
||||
} catch (err) {
|
||||
console.warn('[!] Migration warning:', err.message);
|
||||
console.warn(' You can manually copy files from ~/.claude/ to ~/.ccs/shared/');
|
||||
}
|
||||
console.log('');
|
||||
|
||||
// Create config.json if missing
|
||||
const configPath = path.join(ccsDir, 'config.json');
|
||||
if (!fs.existsSync(configPath)) {
|
||||
|
||||
Reference in New Issue
Block a user