* 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)
| 361 | * @param firstLineNumber the 1-based line number of the slice's first line |
| 362 | */ |
| 363 | function numberSourceLines(slice: string, firstLineNumber: number): string { |
| 364 | const out: string[] = []; |
| 365 | const split = slice.split('\n'); |
| 366 | for (let i = 0; i < split.length; i++) { |
| 367 | out.push(`${firstLineNumber + i}\t${split[i]}`); |
| 368 | } |
| 369 | return out.join('\n'); |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * Unique line-prefix for a per-file source section in codegraph_explore output. |
no test coverage detected