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

Function getProject

source code/utils/sessionStorage.ts:445–469  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

443let cleanupRegistered = false
444
445function getProject(): Project {
446 if (!project) {
447 project = new Project()
448
449 // Register flush as a cleanup handler (only once)
450 if (!cleanupRegistered) {
451 registerCleanup(async () => {
452 // Flush queued writes first, then re-append session metadata
453 // (customTitle, tag) so they always appear in the last 64KB tail
454 // window. readLiteMetadata only reads the tail to extract these
455 // fields — if enough messages are appended after a /rename, the
456 // custom-title entry gets pushed outside the window and --resume
457 // shows the auto-generated firstPrompt instead.
458 await project?.flush()
459 try {
460 project?.reAppendSessionMetadata()
461 } catch {
462 // Best-effort — don't let metadata re-append crash the cleanup
463 }
464 })
465 cleanupRegistered = true
466 }
467 }
468 return project
469}
470
471/**
472 * Reset the Project singleton's flush state for testing.

Callers 15

setSessionFileForTestingFunction · 0.85
setInternalEventWriterFunction · 0.85
setInternalEventReaderFunction · 0.85
recordTranscriptFunction · 0.85
recordQueueOperationFunction · 0.85
removeTranscriptMessageFunction · 0.85
recordContentReplacementFunction · 0.85
resetSessionFilePointerFunction · 0.85

Calls 3

registerCleanupFunction · 0.85
flushMethod · 0.45

Tested by

no test coverage detected