| 23 | * Find available sessions in the debug directory |
| 24 | */ |
| 25 | export async function listSessions(projectRoot: string): Promise<string[]> { |
| 26 | const sessionsDir = path.join(projectRoot, DEFAULT_SESSION_DIR) |
| 27 | |
| 28 | try { |
| 29 | const entries = await fs.readdir(sessionsDir, { withFileTypes: true }) |
| 30 | return entries |
| 31 | .filter((entry) => entry.isDirectory()) |
| 32 | .map((entry) => entry.name) |
| 33 | .sort() |
| 34 | .reverse() // Most recent first (timestamp-based names) |
| 35 | } catch { |
| 36 | return [] |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Load session info from session-info.yaml |