* 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[])
| 299 | * `mcp_servers: {…}` mapping (`inFlowParent`). |
| 300 | */ |
| 301 | function 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 |
no test coverage detected