Skip to content

feat(review): code review screen, plannotator-tui review - #154

Merged
backnotprop merged 11 commits into
mainfrom
feat/review-screen
Nov 15, 2026
Merged

backnotprop merged 11 commits into
mainfrom
feat/review-screen

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

plannotator-tui review [--staged | --base REF | --commit SHA] [DIR] opens a git diff. You move through it, select lines, write comments, suggested code or file notes, and send them the same way a document review sends: Herdr pane, Rex, a Pi chosen with P, a delivery command, or the clipboard.

This builds on #150 (the plannotator-tui-review crate, now in main).

plannotator-tui herdr review [--staged | --base REF | --commit SHA] [--placement P] [--deliver-to PANE] opens the same review in a Herdr pane, for the focused pane's repository (else the workspace's folder, else the current one). It checks the diff first, so a folder outside a repository or with no changes fails before any pane opens. The pane gets PLANNOTATOR_TUI_REVIEW (the scope) and PLANNOTATOR_TUI_REPO. herdr pane checks them after the message and terminal variables and before PLANNOTATOR_TUI_FILE. The development manifest has it as the review action (macOS and Linux, no default key). The diff is drawn by diffs-rs, from its main branch, with chrome: false. The TODO in Cargo.toml says to switch to crates.io 0.2.0 before release.

Layout

  • src/review/, parallel to app/:
    • cli: args, terminal, event loop.
    • mod: Screen, capture, placing notes.
    • diff: wraps the diffs-rs engine.
    • notes: rail order and labels.
    • drafts: c, s, C, e, x.
    • input: keys and mouse.
    • draw, rail, overlays: the frame.
    • send: send, finish, archive.
    • pi: Pi notes.
    • tests/.
  • src/ui/ is new and shared by app/ and review/: the comment box (moved from app/compose.rs, with a shared draw), the Pi picker, send button state, and footer hint flow.
  • Small shared additions:
    • DeliveryError::wants_copy/status.
    • cli::with_terminal.
    • theme::theme().
    • archive::Target.review (the browser's FeedbackReviewTarget shape), plus code fields on AnnotationRecord.
    • New keymap actions and contexts.
  • Unix only: Windows prints "code review is not available on Windows yet".

Keys

  • Selecting: v … v selects lines.
  • Notes:
    • c comment.
    • s suggest: the box is prefilled with the new lines; old-side lines are refused.
    • C note on the whole file.
  • Moving:
    • ]/[ hunk, n/N file.
    • h/l old/new side.
    • Tab diff ↔ notes rail; in the rail: j/k, e, x.
  • View: u split/unified, w wrap, f file list.
  • Sending:
    • E send new, S send and close, P pick the target.
    • m menu: R resend all, F finish, U undo.
  • Other:
    • r recompute the diff: notes follow their lines; changed ones go to "Outdated".
    • q asks first when notes are unsent.
    • In the comment box, Esc with changed text asks "discard comment? y discard · n keep editing". This is the document review's question, now in the shared comment box.
    • ? help.

Every key can be rebound; the new actions load with old configs.

Pi

A Pi session can leave notes on the diff. file is absolute and must be a changed file. line is a new-side line the diff shows. quote is optional. Each note is credited to its author.

The registry files lists the changed files. There is a new code, not_in_diff. docs/spec-pi-link.md, the tool description and integrations/pi/README.md are updated. node integrations/pi/test.mjs passes (53 checks).

Screens (120×40, real run in a private tmux)

 Uncommitted · 2 files +9 −4                                                  Review ▾ (m)   Send 1 new ▸ cmd · cat (E)
 src/cart.py                                                      Modified   +8 −3   README.md
  ···  Context not included in patch                                                ╭ 💬 file ─────────────────────────╮
 @@ -8,10 +8,15 @@ def subtotal(items):                                             │ The README should say how        │
   8   8      return total                                                          │ coupons work.                    │
   9   9                                                                            ╰──────────────────────────────────╯
  10  10
  11    − def tax(amount):

╭ comment on src/cart.py:15-16 · enter saves · alt+enter new line · esc cancels ──╮
│ Round once, at checkout, not per tax call.                                      │
╰─────────────────────────────────────────────────────────────────────────────────╯
 note saved · repo · 1 note · selected 15-16 new
 Uncommitted · 2 files +11 −4                                                 Review ▾ (m)   Send 2 new ▸ cmd · cat (E)
 README.md                                                        Modified   +1 −1   README.md
 @@ -1,3 +1,3 @@                                                                    ╭ 💬 file ─────────────────────────╮
   1   1  # Shop                                                                    │ The README should say how        │
   2   2                                                                            │ coupons work.                    │
   3    − A demo shop.                                                              ╰──────────────────────────────────╯
       3+ A demo shop with coupons.                                                  src/cart.py
 src/cart.py                                                     Modified   +10 −3  ╭ 💬 17-18 new ────────────────────╮
 @@ -1,5 +1,7 @@                                                                    │ Round once, at checkout, not per │
   1   1  """A small shopping cart."""                                              │ tax call.                        │
   2   2                                                                            ╰──────────────────────────────────╯
       3+ from decimal import Decimal


 send notes to cmd · cat before quitting? y send · n quit · esc cancel

Checks

  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings and cargo test --workspace pass: 709 tests, including 39 new code-review tests and 6 for the launcher (3 of them through the real binary against a recording fake herdr) on real temp git repos with TestBackend and a fake delivery.
  • herdr/test-manifest.py passes.
  • Windows: the clippy check is clean (cross-checked with --target x86_64-pc-windows-msvc).
  • musl: a static release build with vendored libgit2 works in a container. The binary runs --version.
  • Release binary on macOS arm64: 4,960,208 → 9,980,448 bytes (+5.0 MB, mostly syntect/two-face grammars and libgit2).

Not done

  • The herdr-annotate side (plan row 9): action, README keys, version pin.
  • The D scope menu, and an H archive view in code review.
  • Horizontal scroll: h/l switch sides, so long lines need w to wrap.
  • Tab toggles diff ↔ notes; the file list is f, not a Tab stop.
  • r returns the diff to the top.

@backnotprop
backnotprop force-pushed the feat/review-screen branch 2 times, most recently from 639f729 to 0a99295 Compare November 15, 2026 17:49
…ints

Code review will draw the same pieces as document review. They move out of
app/ into ui/, and the terminal setup becomes with_terminal() so another screen
can run its own event loop. No behaviour change.
The diff is drawn by diffs-rs without its chrome; header, notes rail, footer,
comment box, Pi picker and keys are this app's, shared with document reviews.
Notes are the review crate's CodeAnnotation records in review.json; r
recaptures and notes follow their lines or go Outdated. Sends use the same
delivery, clipboard fallback and feedback archive (surface review, with
target.review). A Pi session can leave notes on new-side lines. Unix only;
Windows says it is not available yet.
…ent review's question

The question now lives in the shared comment box: Compose::key asks when Esc would lose
changed text, and Compose::heading titles the box with it. Document reviews behave as
before.
…epository

The launcher finds the repository from the focused pane's folder, then the workspace's,
then its own, and captures the diff first, so a folder outside a repository or without
changes fails before any pane opens. The doc pane gets PLANNOTATOR_TUI_REVIEW (the scope)
and PLANNOTATOR_TUI_REPO; herdr pane checks them after the message and terminal variables
and before PLANNOTATOR_TUI_FILE. Placement and delivery resolve as for herdr open. The
development manifest offers it as the review action on macOS and Linux.
…s credit

The picker sorted by last activity, which changes each time a Pi goes busy or idle, so
rows could swap under the cursor. It now lists the folder's sessions first, then by name.
A rail title too wide for its bubble cut the credit off; the credit then moves into the
note as a From: line.
@backnotprop
backnotprop marked this pull request as ready for review November 15, 2026 20:31
@backnotprop
backnotprop added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit fb127e8 Nov 15, 2026
3 checks passed
@backnotprop
backnotprop deleted the feat/review-screen branch November 15, 2026 20:41
@backnotprop backnotprop mentioned this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant