Format file content as right-aligned `LINE_NUMBER|LINE_CONTENT` (6-char padding).
(lines: string[], startLine: number)
| 8 | |
| 9 | /** Format file content as right-aligned `LINE_NUMBER|LINE_CONTENT` (6-char padding). */ |
| 10 | function withLineNumbers(lines: string[], startLine: number): string { |
| 11 | return lines.map((line, i) => `${String(startLine + i).padStart(6, " ")}|${line}`).join("\n") |
| 12 | } |
| 13 | |
| 14 | export async function readFile(args: Record<string, unknown>, context: ToolContext): Promise<ToolResult> { |
| 15 | const filePath = resolveWorkspacePath(context.cwd, String(args.file_path ?? "")) |