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

Function syncMarketplacesToZipCache

src/utils/plugins/zipCacheAdapters.ts:141–164  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139 * so ephemeral containers can access marketplaces without re-cloning.
140 */
141export async function syncMarketplacesToZipCache(): Promise<void> {
142 // Read-only iteration — Safe variant so a corrupted config doesn't throw.
143 // This runs during startup paths; a throw here cascades to the same
144 // try-block that catches loadAllPlugins failures.
145 const knownMarketplaces = await loadKnownMarketplacesConfigSafe()
146
147 // Save marketplace JSONs to zip cache
148 for (const [name, entry] of Object.entries(knownMarketplaces)) {
149 if (!entry.installLocation) continue
150 try {
151 await saveMarketplaceJsonToZipCache(name, entry.installLocation)
152 } catch (error) {
153 logForDebugging(`Failed to save marketplace JSON for ${name}: ${error}`)
154 }
155 }
156
157 // Merge with previously cached data (ephemeral containers lose global config)
158 const zipCacheKnownMarketplaces = await readZipCacheKnownMarketplaces()
159 const mergedKnownMarketplaces: KnownMarketplacesFile = {
160 ...zipCacheKnownMarketplaces,
161 ...knownMarketplaces,
162 }
163 await writeZipCacheKnownMarketplaces(mergedKnownMarketplaces)
164}

Callers 1

Calls 6

entriesMethod · 0.80
logForDebuggingFunction · 0.50

Tested by

no test coverage detected