Parses JSONL buffer text, skipping blank, corrupt and other-schema lines.
(text: string)
| 156 | |
| 157 | /** Parses JSONL buffer text, skipping blank, corrupt and other-schema lines. */ |
| 158 | function parseLines(text: string): BufferLine[] { |
| 159 | const lines: BufferLine[] = []; |
| 160 | for (const raw of text.split('\n')) { |
| 161 | if (!raw.trim()) continue; |
| 162 | try { |
| 163 | const parsed = JSON.parse(raw) as BufferLine; |
| 164 | if (parsed && typeof parsed === 'object' && parsed.v === SCHEMA_VERSION) lines.push(parsed); |
| 165 | } catch { |
| 166 | /* skip corrupt line */ |
| 167 | } |
| 168 | } |
| 169 | return lines; |
| 170 | } |
| 171 | |
| 172 | export interface TelemetryOptions { |
| 173 | /** Global state dir; defaults to ~/.codegraph. Tests inject a temp dir. */ |
no test coverage detected