({
filePath,
fileContents,
oldString,
newString,
replaceAll = false,
}: {
filePath: string
fileContents: string
oldString: string
newString: string
replaceAll?: boolean
})
| 232 | * Does not write the file to disk. |
| 233 | */ |
| 234 | export 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. |
no test coverage detected