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

Function readCachedMarketplace

src/utils/plugins/marketplaceManager.ts:2058–2074  ·  view source on GitHub ↗

* Read a cached marketplace from disk without updating it * * @param installLocation - Path to the cached marketplace * @returns The marketplace object * @throws If marketplace file not found or invalid

(
  installLocation: string,
)

Source from the content-addressed store, hash-verified

2056 * @throws If marketplace file not found or invalid
2057 */
2058async function readCachedMarketplace(
2059 installLocation: string,
2060): Promise<PluginMarketplace> {
2061 // For git-sourced directories, the manifest lives at .claude-plugin/marketplace.json.
2062 // For url/file/directory sources it is the installLocation itself.
2063 // Try the nested path first; fall back to installLocation when it is a plain file
2064 // (ENOTDIR) or the nested file is simply missing (ENOENT).
2065 const nestedPath = join(installLocation, '.claude-plugin', 'marketplace.json')
2066 try {
2067 return await parseFileWithSchema(nestedPath, PluginMarketplaceSchema())
2068 } catch (e) {
2069 if (e instanceof ConfigParseError) throw e
2070 const code = getErrnoCode(e)
2071 if (code !== 'ENOENT' && code !== 'ENOTDIR') throw e
2072 }
2073 return await parseFileWithSchema(installLocation, PluginMarketplaceSchema())
2074}
2075
2076/**
2077 * Get a specific marketplace by name from cache only (no network).

Callers 4

getMarketplaceCacheOnlyFunction · 0.85
refreshMarketplaceFunction · 0.85

Calls 2

parseFileWithSchemaFunction · 0.85
getErrnoCodeFunction · 0.85

Tested by

no test coverage detected