feat(shared): implement shared data architecture (v3.1.0)

Phase 1: Multi-profile shared data via symlinks

Added:

- SharedManager class for symlink orchestration (bin/shared-manager.js)

- Auto-migration from ~/.claude/ to ~/.ccs/shared/ on first run

- Shared directories: commands/, skills/, agents/

- Windows fallback: copies dirs if symlinks fail

Fixed:

- Migration logic now detects empty directories

- Previously skipped migration when postinstall created empty dirs

- Now properly copies from ~/.claude/ when shared dirs are empty

Changed:

- Instance initialization symlinks to shared dirs instead of copying

- Postinstall creates ~/.ccs/shared/ structure automatically

- All implementations (Node.js, bash, PowerShell) updated for consistency

- Help text includes agents/ in shared data section

Technical:

- Profile-specific data remains isolated (settings, sessions, todolists, logs)

- Migration is idempotent: safe to run multiple times

- Cross-platform symlink support with graceful fallback

Closes #4
This commit is contained in:
kaitranntt committed 2025-11-10 20:45:21 -05:00
1 parent df549ddf4b
commit d925dfc169
15 files changed
+929 -708

No files matched your search

+17
View File
@@ -72,6 +72,23 @@ function createConfigFiles() {
console.log('[OK] Created directory: ~/.ccs/');
}
// Create ~/.ccs/shared/ directory structure (Phase 1)
const sharedDir = path.join(ccsDir, 'shared');
if (!fs.existsSync(sharedDir)) {
fs.mkdirSync(sharedDir, { recursive: true, mode: 0o755 });
console.log('[OK] Created directory: ~/.ccs/shared/');
}
// Create shared subdirectories
const sharedSubdirs = ['commands', 'skills', 'agents'];
for (const subdir of sharedSubdirs) {
const subdirPath = path.join(sharedDir, subdir);
if (!fs.existsSync(subdirPath)) {
fs.mkdirSync(subdirPath, { recursive: true, mode: 0o755 });
console.log(`[OK] Created directory: ~/.ccs/shared/${subdir}/`);
}
}
// Create config.json if missing
const configPath = path.join(ccsDir, 'config.json');
if (!fs.existsSync(configPath)) {