| 482 | type PatchFile = Tool.InferMetadata<typeof ApplyPatchTool>["files"][number] |
| 483 | |
| 484 | function patchTitle(file: PatchFile): string { |
| 485 | const rel = file.relativePath |
| 486 | const from = file.filePath |
| 487 | if (file.type === "add") { |
| 488 | return `# Created ${rel || toolPath(from)}` |
| 489 | } |
| 490 | if (file.type === "delete") { |
| 491 | return `# Deleted ${rel || toolPath(from)}` |
| 492 | } |
| 493 | if (file.type === "move") { |
| 494 | return `# Moved ${toolPath(from)} -> ${rel || toolPath(file.movePath)}` |
| 495 | } |
| 496 | |
| 497 | return `# Patched ${rel || toolPath(from)}` |
| 498 | } |
| 499 | |
| 500 | function snapWrite(p: ToolProps<typeof WriteTool>): ToolSnapshot | undefined { |
| 501 | const file = p.input.filePath || "" |