# PR Lens

> PR Lens draws every pull request as animated architecture and data-flow diagrams posted directly inside the pull request as a bot comment.

PR Lens is an open-source tool by Coldtea AI that reduces the cognitive load of reviewing AI-generated pull requests by converting diffs into animated SVG architecture and data-flow diagrams posted directly inside the PR as a bot comment. It is MIT-licensed, available on GitHub, and currently at version v0.1.3.

## What It Is

PR Lens sits between a code diff and a human reviewer. Instead of reading hundreds of changed lines across many files, a reviewer sees a single animated diagram showing what the change touches, how data flows through the new path, and which nodes are new, changed, or removed — all rendered in color-coded, animated SVG that survives GitHub's image proxy. Two diagram "lenses" ship: an **architecture lens** (blast radius against the existing system) and a **data-flow lens** (ordered pipeline, animated with moving pulses).

## Five Ways to Use It

PR Lens offers multiple deployment modes, all producing the same diagrams from the same underlying document format:

- **GitHub App** — Install the hosted app on a repository; every PR automatically gets a sticky bot comment that updates on each push. View-option checkboxes are live in this mode, re-rendering from the stored graph in seconds with no model key required from the user.
- **Coding agent skill** — Run `npx skills add coldteadotai/pr-lens` to teach a coding agent (Cursor, Claude Code, etc.) to write the graph document itself and attach it to the PR, reusing the agent's existing model rather than incurring a separate API bill.
- **GitHub Action** — Add a workflow file using `coldteadotai/pr-lens/packages/action@v0` with a `GEMINI_API_KEY` (or OpenAI-compatible) secret; the Action analyzes the diff and posts a static comment from your own CI.
- **CLI** — Run `npx @coldtea/pr-lens-cli` step by step: `analyze`, `render`, `comment`, `validate`, and `export` commands give full control on any machine.
- **Local terminal** — Render diagrams before a PR even exists, useful for reviewing an agent's work alongside the diff.

## Architecture and Renderer

The renderer is a bespoke SVG engine — not Mermaid — designed specifically for easy comprehension of code changes. It uses a consistent visual grammar: lanes, node cards, delta colors (green = new, amber = changed, red = removed), and routed edges that stay traceable even in dense graphs. The renderer scales from a single-card minimal diagram (1 lane, 1 node, 0 edges) up to monorepo-scale graphs (6 lanes, 37 nodes, 49 edges). Animated pulses in data-flow diagrams move along arrows in the order steps execute, with activation bars for waited-on calls and open arrowheads for fire-and-forget messages. Every diagram on the project page is regenerated deterministically from checked-in fixtures.

## Package Structure

The repository is a TypeScript monorepo (Node 20.11+, pnpm 10) with five packages:

- `@coldtea/pr-lens-schema` — the contract every component speaks
- `@coldtea/pr-lens-renderer` — deterministic JSON graph → animated, theme-paired SVGs
- `@coldtea/pr-lens-cli` — analyze, render, compose, validate, export
- `packages/action` — the GitHub Action
- `@coldtea/pr-lens-agent-skill` — teaches a coding agent to draw the change it just made

## Update: v0.1.3

The latest release is v0.1.3, published on 2026-08-26. The repository was created in August 2026 and has seen active development, with the last push on 2026-08-26. The GitHub App runs on Gemini by default with no user model key required; the CLI and Action also support OpenAI and any OpenAI-compatible endpoint (OpenRouter, DeepSeek, Ollama, self-hosted servers).

## Features
- Animated SVG architecture diagrams posted as PR bot comments
- Data-flow sequence diagrams with animated pulses
- GitHub App with live view-option checkboxes
- GitHub Action with configurable model provider
- CLI with analyze, render, comment, validate, and export commands
- Coding agent skill via npx skills add
- Bespoke SVG renderer (not Mermaid)
- Color-coded delta nodes: green new, amber changed, red removed
- Scales from single-node to monorepo-scale graphs
- Supports Gemini, OpenAI, and OpenAI-compatible endpoints
- No user API key required when using the hosted GitHub App
- MIT licensed and fully open source

## Integrations
GitHub, GitHub Actions, GitHub App, Gemini, OpenAI, OpenRouter, DeepSeek, Ollama, Cursor, Claude Code, npm, pnpm

## Platforms
MACOS, WEB, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
v0.1.3

## Links
- Website: https://prlens.dev
- Documentation: https://github.com/coldteadotai/pr-lens
- Repository: https://github.com/coldteadotai/pr-lens
- EveryDev.ai: https://www.everydev.ai/tools/pr-lens
