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