MCPcopy Create free account
hub / github.com/WJX20/claude-code / appendEntryToFile

Function appendEntryToFile

src/utils/sessionStorage.ts:2573–2585  ·  view source on GitHub ↗
(
  fullPath: string,
  entry: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

2571 */
2572/* eslint-disable custom-rules/no-sync-fs -- sync callers (exit cleanup, materialize) */
2573function appendEntryToFile(
2574 fullPath: string,
2575 entry: Record<string, unknown>,
2576): void {
2577 const fs = getFsImplementation()
2578 const line = jsonStringify(entry) + '\n'
2579 try {
2580 fs.appendFileSync(fullPath, line, { mode: 0o600 })
2581 } catch {
2582 fs.mkdirSync(dirname(fullPath), { mode: 0o700 })
2583 fs.appendFileSync(fullPath, line, { mode: 0o600 })
2584 }
2585}
2586
2587/**
2588 * Sync tail read for reAppendSessionMetadata's external-writer check.

Callers 9

saveCustomTitleFunction · 0.85
saveAiGeneratedTitleFunction · 0.85
saveTaskSummaryFunction · 0.85
saveTagFunction · 0.85
linkSessionToPRFunction · 0.85
saveAgentNameFunction · 0.85
saveAgentColorFunction · 0.85
saveWorktreeStateFunction · 0.85

Calls 2

getFsImplementationFunction · 0.85
jsonStringifyFunction · 0.85

Tested by

no test coverage detected