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

code-review-agent

v1.0.1

Published

AI-powered code review tool with GitHub integration

Readme

AI Code Reviewer

An intelligent, AI-powered code review tool that integrates seamlessly with GitHub and supports multiple AI providers (OpenAI, Anthropic). Perfect for organizations looking to maintain code quality standards across multiple repositories.

🚀 Features

  • Multi-AI Provider Support: Works with OpenAI GPT-4o and Anthropic Claude
  • GitHub Integration: Automatic PR comments, approvals, and status checks
  • Configurable Standards: Custom coding standards and review prompts
  • CLI & GitHub Actions: Local usage and CI/CD integration
  • Smart Filtering: Ignores irrelevant files and focuses on meaningful changes
  • Severity Levels: Categorizes issues by severity and type
  • Organization Ready: Reusable configurations across multiple repositories

📦 Installation

npm install -g code-review-agent

🎯 Quick Start

1. Initialize Configuration

ai-review init

This creates:

  • .ai-review.json - Main configuration
  • coding-standards.md - Your coding standards
  • review-prompt.md - AI review instructions

2. Set API Keys

export OPENAI_API_KEY="your-openai-key"
# OR
export ANTHROPIC_API_KEY="your-anthropic-key"

3. Review Code Changes

# Review current changes
ai-review review

# Review specific commits
ai-review review --base main --head feature-branch

🔧 Configuration

Basic Configuration (.ai-review.json)

{
  "aiProvider": "openai",
  "model": "gpt-4o",
  "maxTokens": 2000,
  "temperature": 0.3,
  "codingStandardsPath": "coding-standards.md",
  "reviewPromptPath": "review-prompt.md",
  "ignorePatterns": [
    "node_modules/**",
    "dist/**",
    "*.min.js"
  ],
  "severityThreshold": "medium",
  "autoApprove": false,
  "requireApprovalFor": ["error"]
}

Advanced Configuration Options

| Option | Description | Default | |--------|-------------|---------| | aiProvider | AI provider (openai or anthropic) | "openai" | | model | AI model to use | "gpt-4o" | | maxTokens | Maximum tokens per request | 2000 | | temperature | AI creativity (0-1) | 0.3 | | codingStandardsPath | Path to coding standards file | "coding-standards.md" | | reviewPromptPath | Path to review prompt file | "review-prompt.md" | | ignorePatterns | Files/patterns to ignore | [] | | severityThreshold | Minimum severity to report | "medium" | | autoApprove | Auto-approve if no issues | false | | requireApprovalFor | Severities that block approval | ["error"] |

🔗 GitHub Integration

GitHub Actions Setup

  1. Add the workflow file .github/workflows/ai-review.yml:
name: AI Code Review

on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  ai-code-review:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
      checks: write
      
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          
      - name: Install AI Code Reviewer
        run: npm install -g code-review-agent
        
      - name: Run AI Code Review
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        run: |
          ai-review github-action \
            --owner ${{ github.repository_owner }} \
            --repo ${{ github.event.repository.name }} \
            --pr ${{ github.event.pull_request.number }}
  1. Add your AI provider API key to repository secrets:
    • OPENAI_API_KEY for OpenAI
    • ANTHROPIC_API_KEY for Anthropic

Manual GitHub Integration

export GITHUB_TOKEN="your-github-token"
ai-review github-action --owner myorg --repo myrepo --pr 123

📋 Coding Standards

Create a coding-standards.md file to define your project's standards:

# Coding Standards

## General Guidelines
- Write clean, readable, and maintainable code
- Follow consistent naming conventions
- Add meaningful comments and documentation

## Security
- Validate all inputs
- Use parameterized queries
- Never commit secrets

## Performance
- Optimize for readability first
- Profile before optimizing
- Use appropriate data structures

🎯 Review Categories

The AI reviewer categorizes issues into:

  • 🏗️ Code Quality: Structure, patterns, best practices
  • 🔒 Security: Vulnerabilities, input validation, data exposure
  • ⚡ Performance: Efficiency, scalability, resource usage
  • 🧹 Maintainability: Complexity, error handling, documentation
  • 🎨 Style: Formatting, naming conventions, consistency
  • 🧪 Testing: Coverage, test quality, edge cases
  • 📚 Documentation: Comments, README, API docs

💻 CLI Commands

ai-review review

Review code changes locally.

ai-review review [options]

Options:
  -b, --base <sha>     Base commit SHA
  -h, --head <sha>     Head commit SHA
  -c, --config <path>  Path to config file
  --no-github          Skip GitHub integration

ai-review init

Initialize configuration files.

ai-review init [options]

Options:
  --config-only  Only create config file

ai-review github-action

Run in GitHub Actions mode.

ai-review github-action [options]

Options:
  --owner <owner>      Repository owner (required)
  --repo <repo>        Repository name (required)
  --pr <number>        Pull request number (required)
  -c, --config <path>  Path to config file

🏢 Organization Setup

1. Create Organization Config Repository

my-org-standards/
├── .ai-review.json
├── coding-standards.md
├── review-prompt.md
└── README.md

2. Reference in Projects

{
  "aiProvider": "openai",
  "codingStandardsPath": "../my-org-standards/coding-standards.md",
  "reviewPromptPath": "../my-org-standards/review-prompt.md"
}

3. Shared GitHub Action

Create a reusable workflow in .github/workflows/ai-review.yml:

name: Reusable AI Review
on:
  workflow_call:
    secrets:
      OPENAI_API_KEY:
        required: true

jobs:
  review:
    uses: my-org/standards/.github/workflows/ai-review.yml@main
    secrets:
      OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

🔧 Programmatic Usage

import { ReviewEngine, ConfigLoader, GitHubClient } from 'code-review-agent';

// Load configuration
const config = await ConfigLoader.load();

// Review changes
const reviewEngine = new ReviewEngine(config);
const result = await reviewEngine.reviewChanges('main', 'feature-branch');

// Post to GitHub
const github = new GitHubClient(process.env.GITHUB_TOKEN);
await github.addReviewComments('owner', 'repo', 123, 'sha', result.comments);

🎨 Custom AI Providers

Extend the tool with your own AI provider:

import { BaseAIProvider } from 'code-review-agent';

class CustomProvider extends BaseAIProvider {
  name = 'Custom';
  
  async review(code: string, prompt: string, config: ReviewConfig): Promise<ReviewComment[]> {
    // Your implementation
  }
}

🐛 Troubleshooting

Common Issues

API Key Not Found

Error: OPENAI_API_KEY environment variable is required

Solution: Set your API key in environment variables.

Git Repository Not Found

Error: Failed to get git changes

Solution: Ensure you're in a git repository with proper permissions.

GitHub Token Permissions

Error: Failed to add review comments

Solution: Ensure your GitHub token has pull_requests: write permission.

Debug Mode

Enable verbose logging:

DEBUG=ai-review:* ai-review review

📄 License

MIT

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📞 Support