Skip to content
BoogeyCodesPublic

About

Build side-by-side multi-run diff views for comparing what several AI coding-agent runs changed. Zero-dependency TypeScript.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DiffLens

CI TypeScript Vite Zero runtime deps License: MIT

An interactive viewer for comparing what several AI coding-agent runs changed — side by side, with the divergence points called out. Paste each run's file changes (or load the bundled sample) and DiffLens lines the runs up column by column, highlights every inserted and deleted line, counts the damage per cell, and badges the files more than one agent touched — the places the runs disagree.

DiffLens dashboard

Run the app

npm install
npm run dev        # Vite dev server — opens on http://localhost:5173

The page renders instantly with realistic sample runs (three agents fixing the same rate-limiter bug three different ways). Paste your own AgentRun[] JSON into the left panel and press Compare.

Other scripts:

npm run build:web  # production build → dist-web/
npm run preview    # serve the production build

Docker

docker build -t difflens .
docker run -p 8080:80 difflens   # static app on http://localhost:8080

App features

  • Load sample / paste JSON — one click for a realistic multi-agent scenario, or feed it your own runs. Bad JSON reports a precise, friendly error.
  • Side-by-side comparison — one section per file, a column per agent, with green inserts and red deletes, a +added/-removed stat on each cell, and explicit not changed cells for agents that skipped a file.
  • Divergence badges — files changed by more than one agent are highlighted and badged, so the points where the runs disagree jump out.
  • Summary bar & filters — totals for agents, files, overlap and lines added/removed, plus a path filter, an only diverged files toggle, and a side-by-side / stacked layout switch.
  • Dark, teal-accented, responsive — works down to phone width with no horizontal page scroll.

The library

The app is a thin shell over difflens, a zero-runtime-dependency TypeScript library (ESM + CJS, with type definitions). You can use it directly to build your own diff views or static reports.

import { compareRuns, renderHtml } from 'difflens'

const comparison = compareRuns([
  { agent: 'agent-a', files: [{ path: 'src/auth.ts', before: oldAuth, after: aFix }] },
  { agent: 'agent-b', files: [{ path: 'src/auth.ts', before: oldAuth, after: bFix }] },
])

comparison.overlap          // ['src/auth.ts'] — where the runs diverge
const html = renderHtml(comparison, 'Auth fix comparison')  // a complete, self-contained HTML page

API

  • diffLines(before, after) — a line-level diff using the longest-common-subsequence algorithm, returning each line tagged equal, insert or delete. diffStats(lines) gives { added, removed, unchanged }, and formatDiffStats(stats) a compact +a/-r label.
  • compareRuns(runs) — for every file any run changed, compute each run's diff (or null when it didn't touch that file), count how many runs changed it, and list the files more than one run touched (overlap).
  • renderHtml(comparison, title?) — a self-contained dark-theme HTML page: one section per file, a column per agent, with added/removed lines highlighted and overlapping files badged. Everything is escaped; no scripts, no external assets.

Types

interface FilePatch { path: string; before: string; after: string }
interface AgentRun  { agent: string; files: FilePatch[] }

interface Comparison {
  agents: string[]
  files: Array<{ path: string; byAgent: Record<string, FileDiff | null>; changedBy: number }>
  overlap: string[]
}

Project layout

Path What it is
src/ The zero-dependency library (diffLines, compareRuns, renderHtml).
web/ The Vite single-page app. web/model.ts is a DOM-free, unit-tested view model.
test/ Vitest suites for the library and the app's view model.
docs/ The dashboard screenshot.

Development

npm install
npm test            # lib + view-model tests (Vitest)
npm run typecheck   # library type check
npm run typecheck:web
npm run build       # ESM + CJS + .d.ts via tsup
npm run build:web   # production web bundle

CI runs the full matrix (Ubuntu + Windows × Node 18/20/22): typecheck, tests, library build, web typecheck and web build.

Where it fits

DiffLens is the "see what each run changed" view in an agent-evaluation workflow — pair it with a run normaliser and a rubric scorer to review which of several runs did the job best.

License

MIT

About

Build side-by-side multi-run diff views for comparing what several AI coding-agent runs changed. Zero-dependency TypeScript.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages