MCPcopy Index your code
hub / github.com/Noumena-Network/code / appendEntryToFile

Function appendEntryToFile

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

Source from the content-addressed store, hash-verified

2732 */
2733/* eslint-disable custom-rules/no-sync-fs -- sync callers (exit cleanup, materialize) */
2734function appendEntryToFile(
2735 fullPath: string,
2736 entry: Record<string, unknown>,
2737): void {
2738 const fs = getFsImplementation()
2739 const line = jsonStringify(entry) + '\n'
2740 try {
2741 fs.appendFileSync(fullPath, line, { mode: 0o600 })
2742 } catch (error) {
2743 if (isFsInaccessible(error)) {
2744 logForDebugging(
2745 `Skipping sync transcript metadata write for ${fullPath}: ${errorMessage(error)}`,
2746 { level: 'warn' },
2747 )
2748 return
2749 }
2750 try {
2751 fs.mkdirSync(dirname(fullPath), { mode: 0o700 })
2752 fs.appendFileSync(fullPath, line, { mode: 0o600 })
2753 } catch (retryError) {
2754 if (isFsInaccessible(retryError)) {
2755 logForDebugging(
2756 `Skipping sync transcript metadata write for ${fullPath}: ${errorMessage(retryError)}`,
2757 { level: 'warn' },
2758 )
2759 return
2760 }
2761 throw retryError
2762 }
2763 }
2764}
2765
2766/**
2767 * 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 5

getFsImplementationFunction · 0.85
jsonStringifyFunction · 0.85
isFsInaccessibleFunction · 0.85
logForDebuggingFunction · 0.70
errorMessageFunction · 0.70

Tested by

no test coverage detected