THE CENTER
The Git Diff Viewer and Branch Diagram are critical interfaces for Human ◈ AI collaboration. They provide transparency through:- Fresh Diff Computation: No cached data, always current state
- Dual View Modes: Unified (quick overview) vs Split (detailed comparison)
- OKLab Gradients: Perceptually uniform color transitions reduce cognitive load
- SVG Layering: Proper visual hierarchy shows Git relationships clearly
- Interactive Filters: Focus on relevant branches for efficient review
Diff Viewer Architecture
Fresh Diff Computation
Every diff request computes fresh from Git trees - no caching.Repository::open()called fresh each time- No static cache, no
lazy_static!, noOnceCell - Pure function: returns
Result<GitCommitDetail> - No persistent state between calls
Diff Data Flow
- Human always sees current state
- No stale diffs from previous sessions
- AI changes immediately visible
- Trust through transparency
Diff Parsing Pipeline
Unified Diff Format
Parsing State Machine
Line Type Classification
View Modes
Unified View
Single column, interleaved additions and deletions.Split View
Side-by-side, old on left, new on right.Color Coding (Both Views)
| Type | Background | Text |
|---|---|---|
| add | Light green | Dark green |
| del | Light red | Dark red |
| ctx | Transparent | Default |
Branch Diagram Architecture
OKLab Color System
Perceptually uniform color interpolation for merge line gradients. Why OKLab over RGB:- RGB interpolation produces muddy midpoints
- HSL has hue discontinuities
- OKLab is scientifically proven to be perceptually uniform
Color Conversion Pipeline
OKLab Transformation Matrices
SVG Layered Rendering
Painter’s Algorithm
SVG elements are rendered in DOM order - first in DOM = behind other elements.Visual Hierarchy
Interactive Filter System
Two Filter Modes
Bidirectional Merge Relationship Check
Opacity-Based Visual Feedback
| State | Node Opacity | Line Opacity | Visibility |
|---|---|---|---|
| Filtered | 15% | 10% | Ghosted, faded |
| Active | 100% | 80% | Fully solid, prominent |
Integration Summary
How Claims Work Together
Data Flow
Key Insight
Fresh computation + dual view modes + OKLab gradients + SVG layering = complete transparency in Git history visualization. Human and AI see the same clear representation, enabling efficient collaboration and trust.