()
| 61 | } |
| 62 | |
| 63 | function listSessionSummaries(): ReturnType<typeof summarizeSession>[] { |
| 64 | ensureSessionDir(); |
| 65 | const summaries: NonNullable<ReturnType<typeof summarizeSession>>[] = []; |
| 66 | |
| 67 | for (const name of fs.readdirSync(SESSION_DIR)) { |
| 68 | if (!name.endsWith(".json") || name === "current.json") { |
| 69 | continue; |
| 70 | } |
| 71 | const session = readSessionFile(path.join(SESSION_DIR, name)); |
| 72 | const summary = session ? summarizeSession(session) : null; |
| 73 | if (summary) { |
| 74 | summaries.push(summary); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | return summaries.sort( |
| 79 | (a, b) => |
| 80 | new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(), |
| 81 | ); |
| 82 | } |
| 83 | |
| 84 | export function sessionLogPlugin(): Plugin { |
| 85 | return { |
no test coverage detected