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

Function getPluginByIdCacheOnly

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

Source from the content-addressed store, hash-verified

2209 * @returns The plugin entry or null if not found/cache missing
2210 */
2211export async function getPluginByIdCacheOnly(pluginId: string): Promise<{
2212 entry: PluginMarketplaceEntry
2213 marketplaceInstallLocation: string
2214} | null> {
2215 const { name: pluginName, marketplace: marketplaceName } =
2216 parsePluginIdentifier(pluginId)
2217 if (!pluginName || !marketplaceName) {
2218 return null
2219 }
2220
2221 const fs = getFsImplementation()
2222 const configFile = getKnownMarketplacesFile()
2223
2224 try {
2225 const content = await fs.readFile(configFile, { encoding: 'utf-8' })
2226 const config = jsonParse(content) as KnownMarketplacesConfig
2227 const marketplaceConfig = config[marketplaceName]
2228
2229 if (!marketplaceConfig) {
2230 return null
2231 }
2232
2233 const marketplace = await getMarketplaceCacheOnly(marketplaceName)
2234 if (!marketplace) {
2235 return null
2236 }
2237
2238 const plugin = marketplace.plugins.find(p => p.name === pluginName)
2239 if (!plugin) {
2240 return null
2241 }
2242
2243 return {
2244 entry: plugin,
2245 marketplaceInstallLocation: marketplaceConfig.installLocation,
2246 }
2247 } catch {
2248 return null
2249 }
2250}
2251
2252/**
2253 * 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