MCPcopy Create free account
hub / github.com/Noumena-Network/code / buildEntriesFromLocalFiles

Function buildEntriesFromLocalFiles

src/services/settingsSync/index.ts:415–456  ·  view source on GitHub ↗
(
  projectId: string | null,
)

Source from the content-addressed store, hash-verified

413}
414
415async function buildEntriesFromLocalFiles(
416 projectId: string | null,
417): Promise<Record<string, string>> {
418 const entries: Record<string, string> = {}
419
420 // Global user settings
421 const userSettingsPath = getSettingsFilePathForSource('userSettings')
422 if (userSettingsPath) {
423 const content = await tryReadFileForSync(userSettingsPath)
424 if (content) {
425 entries[SYNC_KEYS.USER_SETTINGS] = content
426 }
427 }
428
429 // Global user memory
430 const userMemoryPath = getMemoryPath('User')
431 const userMemoryContent = await tryReadFileForSync(userMemoryPath)
432 if (userMemoryContent) {
433 entries[SYNC_KEYS.USER_MEMORY] = userMemoryContent
434 }
435
436 // Project-specific files (only if we have a project ID from git remote)
437 if (projectId) {
438 // Project local settings
439 const localSettingsPath = getSettingsFilePathForSource('localSettings')
440 if (localSettingsPath) {
441 const content = await tryReadFileForSync(localSettingsPath)
442 if (content) {
443 entries[SYNC_KEYS.projectSettings(projectId)] = content
444 }
445 }
446
447 // Project local memory
448 const localMemoryPath = getMemoryPath('Local')
449 const localMemoryContent = await tryReadFileForSync(localMemoryPath)
450 if (localMemoryContent) {
451 entries[SYNC_KEYS.projectMemory(projectId)] = localMemoryContent
452 }
453 }
454
455 return entries
456}
457
458async function writeFileForSync(
459 filePath: string,

Callers 1

Calls 3

tryReadFileForSyncFunction · 0.85
getMemoryPathFunction · 0.85

Tested by

no test coverage detected