(query: string, matches: ApproachMatch[])
| 116 | |
| 117 | /** Render matches into a concise, agent-readable block. PURE. Empty when none. */ |
| 118 | export function formatApproaches(query: string, matches: ApproachMatch[]): string { |
| 119 | if (matches.length === 0) return `No past work on this project resembles "${query}".`; |
| 120 | const lines = [`How you approached similar work before — "${query}":`, '']; |
| 121 | for (const m of matches) { |
| 122 | const tag = m.kind === 'episode' ? '🎯 task' : m.kind === 'fact' ? '🧠 fact' : m.kind === 'receipt' ? '🧾 receipt' : `📝 ${m.detail ?? 'worklog'}`; |
| 123 | const head = m.text.replace(/\s+/g, ' ').trim().slice(0, 140); |
| 124 | const files = m.files?.length ? ` (touched: ${m.files.slice(0, 4).join(', ')})` : ''; |
| 125 | lines.push(`- [${tag} · ${m.when}] ${head}${files}`); |
| 126 | } |
| 127 | return lines.join('\n'); |
| 128 | } |
no test coverage detected