opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: allow users to edit suggested changes before applying

Open dmmulroy opened this issue 2 weeks ago • 2 comments

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.Result type for better error handling
  • packages/opencode/src/server/server.ts - typed modifyData validation
  • 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

dmmulroy avatar Dec 30 '25 21:12 dmmulroy