{"id":50802474,"url":"https://github.com/shaunchander/hunk-review.nvim","last_synced_at":"2026-06-12T21:33:18.518Z","repository":{"id":357691235,"uuid":"1233086002","full_name":"shaunchander/hunk-review.nvim","owner":"shaunchander","description":"A rather opinionated local code review plugin for neovim","archived":false,"fork":false,"pushed_at":"2026-05-21T20:37:33.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-22T05:56:48.588Z","etag":null,"topics":["lazyvim","neovim"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaunchander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-08T15:20:15.000Z","updated_at":"2026-05-21T20:37:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/shaunchander/hunk-review.nvim","commit_stats":null,"previous_names":["shaunchander/hunk-review"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shaunchander/hunk-review.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunchander%2Fhunk-review.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunchander%2Fhunk-review.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunchander%2Fhunk-review.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunchander%2Fhunk-review.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaunchander","download_url":"https://codeload.github.com/shaunchander/hunk-review.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunchander%2Fhunk-review.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34263872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lazyvim","neovim"],"created_at":"2026-06-12T21:33:15.862Z","updated_at":"2026-06-12T21:33:18.508Z","avatar_url":"https://github.com/shaunchander.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg width=\"1083\" height=\"841\" alt=\"Screenshot 2026-05-13 at 4 38 43 PM\" src=\"https://github.com/user-attachments/assets/2f87c2ce-b011-4e77-95e4-4bbec6044071\" /\u003e\n\n\u003ch1 align=\"center\"\u003e🔍 hunk-review.nvim\u003c/h1\u003e \u003cp align=\"center\"\u003eA lightweight, keyboard-driven code review plugin for Neovim.\u003cbr/\u003eBuilt for reviewing AI-generated code before it hits your codebase.\u003c/p\u003e\n\nCoding agents and LLMs can write a lot of code fast — but someone still needs to review it. hunk-review.nvim gives you a focused, distraction-free environment to walk through every change, annotate what needs fixing, and export structured feedback that agents can act on. No context-switching to a browser, no PR UI overhead. Just you, the diff, and your keyboard.\n\n- ✅ two-pane review UI with file explorer + diff viewer\n- ✅ inline commenting on change blocks, individual lines, or ranges\n- ✅ TreeSitter-powered syntax highlighting in diffs\n- ✅ peek into source files without leaving the review\n- ✅ structured JSON export for AI agents and downstream tools\n- ✅ auto-detects base + target branches with uncommitted / target / main diff modes (stacked-PR aware)\n\n## Getting started\n\nInstall with [lazy.nvim](https://github.com/folke/lazy.nvim):\n```lua\n{\n  \"shaunchander/hunk-review.nvim\",\n  opts = {\n    -- Optional: prepend a system prompt to the clipboard export so you can\n    -- paste directly into an LLM without writing instructions each time.\n    -- custom_prompt = \"Review these diffs and comments. Suggest targeted fixes only where a comment requests action.\",\n  },\n}\n```\n\nThen, open a review session:\n```\n:HunkReview\n```\n\n🎉 You're now reviewing your git diff in a purpose-built two-pane layout. Navigate files on the left, review hunks on the right.\n\n## 📘 Documentation\n\n### How it works\n\nhunk-review.nvim reads your `git diff` and renders it into a navigable, annotatable buffer. You get a file tree on the left and a unified diff view on the right — all keyboard-driven, no mouse needed.\n\nYou can add comments to change blocks, cycle between uncommitted / target-branch / main-branch diffs, peek at source files in a floating window, and export your entire review as structured JSON.\n\n### Explorer pane (left)\n\n| Key | Action |\n|-----|--------|\n| `j` / `k` | Navigate files |\n| `\u003cCR\u003e` / `o` | Jump to file's first hunk |\n| `\u003cC-l\u003e` | Focus review pane |\n| `/` | Filter files by name |\n| `x` | Clear filter |\n| `[` / `]` | Cycle diff mode (uncommitted → target → main) |\n| `C` | Toggle comments sidebar |\n| `r` | Refresh |\n| `q` | Close |\n\n### Review pane (right)\n\n| Key | Action |\n|-----|--------|\n| `j` / `k` | Jump to next/previous change block |\n| `]h` / `[h` | Jump to next/previous hunk header |\n| `\u003cSpace\u003e` | Toggle line-by-line mode |\n| `c` | Add/edit comment on change block or line |\n| `d` | Delete comment on current block |\n| `\u003cCR\u003e` | Copy review to clipboard (in visual mode: comment on selected lines) |\n| `o` | Jump to source file at current line |\n| `p` | Peek source file in floating window |\n| `e` | Export JSON review payload |\n| `\u003cC-h\u003e` | Focus explorer pane |\n| `[` / `]` | Cycle diff mode |\n| `C` | Toggle comments sidebar |\n\nVisual mode: select a range and press `c` or `\u003cCR\u003e` to comment on multiple lines.\n\n### Commenting\n\nAdd comments to any change block with `c`, or toggle line mode with `\u003cSpace\u003e` and comment on individual lines with `c`. Comments persist for the session and are included in exports.\n\nOpen the comments sidebar with `C` to see all your comments organized by file. In the sidebar, press `j`/`k` to jump between comments, `\u003cCR\u003e` to jump to the comment's location in the diff, and `d` to delete a comment.\n\n### Diff modes\n\nCycle diff modes with `[` and `]`:\n\n- **Uncommitted** — `git diff HEAD` (your working changes)\n- **Target** — `git diff $(merge-base \u003ctarget\u003e HEAD)` against the PR/upstream target branch. Only appears when the target branch is **not** the main base (useful for stacked PRs against a parent branch).\n- **Main** — `git diff $(merge-base \u003cbase\u003e HEAD)` against `main`/`master`/`develop`.\n\nThe **main** base branch is auto-detected from `main`, `master`, or `develop` (configurable via `setup()`).\n\nThe **target** branch is detected by trying, in order:\n\n1. `gh pr view --json baseRefName` (the actual GitHub PR base — most accurate for stacked PRs)\n2. `git rev-parse --abbrev-ref @{upstream}` (upstream tracking branch, with remote prefix stripped)\n\nIf neither succeeds, or the detected target equals the main base, the Target tab is hidden.\n\n### Reviewing agent-generated code\n\nhunk-review.nvim is purpose-built for the workflow of reviewing code that coding agents (Claude Code, Copilot, Cursor, Aider, etc.) write on your behalf. Instead of scanning raw diffs in the terminal or jumping between files, you get a structured review pass:\n\n1. **Agent writes code** — let it generate, refactor, or fix across multiple files\n2. **`:HunkReview`** — open the review UI and walk through every change\n3. **Annotate** — add comments on blocks that need revision, look wrong, or need context\n4. **Export** — send structured feedback back to the agent with `e` or copy to clipboard with `\u003cCR\u003e`\n\nThe JSON export includes file paths, line numbers, your comments, and the surrounding diff — everything an agent needs to act on your feedback without guessing what you meant.\n\n### Export\n\nPress `e` to generate a structured JSON payload with all hunks, change blocks, and comments. The export is designed for consumption by AI agents or external review tools.\n\nPress `\u003cCR\u003e` (outside line mode) to copy a text-formatted review to your clipboard — grouped by comment with file:line locations and fenced code blocks.\n\n## ⚙️ Configuration\n\nAll settings are optional. Call `setup()` to override defaults:\n\n```lua\nrequire(\"hunk-review\").setup({\n  -- Branches to try when detecting merge-base for the \"Main\" diff mode\n  base_branches = { \"main\", \"master\", \"develop\" },\n\n  -- Floating layout dimensions (0-1 = percentage of editor)\n  layout = {\n    width = 0.96,\n    height = 0.92,\n    explorer_width = 0.28,\n  },\n\n  -- Number of context lines in git diff\n  diff_context = 3,\n\n  -- Prepend a custom prompt to the clipboard export (\u003cCR\u003e outside line mode).\n  -- Useful for pasting directly into an LLM with pre-defined instructions.\n  -- When nil (default), only the diff and comments are copied.\n  custom_prompt = nil,\n})\n```\n\n### Health check\n\nRun `:checkhealth hunk-review` to verify your setup (git, snacks.nvim, treesitter parsers).\n\n## Commands\n\n### `:HunkReview`\nOpen the review buffer. If already open, refreshes with latest diff.\n\n### `:HunkReviewRefresh`\nReload git hunks and re-render the layout.\n\n### `:HunkReviewExport`\nOpen a buffer with the structured JSON export.\n\n### `:HunkReviewReset`\nClear all comments and reset review state.\n\n## Optional dependency\n\n[snacks.nvim](https://github.com/folke/snacks.nvim) — for an enhanced floating modal layout. Without it, hunk-review falls back to standard Neovim splits.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaunchander%2Fhunk-review.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaunchander%2Fhunk-review.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaunchander%2Fhunk-review.nvim/lists"}