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

Function findFileSnapshotEntry

src/utils/plans.ts:336–357  ·  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

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