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

Function findFileSnapshotEntry

source code/utils/plans.ts:334–355  ·  view source on GitHub ↗

* Find a file entry in the most recent file-snapshot system message in the transcript. * Scans backwards to find the latest snapshot.

(
  messages: LogOption['messages'],
  key: string,
)

Source from the content-addressed store, hash-verified

332 * Scans backwards to find the latest snapshot.
333 */
334function findFileSnapshotEntry(
335 messages: LogOption['messages'],
336 key: string,
337): { key: string; path: string; content: string } | undefined {
338 for (let i = messages.length - 1; i >= 0; i--) {
339 const msg = messages[i]
340 if (
341 msg?.type === 'system' &&
342 'subtype' in msg &&
343 msg.subtype === 'file_snapshot' &&
344 'snapshotFiles' in msg
345 ) {
346 const files = msg.snapshotFiles as Array<{
347 key: string
348 path: string
349 content: string
350 }>
351 return files.find(f => f.key === key)
352 }
353 }
354 return undefined
355}
356
357/**
358 * Persist a snapshot of session files (plan, todos) to the transcript.

Callers 1

copyPlanForResumeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected