npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

diffelens

v0.7.0

Published

Multi-lens AI PR review orchestrator using Claude Code / Codex CLI

Readme

CI npm License: MIT

AI PR review orchestrator with customizable review lenses. Add project-specific review perspectives — security, performance, i18n, or anything else — by writing a prompt file and a few lines of YAML.

Ships with three built-in lenses (readability / architectural / bug_risk) and supports Claude Code, Codex CLI, and Gemini CLI as execution engines.

Concept

  • Multi-Lens Review — Built-in lenses review from three perspectives in parallel: readability, architecture, and bug risk
  • Custom Lenses — Add project-specific review perspectives with a prompt file and config entry. Security, performance, i18n, accessibility — any review focus you can describe
  • Adaptive Context — Control what each lens sees: diff-only isolation or full repository exploration with tools
  • Multi-CLI Support — Mix and match Claude Code, Codex, and Gemini per lens
  • Convergent Review — Round-based severity filtering narrows focus until only blockers remain, then auto-approves

Quick Start

Local Review

# Install diffelens and at least one LLM CLI
npm install -g diffelens
npm install -g @anthropic-ai/claude-code  # or @google/gemini-cli or @openai/codex

# Set your API key
export ANTHROPIC_API_KEY=sk-ant-xxx

# Review current branch changes
diffelens --diff-target branch

GitHub Actions

Add the workflow to your repo — diffelens posts a review comment on every PR:

# .github/workflows/ai-review.yml
name: AI PR Review
on:
  pull_request:
    types: [opened, synchronize]

permissions:
  pull-requests: write
  contents: read

jobs:
  ai-review:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: "20"
      - run: npm install -g diffelens @anthropic-ai/claude-code
      - run: diffelens
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_REPOSITORY: ${{ github.repository }}
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
          PR_NUMBER: ${{ github.event.pull_request.number }}
          BASE_SHA: ${{ github.event.pull_request.base.sha }}
          HEAD_SHA: ${{ github.event.pull_request.head.sha }}

Configuration

Place .diffelens.yaml at the repository root to customize lenses, models, and convergence settings. If no config exists, diffelens uses its bundled default (Claude Code).

# .diffelens.yaml
version: "1.0"
global:
  max_rounds: 4
  default_cli: "claude"
lenses:
  readability:
    cli: "claude"
    model: "claude-sonnet-4-6"
    isolation: "tempdir"
    tool_policy: "none"
    severity_cap: "warning"
  architectural:
    cli: "claude"
    model: "claude-opus-4-6"
    isolation: "repo"
    tool_policy:
      type: "explicit"
      tools: ["Read", "Grep", "Glob"]
  bug_risk:
    cli: "claude"
    model: "claude-opus-4-6"
    isolation: "repo"
    tool_policy:
      type: "explicit"
      tools: ["Read", "Grep", "Glob"]

Custom Lenses

Any lens name beyond the three built-ins (readability, architectural, bug_risk) is a custom lens. Define it in .diffelens.yaml and point it at a prompt file.

Adding a custom lens

1. Write a prompt file (e.g. prompts/security.md):

# Security Review Lens

You are a security specialist. Review the diff for:

- Injection vulnerabilities (SQL, command, XSS)
- Hardcoded secrets or credentials
- Insecure deserialization
- Missing input validation at trust boundaries
- Authentication / authorization gaps

## Out of Scope
- Code style and readability (handled by other lenses)
- Performance optimization

## Severity Criteria
- blocker: Exploitable vulnerability or leaked secret
- warning: Missing validation that could become exploitable
- nitpick: Minor hygiene improvements

2. Add the lens to config:

# .diffelens.yaml
lenses:
  security:
    enabled: true
    prompt_file: "prompts/security.md"   # required for custom lenses
    cli: "claude"
    model: "claude-opus-4-6"
    isolation: "repo"                     # allow repository exploration
    tool_policy: "all"
    severity_cap: "blocker"

That's it — diffelens will now run four lenses in parallel on every review.

Extending a built-in prompt

For built-in lenses, you can append project-specific rules without replacing the entire prompt:

lenses:
  readability:
    prompt_append_file: "review-rules/readability-extra.md"

The content of readability-extra.md is appended to the built-in readability prompt.

Use case ideas

| Lens | Focus | |------|-------| | security | OWASP Top 10, secrets, input validation | | performance | N+1 queries, unnecessary re-renders, large bundle imports | | i18n | Hardcoded strings, locale-sensitive formatting, RTL issues | | accessibility | ARIA attributes, keyboard navigation, color contrast | | test_coverage | Missing test cases, boundary conditions, error paths | | migration_safety | Backward compatibility, rollback strategy, data loss risk |

See Local Mode Guide — Custom Prompts for full details.

Documentation

| Guide | Description | |-------|-------------| | Local Mode | CLI options, diff targets, custom prompts, convergence settings | | GitHub Actions | Workflow setup, secrets, state management, troubleshooting |

Contributing

git clone https://github.com/Mizune/diffelens.git
cd diffelens
npm install
npm test

# Run from source
npx tsx src/main.ts --diff-target branch