import { input, select } from '@inquirer/prompts'; import { addMemory, searchMemory, listMemory } from '../../core/services/memoryService.js'; import type { Memory } from '../../core/schema.js'; export async function memoryAdd(cwd: string, options: Partial = {}): Promise { const title = options.title ?? await input({ message: 'Memory title:' }); const category = options.category ?? await select({ message: 'Category:', choices: [ { name: 'architecture', value: 'architecture' }, { name: 'product', value: 'product' }, { name: 'technical', value: 'technical' }, { name: 'implementation', value: 'implementation' }, { name: 'lesson', value: 'lesson' }, ], }); const content = options.content ?? await input({ message: 'Content:' }); const memory = addMemory(cwd, { title, category, content }); console.log(`Memory saved as ${memory.id}.`); } export function memorySearch(cwd: string, query: string): void { const results = searchMemory(cwd, query); if (results.length === 0) { console.log('No results found.'); return; } for (const r of results) { console.log(`[${r.type}] ${r.id}: ${r.title}`); } } export function memoryList(cwd: string): void { const memories = listMemory(cwd); if (memories.length === 0) { console.log('No memory entries found.'); return; } for (const m of memories) { console.log(`${m.id}: ${m.title}`); } }