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

Function topLevelRange

src/installer/targets/hermes.ts:150–163  ·  view source on GitHub ↗
(lines: string[], key: string)

Source from the content-addressed store, hash-verified

148}
149
150function topLevelRange(lines: string[], key: string): LineRange | null {
151 const start = lines.findIndex((line) => line.trim() === `${key}:`);
152 if (start === -1) return null;
153 let end = lines.length;
154 for (let i = start + 1; i < lines.length; i++) {
155 const line = lines[i] ?? '';
156 if (line.trim() === '') continue;
157 if (/^[A-Za-z_][A-Za-z0-9_-]*:\s*(?:#.*)?$/.test(line)) {
158 end = i;
159 break;
160 }
161 }
162 return { start, end };
163}
164
165function childRange(lines: string[], parent: LineRange, child: string): LineRange | null {
166 const startPattern = new RegExp(`^ ${escapeRegExp(child)}:\\s*(?:#.*)?$`);

Callers 5

hasCodeGraphMcpServerFunction · 0.85
upsertCodeGraphMcpServerFunction · 0.85
removeCodeGraphMcpServerFunction · 0.85
upsertCodeGraphToolsetFunction · 0.85
removeCodeGraphToolsetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected