* 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, )
| 2056 | * @throws If marketplace file not found or invalid |
| 2057 | */ |
| 2058 | async 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). |
no test coverage detected