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

Function getPluginByIdCacheOnly

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

Source from the content-addressed store, hash-verified

2186 * @returns The plugin entry or null if not found/cache missing
2187 */
2188export async function getPluginByIdCacheOnly(pluginId: string): Promise<{
2189 entry: PluginMarketplaceEntry
2190 marketplaceInstallLocation: string
2191} | null> {
2192 const { name: pluginName, marketplace: marketplaceName } =
2193 parsePluginIdentifier(pluginId)
2194 if (!pluginName || !marketplaceName) {
2195 return null
2196 }
2197
2198 const fs = getFsImplementation()
2199 const configFile = getKnownMarketplacesFile()
2200
2201 try {
2202 const content = await fs.readFile(configFile, { encoding: 'utf-8' })
2203 const config = jsonParse(content) as KnownMarketplacesConfig
2204 const marketplaceConfig = config[marketplaceName]
2205
2206 if (!marketplaceConfig) {
2207 return null
2208 }
2209
2210 const marketplace = await getMarketplaceCacheOnly(marketplaceName)
2211 if (!marketplace) {
2212 return null
2213 }
2214
2215 const plugin = marketplace.plugins.find(p => p.name === pluginName)
2216 if (!plugin) {
2217 return null
2218 }
2219
2220 return {
2221 entry: plugin,
2222 marketplaceInstallLocation: marketplaceConfig.installLocation,
2223 }
2224 } catch {
2225 return null
2226 }
2227}
2228
2229/**
2230 * Get plugin by ID from a specific marketplace

Callers 2

getPluginByIdFunction · 0.85

Calls 6

parsePluginIdentifierFunction · 0.85
getFsImplementationFunction · 0.85
getKnownMarketplacesFileFunction · 0.85
jsonParseFunction · 0.85
getMarketplaceCacheOnlyFunction · 0.85
readFileMethod · 0.80

Tested by

no test coverage detected