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

Function loadCacheMetadata

src/utils/plugins/mcpbHandler.ts:453–473  ·  view source on GitHub ↗

* Load cache metadata for an MCPB source

(
  cacheDir: string,
  source: string,
)

Source from the content-addressed store, hash-verified

451 * Load cache metadata for an MCPB source
452 */
453async function loadCacheMetadata(
454 cacheDir: string,
455 source: string,
456): Promise<McpbCacheMetadata | null> {
457 const fs = getFsImplementation()
458 const metadataPath = getMetadataPath(cacheDir, source)
459
460 try {
461 const content = await fs.readFile(metadataPath, { encoding: 'utf-8' })
462 return jsonParse(content) as McpbCacheMetadata
463 } catch (error) {
464 const code = getErrnoCode(error)
465 if (code === 'ENOENT') return null
466 const errorObj = toError(error)
467 logError(errorObj)
468 logForDebugging(`Failed to load MCPB cache metadata: ${error}`, {
469 level: 'error',
470 })
471 return null
472 }
473}
474
475/**
476 * 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
readFileMethod · 0.80
logErrorFunction · 0.50
logForDebuggingFunction · 0.50

Tested by

no test coverage detected