oyo 0.1.49

CLI TUI for oyo - Step-through diff viewer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
<div align="center">

# Oyo

Oyo is your complete terminal code review tool.

<!-- Regenerate with: cd website && npm run generate-demos -->
![Oyo demo](docs/assets/demo.gif)

</div>

Read any change, comment on exact lines and work every thread through to resolved. Oyo keeps the whole review in your terminal.

Diff viewing is how you read a change. Oyo also stores comments, tracks replies, syncs review threads and gives agents the same workflow.

## Code review for you, your team and your agent

### Review any change

Review a working tree, branch, commit, range, jj change or stack. Add comments to lines and hunks, reply in threads and resolve feedback.

Oyo saves each review against its target. You can close the TUI and continue later.

### Sync with your team

Pull review comments from GitHub, GitLab, Codeberg or self-hosted Forgejo. Reply and push changes back. GitHub and GitLab also support remote thread resolution. Forgejo resolved state is read-only because its API has no resolve endpoint.

### Work with your agent

Point your coding agent at the Oyo skill. The agent can review a change, leave comments, work through feedback or control a running Oyo session.

Humans and agents use the same targets, comments and commands. See [working with agents](./docs/AGENT.md).

## Choose how you read a change

You can switch between scroll mode and step mode at any time.

### Scroll mode

Use scroll mode to read the whole change at once. You can scroll freely and jump between hunks.

```sh
oy
```

### Step mode

Use step mode to read one edit at a time. You can also press play to move through the change automatically.

```sh
oy --step
```

Press `s` in the TUI to switch modes. Set `stepping = true` in your config to start in step mode.

## Features

Oyo helps you complete a review without leaving the terminal. You can:

- comment on lines, hunks and files
- reply in flat review threads
- resolve and reopen thread roots
- track comments that become outdated as the diff changes
- pull, reply to and push GitHub, GitLab, Codeberg and self-hosted Forgejo review comments
- use the review CLI and installed skill with coding agents
- read changes in scroll mode or step mode
- move between hunks and files
- switch between unified, split, evolution, blame and preview views
- open multiple views in tabs
- preview Markdown, JSON, YAML, TOML, CSV and images
- select and copy text with character, line and block selection
- see word-level changes
- search with regular expressions
- use syntax highlighting and `.tmTheme` syntax themes
- fold unchanged context with enclosing scope hints
- show blame hints
- refresh changed files in watch mode
- run commands from the command palette
- use keyboard and mouse controls
- animate or autoplay changes in step mode
- wrap long lines
- review Git and jj targets
- open saved review history with `oy log`
- run review hooks
- load configuration from XDG config paths

## Install

### npm

```sh
npm i -g @ahkohd/oyo
```

### Pi package

The Pi package adds the `/oyo` command. It points the coding agent at the Oyo review skill.

```sh
pi install npm:@ahkohd/pi-oyo
```

### Homebrew

```sh
brew install ahkohd/oyo/oy
```

### Arch Linux

```sh
paru -S oyo
```

### Cargo

```sh
cargo install oyo --locked --force
```

### Nix

```sh
nix profile add github:ahkohd/oyo
```

Or run it without installing:

```sh
nix run github:ahkohd/oyo
```

## Use Oyo

### Show uncommitted changes

```sh
oy
```

### Step through uncommitted changes

```sh
oy --step
```

### Compare 2 files

```sh
oy old.rs new.rs
```

### Compare one file with HEAD

```sh
oy path/to/file.rs
```

### Show staged changes

```sh
oy --staged
```

### Show a Git range

```sh
oy --range HEAD~1..HEAD
oy --range main...feature
```

### Choose a view mode

```sh
oy old.rs new.rs --view split
oy old.rs new.rs --step --view evolution
```

### Use autoplay

```sh
oy old.rs new.rs --step --autoplay
oy old.rs new.rs --step --speed 100
```

### Open history

```sh
oy log
```

## Use Oyo with Git

Use `git difftool`:

```sh
git difftool -y --tool=oy
```

Add this configuration to `~/.gitconfig`:

```gitconfig
[difftool "oy"]
    cmd = oy "$LOCAL" "$REMOTE"

[difftool]
    prompt = false

[alias]
    d = difftool -y --tool=oy
```

Keep your pager, such as `less`, `moar` or `moor`, for `git diff`.

Do not set `core.pager` or `interactive.diffFilter` to `oy`.

## Use Oyo with Jujutsu

Register `oy` as a diff tool and add a shortcut:

```toml
[merge-tools.oy]
program = "oy"
diff-args = ["$left", "$right"]

[aliases]
d = ["diff", "--tool", "oy"]
```

Run `jj d` or `jj diff --tool oy`.

You can also open jj targets directly:

```sh
oy @
oy feature
oy 'trunk()..@'
```

Keep your pager for `jj diff`, `jj log` and other commands. Do not set `oy` as the global `ui.diff-formatter`.

## Review comments

Press `m` to comment on a line. Press `M` to comment on a hunk.

```sh
oy
```

Oyo saves review state for the current target. Review cards use indexed actions:

- `ra` replies to the first visible comment
- `va` resolves or reopens the first visible thread root
- `ia` edits the first visible comment
- `xa` deletes the first visible comment

The index changes to `b`, `c` and later letters for other visible cards. Reply cards do not show a resolve action because resolved state belongs to the thread.

Every review action also has a CLI command. This means you and your agent can work on the same review:

```sh
oy review status
oy review status --json
oy review comment
oy review comment --unresolved
oy review comment new --file src/lib.rs --new-line 42 --body "Handle empty input."
oy review comment reply 1 --body "Fixed in the latest change."
oy review comment resolve 1
oy review comment unresolve 1
```

The `--unresolved` filter hides outdated comments by default. Oyo marks a comment outdated when its anchored line changes or disappears. Use `--unresolved --outdated` to inspect stale unresolved comments.

All review commands use the same target rules. In Git, Oyo prefers the current branch's saved pull request review. It falls back to the working tree.

Use `-t @` for the Git working tree. Pass a branch, commit or range with `-t` for another review:

```sh
oy review status -t development...feature
oy review comment -t feature
```

jj defaults to `@`. If `@` has one bookmark, Oyo treats that bookmark like a branch.

Use a jj revset to review a stack:

```sh
oy 'trunk()..@'
oy review comment 'trunk()..@'
```

Pull and push provider review comments after authenticating `gh`, `glab`, `cb` or `fj` for the remote host:

```sh
oy review pull
oy review push
```

Export comments or apply review JSON:

```sh
oy review export --format json > comments.json
oy review comment apply comments.json
```

See the [review command reference](./docs/REVIEW.md), [agent workflows](./docs/AGENT.md) and [review hooks](./docs/REVIEW_HOOKS.md).

## Keybindings

Most navigation commands support counts. For example, `10j` moves 10 steps forward and `5J` scrolls down 5 lines.

Common defaults:

| Key | Action |
| --- | --- |
| `j`, `down` | Scroll down, or next step in step mode |
| `k`, `up` | Scroll up, or previous step in step mode |
| `l`, `right` | Next hunk |
| `h`, `left` | Previous hunk |
| `v` | Start character selection |
| `V` | Start line selection |
| `ctrl-v` | Start block selection |
| `y` | Copy selection or current line |
| `/` | Search |
| `n` | Next search match |
| `N` | Previous search match |
| `tab` | Cycle view modes |
| `s` | Toggle step mode |
| `m` | Add or update a line comment |
| `M` | Add or update a hunk comment |
| `ctrl-s` | Save an inline comment |
| `ctrl-p` | Open the command palette |
| `R` | Refresh files |
| `?` | Show help |
| `q` | Quit |

See the [keybinding and mouse reference](./docs/KEYBINDINGS.md).

Select text with a mouse drag or `v`, `V` and `ctrl-v`. Press `y` to copy and `esc` to clear.

Oyo first uses a system clipboard tool:

- `pbcopy` on macOS
- `wl-copy`, `xclip` or `xsel` on Linux
- `clip` on Windows

Oyo falls back to OSC 52 clipboard support if these tools fail.

## Configure Oyo

Create `~/.config/oyo/config.toml`.

You can pass extra config files with repeatable `--config FILE` options. Oyo loads your user config first, then merges each extra file in order.

```sh
oy --config /tmp/oyo-plugin.toml
```

A minimal configuration looks like this:

```toml
[ui]
view_mode = "unified"
stepping = false
watch = true
line_wrap = false

[ui.diff]
fg = "syntax"
bg = true
highlight = "word"

[ui.syntax]
mode = "on"

[files]
panel_visible = true
panel_width = 30
panel_position = "left"
```

Oyo loads the first matching user config file:

1. `$XDG_CONFIG_HOME/oyo/config.toml`
2. `~/.config/oyo/config.toml`
3. the platform config directory, such as `~/Library/Application Support/oyo/config.toml` on macOS

Use these references for more configuration:

- [config reference]./docs/CONFIG.md
- [theme configuration]./docs/THEME.md
- [keybinding actions]./docs/KEYBINDINGS.md
- [review commands]./docs/REVIEW.md
- [review hooks]./docs/REVIEW_HOOKS.md
- [diff behaviour]./docs/DIFF_VIEWER.md
- [diff styling previews]./docs/DIFF_PREVIEWS.md

The [diff styling previews](./docs/DIFF_PREVIEWS.md) include screenshots.

## Development

```sh
cargo build
cargo test
cargo run --bin oy -- old.rs new.rs
```