opencode
opencode copied to clipboard
feat: allow users to edit suggested changes before applying
Adds ability for users to edit suggested file changes in their editor before applying them.
When the edit tool proposes changes, users can now press e to open the suggested content in their editor, make modifications, and have those modifications applied instead of the original suggestion.
Changes
-
packages/opencode/src/permission/editor.ts- new module for computing diffs between original and user-modified content -
packages/opencode/src/util/text.ts- shared text utilities (normalizeLineEndings,getFirstDifferingLine,hasChanges) -
packages/opencode/src/cli/cmd/tui/util/editor.ts-Editor.Resulttype for better error handling -
packages/opencode/src/server/server.ts- typedmodifyDatavalidation -
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx- UI integration for edit flow
Scope
- Edit tool (single-file): supported
- Patch tool (multi-file): unchanged, to be added separately in the future if desired
This PR was created with AI assistance