mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-19 18:15:19 +00:00
fix(management): localize marketplace registry per instance
This commit is contained in:
1 parent
88f9532eb1
commit
54ea36fd18
5 files changed
+552
-265
No files matched your search
@@ -26,11 +26,13 @@ class InstanceManager {
|
||||
private readonly instancesDir: string;
|
||||
private readonly sharedManager: SharedManager;
|
||||
private readonly contextSyncLock: ProfileContextSyncLock;
|
||||
private readonly pluginLayoutLock: ProfileContextSyncLock;
|
||||
|
||||
constructor() {
|
||||
this.instancesDir = path.join(getCcsDir(), 'instances');
|
||||
this.sharedManager = new SharedManager();
|
||||
this.contextSyncLock = new ProfileContextSyncLock(this.instancesDir);
|
||||
this.pluginLayoutLock = new ProfileContextSyncLock(this.instancesDir);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,9 +58,15 @@ class InstanceManager {
|
||||
// Apply context policy (isolated by default, optional shared group).
|
||||
await this.sharedManager.syncProjectContext(instancePath, contextPolicy);
|
||||
await this.sharedManager.syncAdvancedContinuityArtifacts(instancePath, contextPolicy);
|
||||
|
||||
if (!options.bare) {
|
||||
await this.pluginLayoutLock.withNamedLock('__plugin-layout__', async () => {
|
||||
this.sharedManager.linkSharedDirectories(instancePath);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.sharedManager.normalizeSharedPluginMetadataPaths(instancePath);
|
||||
this.sharedManager.normalizeSharedPluginMetadataPaths(options.bare ? undefined : instancePath);
|
||||
|
||||
// Sync MCP servers from global ~/.claude.json (unless bare)
|
||||
if (!options.bare) {
|
||||
@@ -82,7 +90,7 @@ class InstanceManager {
|
||||
private initializeInstance(
|
||||
profileName: string,
|
||||
instancePath: string,
|
||||
options: InstanceOptions = {}
|
||||
_options: InstanceOptions = {}
|
||||
): void {
|
||||
try {
|
||||
// Create base directory
|
||||
@@ -106,10 +114,7 @@ class InstanceManager {
|
||||
}
|
||||
});
|
||||
|
||||
// Bare profiles skip shared symlinks (commands, skills, agents, settings.json)
|
||||
if (!options.bare) {
|
||||
this.sharedManager.linkSharedDirectories(instancePath);
|
||||
}
|
||||
// Shared links are created during ensureInstance() under the plugin layout lock.
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Failed to initialize instance for ${profileName}: ${(error as Error).message}`
|
||||
|
||||
Reference in new issue
Block a user