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

Function numberSourceLines

src/mcp/tools.ts:352–359  ·  view source on GitHub ↗

* Prefix each line of a source slice with its 1-based line number, matching * the Read tool's `cat -n` convention (number + tab) so the agent treats it * the same way it treats Read output. * * @param slice contiguous source text (already extracted from the file) * @param firstLineNumber the

(slice: string, firstLineNumber: number)

Source from the content-addressed store, hash-verified

350 * @param firstLineNumber the 1-based line number of the slice's first line
351 */
352function numberSourceLines(slice: string, firstLineNumber: number): string {
353 const out: string[] = [];
354 const split = slice.split('\n');
355 for (let i = 0; i < split.length; i++) {
356 out.push(`${firstLineNumber + i}\t${split[i]}`);
357 }
358 return out.join('\n');
359}
360
361/**
362 * Unique line-prefix for a per-file source section in codegraph_explore output.

Callers 3

handleExploreMethod · 0.85
buildSectionMethod · 0.85
formatNodeDetailsMethod · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected