Skip to content

feat(tui): add /diff, change review inside the workspace pane - #423

Merged
mohitranka merged 1 commit into
mainfrom
feat/diff-view
Aug 22, 2026
Merged

mohitranka merged 1 commit into
mainfrom
feat/diff-view

Conversation

@mohitranka

@mohitranka mohitranka commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Why

Forge was the only one of four agent CLIs benchmarked (Codex, Claude Code, OpenCode) with no way to review a change — no /diff, no changed-file view, nothing but scrollback and git diff in the terminal panel. It was the single largest gap against all three.

The design position

All three competitors answer this with a full-screen modal, which costs you sight of the conversation that produced the change. Forge already has three panes, so /diff is a mode of the workspace pane instead:

┌ changed files ─┐┌ DIFF · README.md · +3 −1 · 1 of 7 · working tree ─┐┌ conversation ┐
│  README.md   M ││ @@ -8,6 +8,7 @@ per-endpoint latency summary.     ││  (still live │
│  tests/…cli.py?││    8  8 │   ```                                   ││   and still  │
│  tracker/cli.py││      11 │ + python3 -m tracker summarize …        ││   streaming) │
│                ││ ] [ hunk · n p file · o open · ? keys · Esc close ││              │

Mostly assembly

Already existed Now used for
git_review.rs — combined_diff, hunk parsing, binary detection (wired to nothing) patch text
conversation.rs::render_numbered_diff patch rendering
GitStatusCache revision-keyed async diff loading (its comment already said "for a future diff view") non-blocking loads
hints.rs grammar + width degradation the pane's hint row

Commands

  • /diff — working tree: git diff HEAD plus untracked files as synthetic add patches
  • /diff turn — what the last assistant turn wrote, from the transcript's own diff cards
  • /d — alias

Keys

j/k, Ctrl+d/Ctrl+u, g/G scroll · ]/[ hunk · n/p file · o open at cursor line · d source · ? table · Esc close.

The pane carries its own hint row, degrading to keys-only when narrow (] [ n p o ? Esc).

o is the payoff for not being modal: jump from a hunk into the editable file at the right line, conversation still on screen. None of the three competitors can do this.

Enter is deliberately not a synonym for o — it already means "show me this file's patch" on the explorer side of this mode, and giving it a second, opposite meaning on the patch side would make one key do two things in one mode.

Two behaviours copied, two rejected

Copied: OpenCode's ? shortcut table, and a source selector.

Rejected: Claude Code's silent no-op on a clean tree (ours renders "No changes in the working tree" and stays open), and its session-dependent notion of "changed" — it hides an untracked file unless the same session created it. There's a test named for exactly that.

Notes

  • Every state renders something — loading, empty, git failure, not-a-repo, binary. Silence was the failure mode to avoid.
  • EditorSession::set_cursor is no longer #[cfg(test)]; o needs it in a release build.
  • The changed-file list is flat, not tree-shaped: the lazy tree only knows about expanded directories, so a tree filter would hide a changed file inside a collapsed folder.

Verification

cargo fmt --all -- --check clean · cargo clippy --all-targets clean · cargo test --workspace 45/45 binaries, 0 failures · 40 diff-specific tests.

Driven in a real PTY at 120x35 and 80x24: layout, every key, all empty/error states, and o landing on new-file line 46 of 63 from hunk @@ -38,7 +46,11 @@.

Design doc: docs/diff-view-design.md (local-only, untracked).

https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs

Forge was the only one of the four agent CLIs benchmarked with no way to
review a change: no /diff, no changed-file view, nothing but scrollback and
`git diff` in the terminal panel.

Codex, Claude Code and OpenCode all answer this with a full-screen modal,
which costs you sight of the conversation that produced the change. Forge
already has three panes, so /diff is a mode of the workspace pane instead:
the explorer becomes the changed-file list, the patch renders where a file
would, and the transcript keeps streaming beside it.

Mostly assembly. git_review.rs already had combined_diff, hunk parsing and
binary detection and was wired to nothing; conversation.rs already rendered
numbered patches for the agent's inline edit cards; GitStatusCache already
had revision-keyed async diff loading with a comment saying it was "for a
future diff view".

  /diff        working tree: `git diff HEAD` plus untracked files as
               synthetic add patches
  /diff turn   what the last assistant turn wrote, from the transcript's
               own diff cards
  /d           alias

Keys: j/k and Ctrl+d/Ctrl+u and g/G scroll, ] and [ move by hunk, n and p
move by file, o opens the file at the line under the cursor, d switches
source, ? shows the table, Esc closes. The pane carries its own hint row
(hints::DIFF), degrading to keys-only when narrow.

`o` is the payoff for not being modal: jump from a hunk into the editable
file at the right line with the conversation still on screen. None of the
three competitors can do that.

Enter is deliberately not a synonym for `o`. Enter already means "show me
this file's patch" on the explorer side of this mode; giving it a second,
opposite meaning on the patch side would make one key do two things.

Two behaviours copied deliberately, two rejected. Copied: OpenCode's `?`
shortcut table, and a source selector. Rejected: Claude Code's silent no-op
on a clean tree — ours renders "No changes in the working tree" and stays
open — and its session-dependent notion of "changed", which hides an
untracked file unless the same session created it.

Every state renders something: loading, empty, git failure, not-a-repo, and
binary files. Silence was the failure mode to avoid.

EditorSession::set_cursor is no longer #[cfg(test)] — `o` needs it in a
release build.

Verified in a real PTY at 120x35 and 80x24: layout, keys, all empty/error
states, and `o` landing on new-file line 46 of 63 from hunk @@ -38,7 +46,11.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
@mohitranka
mohitranka merged commit b3c3c76 into main Aug 22, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Sep 11, 2026
Forge was the only one of the four agent CLIs benchmarked with no way to
review a change: no /diff, no changed-file view, nothing but scrollback and
`git diff` in the terminal panel.

Codex, Claude Code and OpenCode all answer this with a full-screen modal,
which costs you sight of the conversation that produced the change. Forge
already has three panes, so /diff is a mode of the workspace pane instead:
the explorer becomes the changed-file list, the patch renders where a file
would, and the transcript keeps streaming beside it.

Mostly assembly. git_review.rs already had combined_diff, hunk parsing and
binary detection and was wired to nothing; conversation.rs already rendered
numbered patches for the agent's inline edit cards; GitStatusCache already
had revision-keyed async diff loading with a comment saying it was "for a
future diff view".

  /diff        working tree: `git diff HEAD` plus untracked files as
               synthetic add patches
  /diff turn   what the last assistant turn wrote, from the transcript's
               own diff cards
  /d           alias

Keys: j/k and Ctrl+d/Ctrl+u and g/G scroll, ] and [ move by hunk, n and p
move by file, o opens the file at the line under the cursor, d switches
source, ? shows the table, Esc closes. The pane carries its own hint row
(hints::DIFF), degrading to keys-only when narrow.

`o` is the payoff for not being modal: jump from a hunk into the editable
file at the right line with the conversation still on screen. None of the
three competitors can do that.

Enter is deliberately not a synonym for `o`. Enter already means "show me
this file's patch" on the explorer side of this mode; giving it a second,
opposite meaning on the patch side would make one key do two things.

Two behaviours copied deliberately, two rejected. Copied: OpenCode's `?`
shortcut table, and a source selector. Rejected: Claude Code's silent no-op
on a clean tree — ours renders "No changes in the working tree" and stays
open — and its session-dependent notion of "changed", which hides an
untracked file unless the same session created it.

Every state renders something: loading, empty, git failure, not-a-repo, and
binary files. Silence was the failure mode to avoid.

EditorSession::set_cursor is no longer #[cfg(test)] — `o` needs it in a
release build.

Verified in a real PTY at 120x35 and 80x24: layout, keys, all empty/error
states, and `o` landing on new-file line 46 of 63 from hunk @@ -38,7 +46,11.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
mohitranka added a commit that referenced this pull request Sep 11, 2026
Forge was the only one of the four agent CLIs benchmarked with no way to
review a change: no /diff, no changed-file view, nothing but scrollback and
`git diff` in the terminal panel.

Codex, Claude Code and OpenCode all answer this with a full-screen modal,
which costs you sight of the conversation that produced the change. Forge
already has three panes, so /diff is a mode of the workspace pane instead:
the explorer becomes the changed-file list, the patch renders where a file
would, and the transcript keeps streaming beside it.

Mostly assembly. git_review.rs already had combined_diff, hunk parsing and
binary detection and was wired to nothing; conversation.rs already rendered
numbered patches for the agent's inline edit cards; GitStatusCache already
had revision-keyed async diff loading with a comment saying it was "for a
future diff view".

  /diff        working tree: `git diff HEAD` plus untracked files as
               synthetic add patches
  /diff turn   what the last assistant turn wrote, from the transcript's
               own diff cards
  /d           alias

Keys: j/k and Ctrl+d/Ctrl+u and g/G scroll, ] and [ move by hunk, n and p
move by file, o opens the file at the line under the cursor, d switches
source, ? shows the table, Esc closes. The pane carries its own hint row
(hints::DIFF), degrading to keys-only when narrow.

`o` is the payoff for not being modal: jump from a hunk into the editable
file at the right line with the conversation still on screen. None of the
three competitors can do that.

Enter is deliberately not a synonym for `o`. Enter already means "show me
this file's patch" on the explorer side of this mode; giving it a second,
opposite meaning on the patch side would make one key do two things.

Two behaviours copied deliberately, two rejected. Copied: OpenCode's `?`
shortcut table, and a source selector. Rejected: Claude Code's silent no-op
on a clean tree — ours renders "No changes in the working tree" and stays
open — and its session-dependent notion of "changed", which hides an
untracked file unless the same session created it.

Every state renders something: loading, empty, git failure, not-a-repo, and
binary files. Silence was the failure mode to avoid.

EditorSession::set_cursor is no longer #[cfg(test)] — `o` needs it in a
release build.

Verified in a real PTY at 120x35 and 80x24: layout, keys, all empty/error
states, and `o` landing on new-file line 46 of 63 from hunk @@ -38,7 +46,11.

Claude-Session: https://claude.ai/code/session_018ihDDc3ahfrxu5AYL9moXs
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