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

Function findCodeGraphServer

src/installer/targets/hermes.ts:301–311  ·  view source on GitHub ↗

* Where `mcp_servers.codegraph` is written, in any form: a block or a * one-line value under a block `mcp_servers`, at whatever indent its * siblings use and with its key quoted or not; or inside a one-line * `mcp_servers: {…}` mapping (`inFlowParent`).

(lines: string[])

Source from the content-addressed store, hash-verified

299 * `mcp_servers: {…}` mapping (`inFlowParent`).
300 */
301function findCodeGraphServer(lines: string[]): (Child & { inFlowParent: boolean }) | null {
302 const top = findTop(lines, 'mcp_servers');
303 if (!top) return null;
304 if (top.value !== '') {
305 const mentions = /(^|[{,\s])["']?codegraph["']?\s*:/.test(top.value.replace(/^\{/, ' '));
306 return mentions ? { key: 'codegraph', line: top.line, value: top.value, end: top.line + 1, inFlowParent: true } : null;
307 }
308 const { children } = childrenOf(lines, top.line, top.end);
309 const child = children.find((c) => c.key === 'codegraph');
310 return child ? { ...child, inFlowParent: false } : null;
311}
312
313/**
314 * Add the codegraph server when the file has none. An existing entry is

Callers 4

detectMethod · 0.85
uninstallMethod · 0.85
writeHermesConfigFunction · 0.85
upsertCodeGraphServerFunction · 0.85

Calls 2

findTopFunction · 0.85
childrenOfFunction · 0.85

Tested by

no test coverage detected