Skip to main content

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.
Stateless Design:
  • Repository::open() called fresh each time
  • No static cache, no lazy_static!, no OnceCell
  • Pure function: returns Result<GitCommitDetail>
  • No persistent state between calls

Diff Data Flow

Why this matters:
  • 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)


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


SVG Layered Rendering

Painter’s Algorithm

SVG elements are rendered in DOM order - first in DOM = behind other elements.

Visual Hierarchy

No CSS z-index used - relies entirely on SVG painter’s model for correct layering.

Interactive Filter System

Two Filter Modes

Bidirectional Merge Relationship Check

Opacity-Based Visual Feedback

Contrast ratio: 6.67x for nodes, 8x for lines - clear visual distinction.

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.