(projectRoot: string, limit = 500)
| 56 | |
| 57 | /** Read this project's episodes (most recent `limit`). */ |
| 58 | export async function readEpisodes(projectRoot: string, limit = 500): Promise<Episode[]> { |
| 59 | try { |
| 60 | const raw = await fs.readFile(episodesPath(projectRoot), 'utf-8'); |
| 61 | const lines = raw.split('\n').filter(l => l.trim()).slice(-limit); |
| 62 | return lines.map(l => { try { return JSON.parse(l) as Episode; } catch { return null; } }).filter(Boolean) as Episode[]; |
| 63 | } catch { |
| 64 | return []; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | export interface RankOptions { |
| 69 | topK?: number; |
no test coverage detected