opencode-nvim-diff-review 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,7 +155,19 @@ The review operates at the **hunk level** rather than the file level. This means
|
|
|
155
155
|
- Small files with a single change are naturally one review item
|
|
156
156
|
- The agent can filter out trivial hunks (e.g., import reordering) from the review
|
|
157
157
|
|
|
158
|
-
Hunks are retrieved by running `git diff -U0` and parsing the output with diffview.nvim's built-in unified diff parser (`diffview.vcs.utils.parse_diff`). The `-U0` flag produces zero-context hunks, giving exact change boundaries.
|
|
158
|
+
Hunks are retrieved by running `git diff -U0` and parsing the output with diffview.nvim's built-in unified diff parser (`diffview.vcs.utils.parse_diff`). The `-U0` flag produces zero-context hunks, giving exact change boundaries. (Note: `-U0` omits the count in hunk headers when it's 1, e.g., `@@ -134 +134,4 @@`. The plugin normalizes these to the `N,M` form before parsing.)
|
|
159
|
+
|
|
160
|
+
### Hunk-focus folding
|
|
161
|
+
|
|
162
|
+
When navigating to a hunk, the plugin folds all other regions of the file so only the target hunk is visible — similar to `git add -p`. This is achieved by:
|
|
163
|
+
|
|
164
|
+
1. Switching both diff windows from `foldmethod=diff` to `foldmethod=manual`
|
|
165
|
+
2. Creating two manual folds: one above the hunk and one below
|
|
166
|
+
3. Showing 5 lines of context above and below the hunk
|
|
167
|
+
|
|
168
|
+
The fold highlight is overridden with a custom `DiffviewDiffFoldedReview` highlight group (linked to `Comment` by default) so fold lines look like muted separators rather than diff modifications. Users can override this highlight group in their colorscheme.
|
|
169
|
+
|
|
170
|
+
Line numbers are switched to absolute (`number`, no `relativenumber`) during hunk focus so they match the line ranges shown in the hunk headers.
|
|
159
171
|
|
|
160
172
|
### Review queue
|
|
161
173
|
|
|
@@ -172,7 +184,7 @@ The Lua (Neovim) side is stateless — it provides functions to query hunks and
|
|
|
172
184
|
- **State queries via global Lua functions**: `DiffviewState()`, `DiffviewHunks()`, and `DiffviewGoTo()` are registered as globals so they can be called via `luaeval()` from Neovim's `--remote-expr` without needing the module require path.
|
|
173
185
|
- **Wrap-around prevention**: The tool checks queue bounds before navigating and refuses to advance past the first/last item.
|
|
174
186
|
- **Buffer cleanup on close**: diffview.nvim intentionally keeps local file buffers open after closing (so you can continue editing). The plugin tracks which buffers existed before the review and removes any new ones on close — unless they have unsaved edits.
|
|
175
|
-
- **
|
|
187
|
+
- **Async cursor positioning**: `DiffviewGoTo` stores a pending target and applies it via a `DiffviewDiffBufWinEnter` autocmd + `vim.defer_fn`. This ensures the cursor is positioned after diffview's async `set_file` completes (which resets cursor to line 1 on `file_open_new`).
|
|
176
188
|
- **Socket auto-discovery**: When `NVIM_SOCKET` is not set, the tool scans `$TMPDIR/nvim.$USER/` and `/tmp` for Neovim socket files, verifies each is live, and uses `lsof` to match the Neovim process's working directory against the current project. This allows zero-configuration usage in ad-hoc terminals — just run `nvim` and OpenCode will find it.
|
|
177
189
|
|
|
178
190
|
### Review workflow instructions
|
|
@@ -197,10 +209,6 @@ Show surrounding code context around the current hunk. Useful when the agent or
|
|
|
197
209
|
|
|
198
210
|
Allow the user to accept or reject individual hunks from the diff view, similar to `git add -p`. This would integrate with diffview.nvim's staging capabilities.
|
|
199
211
|
|
|
200
|
-
### Logical ordering
|
|
201
|
-
|
|
202
|
-
Instead of the agent deciding order ad-hoc, build smarter ordering heuristics — e.g., analyzing import graphs to automatically determine dependency order between changed files.
|
|
203
|
-
|
|
204
212
|
### OpenCode session diff integration
|
|
205
213
|
|
|
206
214
|
Instead of using `git diff` to determine changed files, use OpenCode's `/session/:id/diff` API endpoint to get exactly which files the agent modified in the current session. This would avoid showing unrelated uncommitted changes.
|