MCPcopy
hub / github.com/claude-code-best/claude-code / resolvePluginPath

Function resolvePluginPath

src/utils/plugins/pluginLoader.ts:267–288  ·  view source on GitHub ↗
(
  pluginId: string,
  version?: string,
)

Source from the content-addressed store, hash-verified

265 * @returns Absolute path to plugin directory
266 */
267export async function resolvePluginPath(
268 pluginId: string,
269 version?: string,
270): Promise<string> {
271 // Try versioned path first
272 if (version) {
273 const versionedPath = getVersionedCachePath(pluginId, version)
274 if (await pathExists(versionedPath)) {
275 return versionedPath
276 }
277 }
278
279 // Fall back to legacy path for existing installations
280 const pluginName = parsePluginIdentifier(pluginId).name || pluginId
281 const legacyPath = getLegacyCachePath(pluginName)
282 if (await pathExists(legacyPath)) {
283 return legacyPath
284 }
285
286 // Return versioned path for new installations
287 return version ? getVersionedCachePath(pluginId, version) : legacyPath
288}
289
290/**
291 * Recursively copy a directory.

Callers

nothing calls this directly

Calls 4

getVersionedCachePathFunction · 0.85
pathExistsFunction · 0.85
parsePluginIdentifierFunction · 0.85
getLegacyCachePathFunction · 0.85

Tested by

no test coverage detected