MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / parseLines

Function parseLines

src/telemetry/index.ts:158–170  ·  view source on GitHub ↗

Parses JSONL buffer text, skipping blank, corrupt and other-schema lines.

(text: string)

Source from the content-addressed store, hash-verified

156
157/** Parses JSONL buffer text, skipping blank, corrupt and other-schema lines. */
158function 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
172export interface TelemetryOptions {
173 /** Global state dir; defaults to ~/.codegraph. Tests inject a temp dir. */

Callers 3

appendLinesMethod · 0.70
claimQueueMethod · 0.70
recoverStaleClaimsMethod · 0.70

Calls 2

parseMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected