emusoiGitHub

sawa

/ˈsa.wa/adjectiveSwahili

  1. 1.Okay; fine; all right.
  2. 2.Equal; the same. Sawa sawa, exactly alike.
  3. 3.interjection LGTM.
  4. 4.Code review in Neovim.

Origin What a reviewer says at the end: sawa. And what a rename made in forty files is: the same, so it is read once.

How a walk goes

The walk

A big change is not read top to bottom. It opens on a map: the change in a handful of parts, each with what it is made of, where to start, and how far you are.

  walk  map  0 of 74 stops                                        Begin ⏎   Redraft   Find   Keys ?

  #14475 Add a skill for chaptered CLI recordings                           74 files  ·  16k lines

  This change, in 16 parts
  Read top to bottom. Each part is a few stops, and each stop says why you are there.

   1  tool/internal/engine          all new · Handle, document, pendingRe…  6 files   0/6    start here
   2  tool/internal/evidence        all new · mediaInfo, sessionMediaRead…  11 files  0/11
   3  tool/internal                 all new · runOptions, Info, adapterMe…  5 files   0/5
   4  references                    all new · recording.md, chapters.md …  7 files   0/7
   …
  11  Tests · tool/internal/engine  all new · fakeTerminal, denialKeyCase…  3 files   0/3

  ·  Quiet                                                        2 files          lockfile — skipped

  ⏎ begin here   ·   1–9 jump to a part   ·   t files instead   ·   ? keys

Then one stop at a time: the real file, at the change, with the reason you are there written above the code. The biggest hunk of every file comes before any file's second, so the shape of the change arrives first.

  walk  stop 3 of 74  ·  tool/internal/engine                      Next ⏎   Back   Map m   Accept a

  changes func Open (+1 −1) — the loader reads the config once
   41  func Open(path string) (*Engine, error) {
   42  -	cfg, err := load(path)
   42  +	cfg, err := loadOnce(path)
   43  	if err != nil {

A repeated edit — a rename, a signature change, an import swapped across a package — is one stop, not forty. sawa shows the edit once, says how many files make exactly that edit, and points at the copies that start the same way and end differently: the only ones that need reading on their own. Accept it, and every file that only makes that edit is read.

  walk  repeated edit  ·  3 of 3 copies

  The same edit, 38 times in 38 files
  -	ctx *Ctx  →  +	ctx context.Context

  Only the one below does something else:
  store/loans.go:88   also adds limit int

  a accept all 38   ·   ⏎ read the one that differs   ·   m map

The walk ends on what you read, what you skipped, and the verdict: approve, changes, or comment. Nothing here is a key to learn first — every action is a button you can click, and the keys are shortcuts for the same.

In the editor

A review opens in its own tab of your own Neovim, on the real files, so highlighting and language servers keep working. The tree is your nvim-tree, filtered to the files the review changed, ✓ once read. One finder lists every action by name; Telescope is optional. Findings sit on the line they are about, and drafts survive closing the composer.

From a shell, sw tui is the front door: the pull requests you are in with how far through each, yours, the rest, and this branch. Pick one and it opens with the walk up — in a tmux popup when there is a tmux, so the list is there when you come back. sw nvim pr 14 skips the list.

  ● sawa  cli  ·  trunk

  Pull requests you are in

  ▸ #14663  Refreshable tokens: review fixes across the s…  ana   +820 −310   0/31 read   9 open    2 wait on you
    #14475  Add a skill for chaptered CLI recordings        mike  +16k −0     0/74 read   4 open    16 parts  ·  start here
    #14578  Replace extension browse with Bubble Tea        joe   +410 −95    8/8 read    1 open    approved ✓

  Everything else                                                                             24 more below

  ⏎ review in nvim   ·   j/k move   ·   r refresh   ·   q quit                      opens in a tmux popup

Agents

An agent holds the same command line. sw brief is the open findings, numbered and anchored to lines; sw address 3 claims a fix and shows the diff behind it; sw resolve is for people only. A finding goes open → addressed → resolved, and nothing an agent does moves it past addressed. The reviewer stays the reviewer.

The reading order is drafted from the change itself — which hunks become stops, how many, in what order, how the parts are named — and is yours to rewrite: sw path add -f FILE -l LINE -m "why". A person's reason always stands over a drafted one.

Install

go install github.com/emusoi/sawa/cmd/sw@latest cd your/repo && sw tui

Neovim 0.11+, Git 2.31+, macOS or Linux. The plugin is the nvim/ folder of the repository; with lazy.nvim, point a spec at it and call require("sawa").setup(). Pull requests need gh, signed in. Reviews live under .git/sawa/reviews/, one file each, so nothing leaves your machine.