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

@acemarke/diffloupe

v0.1.0

Published

Understand your diffs before you merge them

Readme

DiffLoupe

Understand your diffs before you merge them.

The Problem

Reading diffs is hard. You're staring at fragments of code without the full picture, trying to reconstruct what the change actually does and whether it's correct.

Good code review requires a mental model of the existing system - understanding where features live, how components interact, what a change will impact. But diffs show you disconnected hunks across files, and you're left mentally stitching them together.

This problem gets worse with AI-generated code. When an AI assistant produces 50 files of changes, you can't just skim and approve. You need to understand what was built, verify it matches your intent, and catch the subtle issues that LLMs introduce.

The Solution

DiffLoupe uses AI to analyze diffs and tell you what they mean:

  • "What does this change do?" - Get a clear summary of purpose, scope, and affected areas
  • "What could go wrong?" - Surface risks with concrete evidence, not vague warnings
  • "Does it match my intent?" - Compare what you asked for against what was actually built

The key differentiator is intent alignment: provide your stated intent (commit message, PR description, or explicit description), and DiffLoupe compares it against what the code actually does. This surfaces scope creep, incomplete implementations, and mislabeled changes before they cause problems.

Features

  • Intent Derivation - Analyzes diffs to determine purpose, scope, and affected areas
  • Risk Assessment - Identifies potential issues with severity levels and concrete evidence
  • Intent Alignment - Compares stated intent vs derived intent to catch mismatches
  • Smart Context Loading - Includes sibling files and new file source to reduce false positives
  • Large Diff Handling - Automatic decomposition strategies (two-pass, flow-based) for big changes
  • GitHub PR Support - Analyze PRs directly using PR metadata as stated intent

Installation

npm install -g @acemarke/diffloupe

Requires Node.js 18+.

Configuration

Set your Anthropic API key as an environment variable:

export ANTHROPIC_API_KEY=sk-ant-api03-...

Add to your shell profile (~/.bashrc, ~/.zshrc) for persistence.

Quick Start

# Analyze staged changes
diffloupe analyze

# Analyze with your stated intent
diffloupe analyze --intent "Add rate limiting to API endpoints"

# Analyze a commit (uses commit message as intent)
diffloupe analyze commit:HEAD

# Analyze a GitHub PR (uses title + description as intent)
diffloupe pr 123

# Preview what will be sent to the LLM (no API call)
diffloupe summarize --stats

Commands

diffloupe analyze [target]

Analyze code changes with AI assistance.

Targets:

| Target | Description | |--------|-------------| | staged | Staged changes (default) | | unstaged | Unstaged working tree changes | | HEAD | All uncommitted changes | | branch:name | Compare current HEAD to branch | | commit:hash | Analyze a specific commit | | range:a..b | Analyze a commit range |

Options:

| Option | Description | |--------|-------------| | -i, --intent <text> | Describe the intent of the changes | | --intent-file <path> | Read intent from a file | | -v, --verbose | Show detailed output | | --json | Output results as JSON | | -C, --cwd <path> | Run in a different directory | | --strategy <name> | Force decomposition strategy (direct, two-pass, flow-based) | | --demo | Show example output without API call |

Intent sources (in priority order):

  1. --intent flag
  2. --intent-file contents
  3. Commit message (for commit: targets)
  4. Piped stdin

diffloupe pr <identifier>

Analyze a GitHub PR. Requires gh CLI to be installed and authenticated.

Identifier formats:

diffloupe pr 123                                    # PR in current repo
diffloupe pr owner/repo#123                         # Cross-repo PR
diffloupe pr https://github.com/owner/repo/pull/123 # Full URL

Options:

| Option | Description | |--------|-------------| | -R, --repo <owner/repo> | Specify repository | | -v, --verbose | Show detailed output | | --json | Output results as JSON |

The PR's title and description are automatically used as stated intent.

diffloupe summarize [target]

Preview diff formatting without running LLM analysis. Useful for debugging and understanding token usage.

Options:

| Option | Description | |--------|-------------| | --stats | Show only file list and token estimates | | --files-only | Show only file list | | --json | Output as JSON | | --no-tokens | Skip token estimates |

Output

DiffLoupe provides three types of analysis:

Derived Intent - What the change actually does:

  • Summary and purpose
  • Scope (feature, bugfix, refactor, etc.)
  • Affected areas
  • Suggested review order

Risk Assessment - Potential issues:

  • Severity (low, medium, high, critical)
  • Category (security, performance, error-handling, etc.)
  • Evidence from the actual code
  • Suggested mitigations

Intent Alignment (when stated intent provided):

  • Alignment level (aligned, partial, misaligned)
  • What matches between stated and actual
  • Mismatches, missing implementations, and unstated changes (scope creep)

How It Works

  1. Parse - Load and parse the git diff
  2. Classify - Tier files by importance (skip lock files, generated code)
  3. Gather Context - Load sibling files in touched directories
  4. Select Strategy - Choose decomposition approach based on diff size
  5. Analyze - Run intent derivation and risk assessment
  6. Align - Compare stated intent vs derived intent (if provided)

For large diffs, DiffLoupe automatically selects a decomposition strategy:

  • Direct - Small diffs analyzed in one pass
  • Two-pass - Medium diffs: quick overview, then deep-dive on flagged files
  • Flow-based - Large diffs: group files by logical flow, analyze each flow

Inspirations

DiffLoupe builds on ideas from several excellent tools:

  • LaReview - Flow-based grouping concept
  • GitHuman - Pre-commit review philosophy
  • Diffray - Validation patterns, confidence scoring
  • Critique - Prompt engineering principles
  • CodeRabbit - Incremental review patterns

Development

DiffLoupe is built with Bun and TypeScript, published as a Node.js-compatible package.

# Install dependencies
bun install

# Run in dev mode
bun run dev

# Run tests
bun test

# Type check
bun run typecheck

# Build for distribution
bun run build

Tech stack: Bun, TypeScript, TanStack AI, ArkType, Commander

License

MIT