MCPcopy Create free account
hub / github.com/Noumena-Network/code / migrateV1ToV2

Function migrateV1ToV2

src/utils/plugins/installedPluginsManager.ts:286–307  ·  view source on GitHub ↗

* Migrate V1 data to V2 format. * All V1 plugins are migrated to 'user' scope since V1 had no scope concept.

(v1Data: InstalledPluginsFileV1)

Source from the content-addressed store, hash-verified

284 * All V1 plugins are migrated to 'user' scope since V1 had no scope concept.
285 */
286function migrateV1ToV2(v1Data: InstalledPluginsFileV1): InstalledPluginsFileV2 {
287 const v2Plugins: InstalledPluginsMapV2 = {}
288
289 for (const [pluginId, plugin] of Object.entries(v1Data.plugins)) {
290 // V2 format uses versioned cache path: ~/.claude/plugins/cache/{marketplace}/{plugin}/{version}
291 // Compute it from pluginId and version instead of using the V1 installPath
292 const versionedCachePath = getVersionedCachePath(pluginId, plugin.version)
293
294 v2Plugins[pluginId] = [
295 {
296 scope: 'user', // Default all existing installs to user scope
297 installPath: versionedCachePath,
298 version: plugin.version,
299 installedAt: plugin.installedAt,
300 lastUpdated: plugin.lastUpdated,
301 gitCommitSha: plugin.gitCommitSha,
302 },
303 ]
304 }
305
306 return { version: 2, plugins: v2Plugins }
307}
308
309/**
310 * Load installed plugins in V2 format.

Callers 3

loadInstalledPluginsV2Function · 0.85

Calls 2

getVersionedCachePathFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected