MCPcopy
hub / github.com/codeaashu/claude-code / getPatchForEdit

Function getPatchForEdit

src/tools/FileEditTool/utils.ts:234–254  ·  view source on GitHub ↗
({
  filePath,
  fileContents,
  oldString,
  newString,
  replaceAll = false,
}: {
  filePath: string
  fileContents: string
  oldString: string
  newString: string
  replaceAll?: boolean
})

Source from the content-addressed store, hash-verified

232 * Does not write the file to disk.
233 */
234export function getPatchForEdit({
235 filePath,
236 fileContents,
237 oldString,
238 newString,
239 replaceAll = false,
240}: {
241 filePath: string
242 fileContents: string
243 oldString: string
244 newString: string
245 replaceAll?: boolean
246}): { patch: StructuredPatchHunk[]; updatedFile: string } {
247 return getPatchForEdits({
248 filePath,
249 fileContents,
250 edits: [
251 { old_string: oldString, new_string: newString, replace_all: replaceAll },
252 ],
253 })
254}
255
256/**
257 * Applies a list of edits to a file and returns the patch and updated file.

Callers 2

callFunction · 0.85
loadRejectionDiffFunction · 0.85

Calls 1

getPatchForEditsFunction · 0.85

Tested by

no test coverage detected