(args: Record<string, unknown>, context: ToolContext)
| 39 | } |
| 40 | |
| 41 | export async function fileWrite(args: Record<string, unknown>, context: ToolContext): Promise<ToolResult> { |
| 42 | const filePath = resolveWorkspacePath(context.cwd, String(args.file_path ?? "")) |
| 43 | const content = String(args.content ?? "") |
| 44 | try { |
| 45 | fs.mkdirSync(path.dirname(filePath), { recursive: true }) |
| 46 | fs.writeFileSync(filePath, content) |
| 47 | } catch (error) { |
| 48 | return { text: `Error writing file ${filePath}: ${(error as Error).message}`, isError: true } |
| 49 | } |
| 50 | return { text: `Successfully wrote ${content.split("\n").length} lines to ${filePath}.` } |
| 51 | } |
| 52 | |
| 53 | interface EditSpec { |
| 54 | file_path: string |
nothing calls this directly
no test coverage detected