MCPcopy
hub / github.com/claude-code-best/claude-code / appendEntryToFile

Function appendEntryToFile

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

Source from the content-addressed store, hash-verified

2609 */
2610/* eslint-disable custom-rules/no-sync-fs -- sync callers (exit cleanup, materialize) */
2611function appendEntryToFile(
2612 fullPath: string,
2613 entry: Record<string, unknown>,
2614): void {
2615 const fs = getFsImplementation()
2616 const line = jsonStringify(entry) + '\n'
2617 try {
2618 fs.appendFileSync(fullPath, line, { mode: 0o600 })
2619 } catch {
2620 fs.mkdirSync(dirname(fullPath), { mode: 0o700 })
2621 fs.appendFileSync(fullPath, line, { mode: 0o600 })
2622 }
2623}
2624
2625/**
2626 * Sync tail read for reAppendSessionMetadata's external-writer check.

Callers 11

saveCustomTitleFunction · 0.85
saveAiGeneratedTitleFunction · 0.85
saveTaskSummaryFunction · 0.85
saveTagFunction · 0.85
saveGoalFunction · 0.85
clearGoalEntryFunction · 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