* 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)
| 350 | * @param firstLineNumber the 1-based line number of the slice's first line |
| 351 | */ |
| 352 | function 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. |
no test coverage detected