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

@brandongtr/rule-agent-cli

v1.0.1-beta.0

Published

A CLI tool to review git diffs against cursor rules using Claude Code

Downloads

11

Readme

Rule Agent CLI

A TypeScript CLI tool that reviews git diffs against cursor rules using Claude Code SDK.

Features

  • 🔍 Review git commits or unstaged changes against cursor rules
  • 📋 Auto-detects cursor rules from .cursorrules or .cursor/rules/*.mdc
  • 🤖 Uses Claude Code SDK for intelligent rule analysis
  • 📊 Provides violations, suggestions, and summaries for each file

Installation

From npm (Recommended)

# Install globally
npm install -g @brandongtr/rule-agent-cli

# Or use with npx (no installation required)
npx @brandongtr/rule-agent-cli rule-review --help

From Source

  1. Clone and install dependencies:
git clone https://github.com/brandongtr/rule-agent-cli.git
cd rule-agent-cli
npm install
  1. Set up environment variables:
cp .env.example .env
# Edit .env and add your ANTHROPIC_API_KEY
  1. Build the project:
npm run build

Usage

Basic Commands

# Review latest commit against auto-detected rules
rule-review rule-review

# Review specific file in latest commit
rule-review rule-review --file src/index.ts

# Review unstaged changes
rule-review rule-review --commit unstaged

# Use custom rules file
rule-review rule-review --rules .cursor/rules/typescript.mdc

# Combine options: review specific file in unstaged changes
rule-review rule-review -f src/utils/git.ts -c unstaged

# Review specific commit by hash
rule-review rule-review -c abc1234

# Review with custom rules and specific file
rule-review rule-review -r my-rules.md -f src/index.ts

Using with npx

# No installation required - run directly
npx @brandongtr/rule-agent-cli rule-review

# Review unstaged changes
npx @brandongtr/rule-agent-cli rule-review -c unstaged

# Review specific file
npx @brandongtr/rule-agent-cli rule-review -f src/index.ts

Command Line Options

| Flag | Long Form | Argument | Description | |------|-----------|----------|-------------| | -f | --file | <file> | Specific file to review (filters diff to single file) | | -c | --commit | <commit> | Git commit/reference to review (default: HEAD) | | -r | --rules | <rules> | Custom path to cursor rules file | | -h | --help | - | Display help information | | -V | --version | - | Display version number |

Special Commit Values

  • HEAD (default) - Review the latest commit
  • unstaged - Review uncommitted changes in working directory
  • <commit-hash> - Review specific commit by hash
  • <branch-name> - Review latest commit on specified branch

Cursor Rules Detection

The tool automatically detects cursor rules from:

  1. .cursorrules (traditional format)
  2. .cursor/rules/*.mdc (new Cursor IDE format)
  3. Custom path via -r option

Environment Variables

Required:

  • ANTHROPIC_API_KEY - Your Anthropic API key

Optional:

  • CLAUDE_MODEL - Claude model to use (default: claude-3-5-sonnet-20241022)
  • ANTHROPIC_BASE_URL - API base URL (default: https://api.anthropic.com)

Development

# Run in development mode
npm run dev

# Build TypeScript
npm run build

# Run built version
npm start

Example Output

🔍 Starting rule review...
📋 Loaded rules from: .cursor/rules/general.mdc
📄 Analyzing unstaged changes for src/index.ts
📊 Found 1 file(s) with changes

🔎 Analyzing: src/index.ts

📋 Results for src/index.ts:
❌ Rule Violations:
   1. Use of console.log in src/index.ts:8 violates the 'No console log' rule

💡 Suggestions:
   1. Remove console.log statement or replace with proper logging mechanism
   2. Use const/let instead of var for variable declaration
   3. Consider removing badFunction if not used

📝 Summary: The code changes introduce a function with a console.log statement that violates cursor rules. The function also uses outdated var declaration.

✨ Rule review completed!

Help Output

$ rule-review rule-review --help
Usage: rule-review rule-review [options]

Review git diffs against cursor rules

Options:
  -f, --file <file>      Specific file to review
  -c, --commit <commit>  Specific commit to review (default: HEAD)
  -r, --rules <rules>    Path to cursor rules file (default: .cursorrules)
  -h, --help             display help for command