Skip to content

Commit 3d922cd

Browse files
committed
docs: update documentation, changelog, and readme for TUI diff view
1 parent 4f494ff commit 3d922cd

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
77
## [Unreleased]
88

99
### Added
10+
- Syntax-highlighted diff view for write/edit tool output in TUI (#451)
11+
- Diff rendering with green/red backgrounds for added/removed lines
12+
- Word-level change highlighting within modified lines
13+
- Syntax highlighting via tree-sitter
14+
- Compact/expanded toggle with existing 'e' key binding
15+
- New dependency: `similar` 2.7.0
1016
- Smart tool output filtering: command-aware filters that compress tool output before context insertion
1117
- `OutputFilter` trait and `OutputFilterRegistry` with first-match-wins dispatch
1218
- `sanitize_output()` ANSI escape and progress bar stripping (runs on all tool output)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ cargo build --release --features tui
118118
| **Skill Trust & Quarantine** | 4-tier trust model (Trusted/Verified/Quarantined/Blocked) with blake3 integrity verification, anomaly detection with automatic blocking, and restricted tool access for untrusted skills | |
119119
| **Prompt Caching** | Automatic prompt caching for Anthropic and OpenAI providers, reducing latency and cost on repeated context | |
120120
| **Graceful Shutdown** | Ctrl-C triggers ordered teardown with MCP server cleanup and pending task draining | |
121-
| **TUI Dashboard** | ratatui terminal UI with tree-sitter syntax highlighting, markdown rendering, deferred model warmup, scrollbar, mouse scroll, thinking blocks, conversation history, splash screen, live metrics, message queueing (max 10, FIFO with Ctrl+K clear) | [TUI](https://bug-ops.github.io/zeph/guide/tui.html) |
121+
| **TUI Dashboard** | ratatui terminal UI with tree-sitter syntax highlighting, markdown rendering, syntax-highlighted diff view for write/edit tool output (compact/expanded toggle), deferred model warmup, scrollbar, mouse scroll, thinking blocks, conversation history, splash screen, live metrics, message queueing (max 10, FIFO with Ctrl+K clear) | [TUI](https://bug-ops.github.io/zeph/guide/tui.html) |
122122
| **Multi-Channel I/O** | CLI, Discord, Slack, Telegram, and TUI with streaming support | [Channels](https://bug-ops.github.io/zeph/guide/channels.html) |
123123
| **Defense-in-Depth** | Shell sandbox with relative path traversal detection, file sandbox, command filter, secret redaction (Google/GitLab patterns), audit log, SSRF protection (agent + MCP), rate limiter TTL eviction, doom-loop detection, skill trust quarantine | [Security](https://bug-ops.github.io/zeph/security.html) |
124124

docs/src/guide/tui.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ ZEPH_TUI=true zeph
6262
| `Page Up/Down` | Scroll chat one page |
6363
| `Home` / `End` | Scroll to top / bottom |
6464
| `Mouse wheel` | Scroll chat up/down (3 lines per tick) |
65+
| `e` | Toggle expanded/compact view for tool output and diffs |
6566
| `d` | Toggle side panels on/off |
6667
| `Tab` | Cycle side panel focus |
6768

@@ -103,6 +104,25 @@ Chat messages are rendered with full markdown support via `pulldown-cmark`:
103104
| `~~strikethrough~~` | Crossed-out modifier |
104105
| `---` | Horizontal rule (─) |
105106

107+
## Diff View
108+
109+
When the agent uses write or edit tools, the TUI renders file changes as syntax-highlighted diffs directly in the chat panel. Diffs are computed using the `similar` crate (line-level) and displayed with visual indicators:
110+
111+
| Element | Rendering |
112+
|---------|-----------|
113+
| Added lines | Green `+` gutter, green background |
114+
| Removed lines | Red `-` gutter, red background |
115+
| Context lines | No gutter marker, default background |
116+
| Header | File path with `+N -M` change summary |
117+
118+
Syntax highlighting (via tree-sitter) is preserved within diff lines for supported languages (Rust, Python, JavaScript, JSON, TOML, Bash).
119+
120+
### Compact and Expanded Modes
121+
122+
Diffs default to **compact mode**, showing a single-line summary (file path with added/removed line counts). Press `e` to toggle **expanded mode**, which renders the full line-by-line diff with syntax highlighting and colored backgrounds.
123+
124+
The same `e` key toggles between compact and expanded for tool output blocks as well.
125+
106126
## Thinking Blocks
107127

108128
When using Ollama models that emit reasoning traces (DeepSeek, Qwen), the `<think>...</think>` segments are rendered in a darker color (DarkGray) to visually separate model reasoning from the final response. Incomplete thinking blocks during streaming are also shown in the darker style.

0 commit comments

Comments
 (0)