mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 20:31:37 -05:00
Refactor util functions out of claude dev
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Anthropic } from "@anthropic-ai/sdk"
|
||||
import * as path from "path"
|
||||
import * as diff from "diff"
|
||||
|
||||
export const formatResponse = {
|
||||
toolDenied: () => `The user denied this operation.`,
|
||||
@@ -74,6 +75,14 @@ export const formatResponse = {
|
||||
return sorted.join("\n")
|
||||
}
|
||||
},
|
||||
|
||||
createPrettyPatch: (filename = "file", oldStr: string, newStr: string) => {
|
||||
// strings cannot be undefined or diff throws exception
|
||||
const patch = diff.createPatch(filename.toPosix(), oldStr || "", newStr || "")
|
||||
const lines = patch.split("\n")
|
||||
const prettyPatchLines = lines.slice(4)
|
||||
return prettyPatchLines.join("\n")
|
||||
},
|
||||
}
|
||||
|
||||
// to avoid circular dependency
|
||||
|
||||
Reference in New Issue
Block a user