MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getPluginById

Function getPluginById

src/utils/plugins/marketplaceManager.ts:2238–2280  ·  view source on GitHub ↗
(pluginId: string)

Source from the content-addressed store, hash-verified

2236 * @returns The plugin entry or null if not found
2237 */
2238export async function getPluginById(pluginId: string): Promise<{
2239 entry: PluginMarketplaceEntry
2240 marketplaceInstallLocation: string
2241} | null> {
2242 // Try cache-only first (fast path)
2243 const cached = await getPluginByIdCacheOnly(pluginId)
2244 if (cached) {
2245 return cached
2246 }
2247
2248 // Cache miss - try fetching from source
2249 const { name: pluginName, marketplace: marketplaceName } =
2250 parsePluginIdentifier(pluginId)
2251 if (!pluginName || !marketplaceName) {
2252 return null
2253 }
2254
2255 try {
2256 const config = await loadKnownMarketplacesConfig()
2257 const marketplaceConfig = config[marketplaceName]
2258 if (!marketplaceConfig) {
2259 return null
2260 }
2261
2262 const marketplace = await getMarketplace(marketplaceName)
2263 const plugin = marketplace.plugins.find(p => p.name === pluginName)
2264
2265 if (!plugin) {
2266 return null
2267 }
2268
2269 return {
2270 entry: plugin,
2271 marketplaceInstallLocation: marketplaceConfig.installLocation,
2272 }
2273 } catch (error) {
2274 logForDebugging(
2275 `Could not find plugin ${pluginId}: ${errorMessage(error)}`,
2276 { level: 'debug' },
2277 )
2278 return null
2279 }
2280}
2281
2282/**
2283 * Refresh all marketplace caches

Callers 9

findMissingPluginsFunction · 0.85
installSelectedPluginsFunction · 0.85
resolvePluginHintFunction · 0.85
installResolvedPluginFunction · 0.85
installPluginOpFunction · 0.85
updatePluginOpFunction · 0.85
installPluginAndNotifyFunction · 0.85

Calls 5

getPluginByIdCacheOnlyFunction · 0.85
parsePluginIdentifierFunction · 0.85
logForDebuggingFunction · 0.85
errorMessageFunction · 0.50

Tested by

no test coverage detected