MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / extractHeader

Function extractHeader

src/tools/semantic-navigate.ts:129–141  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

127}
128
129function extractHeader(content: string): string {
130 const lines = content.split("\n");
131 const headerLines: string[] = [];
132 for (const line of lines.slice(0, 5)) {
133 const trimmed = line.trim();
134 if (trimmed.startsWith("//") || trimmed.startsWith("#") || trimmed.startsWith("--")) {
135 headerLines.push(trimmed.replace(/^\/\/\s*|^#\s*|^--\s*/, ""));
136 } else if (trimmed.length > 0) {
137 break;
138 }
139 }
140 return headerLines.join(" ").substring(0, 200);
141}
142
143function formatLineRange(line: number, endLine: number): string {
144 return endLine > line ? `L${line}-L${endLine}` : `L${line}`;

Callers 1

semanticNavigateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected