(filepath: string, diff: string, displayPath = filepath)
| 205 | } |
| 206 | |
| 207 | async function diffContentForPatch(filepath: string, diff: string, displayPath = filepath) { |
| 208 | const content = (await exists(filepath)) ? await readText(filepath) : "" |
| 209 | const next = applyPatch(content, diff) |
| 210 | if (next === false) return undefined |
| 211 | return { |
| 212 | type: "diff" as const, |
| 213 | path: displayPath, |
| 214 | oldText: content, |
| 215 | newText: next, |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | function selectedReply(result: RequestPermissionResponse): Reply { |
| 220 | if (result.outcome.outcome !== "selected") return "reject" |
no test coverage detected