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

Function loadCachedFacets

src/commands/insights.ts:941–961  ·  view source on GitHub ↗
(
  sessionId: string,
)

Source from the content-addressed store, hash-verified

939}
940
941async function loadCachedFacets(
942 sessionId: string,
943): Promise<SessionFacets | null> {
944 const facetPath = join(getFacetsDir(), `${sessionId}.json`)
945 try {
946 const content = await readFile(facetPath, { encoding: 'utf-8' })
947 const parsed: unknown = jsonParse(content)
948 if (!isValidSessionFacets(parsed)) {
949 // Delete corrupted cache file so it gets re-extracted next run
950 try {
951 await unlink(facetPath)
952 } catch {
953 // Ignore deletion errors
954 }
955 return null
956 }
957 return parsed
958 } catch {
959 return null
960 }
961}
962
963async function saveFacets(facets: SessionFacets): Promise<void> {
964 try {

Callers 1

generateUsageReportFunction · 0.85

Calls 5

getFacetsDirFunction · 0.85
readFileFunction · 0.85
jsonParseFunction · 0.85
isValidSessionFacetsFunction · 0.85
unlinkFunction · 0.85

Tested by

no test coverage detected