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

Function readMarketplaceJson

src/utils/plugins/zipCacheAdapters.ts:72–95  ·  view source on GitHub ↗
(
  marketplaceName: string,
)

Source from the content-addressed store, hash-verified

70 * Read a marketplace JSON file from the zip cache.
71 */
72export async function readMarketplaceJson(
73 marketplaceName: string,
74): Promise<PluginMarketplace | null> {
75 const zipCachePath = getPluginZipCachePath()
76 if (!zipCachePath) {
77 return null
78 }
79 const relPath = getMarketplaceJsonRelativePath(marketplaceName)
80 const fullPath = join(zipCachePath, relPath)
81 try {
82 const content = await readFile(fullPath, 'utf-8')
83 const parsed = jsonParse(content)
84 const result = PluginMarketplaceSchema().safeParse(parsed)
85 if (result.success) {
86 return result.data
87 }
88 logForDebugging(
89 `Invalid marketplace JSON for ${marketplaceName}: ${result.error}`,
90 )
91 return null
92 } catch {
93 return null
94 }
95}
96
97/**
98 * Save a marketplace JSON to the zip cache from its install location.

Callers

nothing calls this directly

Calls 5

getPluginZipCachePathFunction · 0.85
readFileFunction · 0.85
jsonParseFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected