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

Function loadCacheMetadata

src/utils/plugins/mcpbHandler.ts:443–463  ·  view source on GitHub ↗

* Load cache metadata for an MCPB source

(
  cacheDir: string,
  source: string,
)

Source from the content-addressed store, hash-verified

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