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

Function persistFileSnapshotIfRemote

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

Source from the content-addressed store, hash-verified

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

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