()
| 57 | } |
| 58 | |
| 59 | function readLog(): Array<Record<string, unknown>> { |
| 60 | const projectDirs = fs.existsSync(path.join(stateRoot, 'projects')) |
| 61 | ? fs.readdirSync(path.join(stateRoot, 'projects')) |
| 62 | : []; |
| 63 | const all: Array<Record<string, unknown>> = []; |
| 64 | for (const d of projectDirs) { |
| 65 | const f = path.join(stateRoot, 'projects', d, 'question-log.jsonl'); |
| 66 | if (!fs.existsSync(f)) continue; |
| 67 | const lines = fs.readFileSync(f, 'utf-8').trim().split('\n').filter(Boolean); |
| 68 | for (const l of lines) { |
| 69 | try { |
| 70 | all.push(JSON.parse(l)); |
| 71 | } catch { |
| 72 | // skip malformed |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | return all; |
| 77 | } |
| 78 | |
| 79 | // ---------------------------------------------------------------------- |
| 80 | // Native AskUserQuestion capture |
no test coverage detected