* Read marketplace.json content from a cloned marketplace directory or file. * For directory sources: checks .claude-plugin/marketplace.json, marketplace.json * For URL sources: the installLocation IS the marketplace JSON file itself.
(dir: string)
| 118 | * For URL sources: the installLocation IS the marketplace JSON file itself. |
| 119 | */ |
| 120 | async function readMarketplaceJsonContent(dir: string): Promise<string | null> { |
| 121 | const candidates = [ |
| 122 | join(dir, '.claude-plugin', 'marketplace.json'), |
| 123 | join(dir, 'marketplace.json'), |
| 124 | dir, // For URL sources, installLocation IS the marketplace JSON file |
| 125 | ] |
| 126 | for (const candidate of candidates) { |
| 127 | try { |
| 128 | return await readFile(candidate, 'utf-8') |
| 129 | } catch { |
| 130 | // ENOENT (doesn't exist) or EISDIR (directory) — try next |
| 131 | } |
| 132 | } |
| 133 | return null |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Sync marketplace data to zip cache for offline access. |
no test coverage detected