MCPcopy Index your code
hub / github.com/anomalyco/opencode / patchTitle

Function patchTitle

packages/opencode/src/cli/cmd/run/tool.ts:484–498  ·  view source on GitHub ↗
(file: PatchFile)

Source from the content-addressed store, hash-verified

482type PatchFile = Tool.InferMetadata<typeof ApplyPatchTool>["files"][number]
483
484function 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
500function snapWrite(p: ToolProps<typeof WriteTool>): ToolSnapshot | undefined {
501 const file = p.input.filePath || ""

Callers 1

snapPatchFunction · 0.85

Calls 1

toolPathFunction · 0.85

Tested by

no test coverage detected