( memoryPath: string, memory: Memory )
| 110 | } |
| 111 | |
| 112 | export async function appendMemoryFile( |
| 113 | memoryPath: string, |
| 114 | memory: Memory |
| 115 | ): Promise<{ status: 'added' | 'duplicate'; memory: Memory }> { |
| 116 | const existing = await readMemoriesFile(memoryPath); |
| 117 | const found = existing.find((m) => m.id === memory.id); |
| 118 | if (found) return { status: 'duplicate', memory: found }; |
| 119 | existing.push(memory); |
| 120 | await writeMemoriesFile(memoryPath, existing); |
| 121 | return { status: 'added', memory }; |
| 122 | } |
| 123 | |
| 124 | export async function removeMemory( |
| 125 | memoryPath: string, |
no test coverage detected