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

Function persistFileSnapshotIfRemote

src/utils/plans.ts:360–397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

358 * sessions (CCR) where local files don't persist between sessions.
359 */
360export async function persistFileSnapshotIfRemote(): Promise<void> {
361 if (getEnvironmentKind() === null) {
362 return
363 }
364 try {
365 const snapshotFiles: SystemFileSnapshotMessage['snapshotFiles'] = []
366
367 // Snapshot plan file
368 const plan = getPlan()
369 if (plan) {
370 snapshotFiles.push({
371 key: 'plan',
372 path: getPlanFilePath(),
373 content: plan,
374 })
375 }
376
377 if (snapshotFiles.length === 0) {
378 return
379 }
380
381 const message: SystemFileSnapshotMessage = {
382 type: 'system',
383 subtype: 'file_snapshot',
384 content: 'File snapshot',
385 level: 'info',
386 isMeta: true,
387 timestamp: new Date().toISOString(),
388 uuid: randomUUID(),
389 snapshotFiles,
390 }
391
392 const { recordTranscript } = await import('./sessionStorage.js')
393 await recordTranscript([message])
394 } catch (error) {
395 logError(error)
396 }
397}
398

Callers 2

callFunction · 0.85
normalizeToolInputFunction · 0.85

Calls 6

getEnvironmentKindFunction · 0.85
getPlanFunction · 0.85
getPlanFilePathFunction · 0.85
recordTranscriptFunction · 0.85
logErrorFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected