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

Method parse

__tests__/ui-events-api.test.ts:129–146  ·  view source on GitHub ↗
(frame: string)

Source from the content-addressed store, hash-verified

127 }
128
129 private parse(frame: string): void {
130 let name = 'message';
131 let data = '';
132 for (const line of frame.split('\n')) {
133 if (line.startsWith(':')) {
134 this.comments += 1;
135 continue;
136 }
137 if (line.startsWith('event: ')) name = line.slice(7);
138 else if (line.startsWith('data: ')) data += line.slice(6);
139 }
140 if (data === '') return;
141 try {
142 this.events.push({ event: name, data: JSON.parse(data) });
143 } catch {
144 this.events.push({ event: name, data });
145 }
146 }
147
148 /** Wait for an event of `type`, or give up. Never polls the server. */
149 async waitFor(type: string, timeoutMs = 12_000): Promise<SseEvent> {

Callers 15

ingestMethod · 0.95
unsafeIndexRootReasonFunction · 0.80
findNearestCodeGraphRootFunction · 0.80
safeJsonParseFunction · 0.80
parseConfigFunction · 0.80
extractTagBasedMethod · 0.80
indexedDirtyPathsMethod · 0.80
parseWithinBudgetFunction · 0.80
extractMethod · 0.80

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected