diff options
| author | opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> | 2026-04-10 23:43:20 +0000 |
|---|---|---|
| committer | opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> | 2026-04-10 23:43:20 +0000 |
| commit | f2c492a8e6efd3fb20d8d494345cd41d72aa4351 (patch) | |
| tree | 163424f38af8ad45ce49cef2fcd48fa10d3dee00 | |
| parent | 0556774097b0223b1e547260d2b7f46640c6e884 (diff) | |
| download | opencode-f2c492a8e6efd3fb20d8d494345cd41d72aa4351.tar.gz opencode-f2c492a8e6efd3fb20d8d494345cd41d72aa4351.zip | |
chore: generate
| -rw-r--r-- | packages/opencode/src/tool/apply_patch.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/opencode/src/tool/apply_patch.ts b/packages/opencode/src/tool/apply_patch.ts index 9645fc1ed..4b523aeaf 100644 --- a/packages/opencode/src/tool/apply_patch.ts +++ b/packages/opencode/src/tool/apply_patch.ts @@ -142,9 +142,9 @@ export const ApplyPatchTool = Tool.defineEffect( } case "delete": { - const contentToDelete = yield* afs.readFileString(filePath).pipe( - Effect.catch((error) => Effect.fail(new Error(`apply_patch verification failed: ${error}`))), - ) + const contentToDelete = yield* afs + .readFileString(filePath) + .pipe(Effect.catch((error) => Effect.fail(new Error(`apply_patch verification failed: ${error}`)))) const deleteDiff = trimDiff(createTwoFilesPatch(filePath, filePath, contentToDelete, "")) const deletions = contentToDelete.split("\n").length @@ -199,7 +199,7 @@ export const ApplyPatchTool = Tool.defineEffect( switch (change.type) { case "add": // Create parent directories (recursive: true is safe on existing/root dirs) - + yield* afs.writeWithDirs(change.filePath, change.newContent) updates.push({ file: change.filePath, event: "add" }) break @@ -212,7 +212,7 @@ export const ApplyPatchTool = Tool.defineEffect( case "move": if (change.movePath) { // Create parent directories (recursive: true is safe on existing/root dirs) - + yield* afs.writeWithDirs(change.movePath!, change.newContent) yield* afs.remove(change.filePath) updates.push({ file: change.filePath, event: "unlink" }) @@ -269,9 +269,7 @@ export const ApplyPatchTool = Tool.defineEffect( if (errors.length > 0) { const limited = errors.slice(0, MAX_DIAGNOSTICS_PER_FILE) const suffix = - errors.length > MAX_DIAGNOSTICS_PER_FILE - ? `\n... and ${errors.length - MAX_DIAGNOSTICS_PER_FILE} more` - : "" + errors.length > MAX_DIAGNOSTICS_PER_FILE ? `\n... and ${errors.length - MAX_DIAGNOSTICS_PER_FILE} more` : "" output += `\n\nLSP errors detected in ${path.relative(Instance.worktree, target).replaceAll("\\", "/")}, please fix:\n<diagnostics file="${target}">\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</diagnostics>` } } |
