MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / loadCacheMetadata

Function loadCacheMetadata

source code/utils/plugins/mcpbHandler.ts:445–465  ·  view source on GitHub ↗

* Load cache metadata for an MCPB source

(
  cacheDir: string,
  source: string,
)

Source from the content-addressed store, hash-verified

443 * Load cache metadata for an MCPB source
444 */
445async function loadCacheMetadata(
446 cacheDir: string,
447 source: string,
448): Promise<McpbCacheMetadata | null> {
449 const fs = getFsImplementation()
450 const metadataPath = getMetadataPath(cacheDir, source)
451
452 try {
453 const content = await fs.readFile(metadataPath, { encoding: 'utf-8' })
454 return jsonParse(content) as McpbCacheMetadata
455 } catch (error) {
456 const code = getErrnoCode(error)
457 if (code === 'ENOENT') return null
458 const errorObj = toError(error)
459 logError(errorObj)
460 logForDebugging(`Failed to load MCPB cache metadata: ${error}`, {
461 level: 'error',
462 })
463 return null
464 }
465}
466
467/**
468 * Save cache metadata for an MCPB source

Callers 2

checkMcpbChangedFunction · 0.85
loadMcpbFileFunction · 0.85

Calls 8

getFsImplementationFunction · 0.85
getMetadataPathFunction · 0.85
jsonParseFunction · 0.85
getErrnoCodeFunction · 0.85
toErrorFunction · 0.85
logForDebuggingFunction · 0.85
readFileMethod · 0.80
logErrorFunction · 0.50

Tested by

no test coverage detected