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

ai-commit-reviewer-pro

v1.1.5

Published

Enterprise-grade AI-powered commit reviewer with super-modern code analysis across 24+ programming languages. Detects security, performance, logic errors, suggests modern code replacements, identifies code simplification opportunities and optimization sug

Readme

🤖 AI Commit Reviewer Pro - Professional AI Code Review for Git

The Ultimate Free AI Code Reviewer for Git Commits
Intelligent code analysis powered by GitHub Copilot or ChatGPT/OpenAI - Choose your AI provider

npm version npm downloads License: MIT

ai-commit-reviewer-pro is a professional-grade AI-powered code review tool that analyzes Git commits before you push them to production. Get intelligent feedback from either GitHub Copilot or OpenAI's ChatGPT, with flexible provider selection to suit your workflow.

✨ Why Choose AI Commit Reviewer Pro?

🎯 Dual AI Provider Support

  • GitHub Copilot - Enterprise-grade code analysis (for GitHub token users)
  • OpenAI/ChatGPT - Advanced language model reviews (for OpenAI API users)
  • Flexible Choice - Use whichever provider you have access to
  • Zero Lock-in - Switch providers anytime by changing env variables

🌍 Super-Modern Multi-Language Support

  • 24+ Programming Languages - JavaScript, TypeScript, Python, Ruby, Go, Rust, PHP, Java, C++, C#, Swift, Kotlin, Scala, SQL, HTML, CSS, SCSS, JSON, YAML, and more!
  • Shopify Liquid Templates - Native support for template language analysis
  • Language Auto-Detection - Automatically detects file type and applies language-specific patterns
  • Unified Analysis - Same powerful review logic across all languages

🚀 Developer Experience

  • Instant AI Feedback - Get code review suggestions in seconds
  • 🎨 Beautiful CLI - Cross-platform terminal interface (Windows, Mac, Linux)
  • 🔒 Non-Blocking - Never prevents commits even when AI is unavailable
  • 📂 Smart Editor Integration - Auto-open files at error locations
  • 🔧 Zero Configuration - Works out of the box
  • 💡 Production-Ready - Used by developers worldwide
  • 🎯 Emoji Severity Indicators - Instantly see critical vs. informational issues

📊 Comprehensive Code Analysis (40+ Modern Patterns)

  • Security Scanning (8 patterns) - Hardcoded secrets, eval(), XSS, injection risks
  • Performance Optimization (7 patterns) - N+1 queries, DOM caching, array method optimization
  • Modern Code Patterns (8 patterns) - var→const/let, loose equality, promise chains, optional chaining
  • Code Optimization (5 patterns) - Loop refactoring, early returns, ternary operators, array methods
  • Code Refactoring (4 patterns) - Large blocks (500+ chars), function parameters, complex conditions
  • Liquid Template Support (3 patterns) - Complex logic simplification, nested loops
  • Low-Code Opportunities (2 patterns) - Dependency review, conditional mapping
  • Python Patterns (2 patterns) - Logging, exception handling
  • Error Detection (6 patterns) - Undeclared variables, redeclaration, deprecated features
  • Code Quality (3 patterns) - TODO/FIXME comments, disabled linters
  • Architecture Patterns (3 patterns) - Large classes, function complexity, deeply nested logic
  • Unused Code Detection (3 patterns) - Dead code, unused imports/functions

🎯 Key Features

Dual AI Provider Support - GitHub Copilot or OpenAI/ChatGPT
Super-Modern Code Analysis - 40+ pattern detections with modern code examples
Multi-Language Support - 24+ languages including Shopify Liquid
Intelligent Pre-commit Review - Analyzes staged code automatically
Code Simplification Detection - Identifies when 100 lines can be 20 with modern approaches
Modern Code Suggestions - Provides concrete examples of modern patterns
Security & Performance Focus - Detects all major vulnerability and optimization opportunities
Non-blocking Design - Commits always proceed, suggestions optional
Side-by-side Code Comparison - Visual original vs suggested improvements
Cross-platform Editor Integration - VS Code, Sublime Text, Vim
Smart Skip Directives - Production-ready validation bypass patterns
Graceful Fallback - Uses local analysis if AI unavailable
Zero Setup Hassle - Minimal configuration needed
Team-Friendly - Beautiful output, helpful feedback

📦 Installation

Option 1: Global Installation (Recommended)

npm install -g ai-commit-reviewer-pro
ai-review

Option 2: Local Project Installation

npm install ai-commit-reviewer-pro
npx ai-review

Option 3: Git Hook (Automatic on Every Commit)

# Create pre-commit hook
chmod +x .git/hooks/pre-commit
echo 'npx ai-commit-reviewer-pro' > .git/hooks/pre-commit

⚙️ Quick Setup - Choose Your AI Provider

Option A: GitHub Copilot (Enterprise Users)

  1. Create GitHub Personal Access Token

    • Go to https://github.com/settings/tokens
    • Click "Generate new token (classic)"
    • Add scopes: repo, gist, read:user
    • Copy your token
  2. Add Token to .env

    GITHUB_TOKEN=ghp_your_github_token_here
  3. Start Using

    ai-review

Option B: OpenAI/ChatGPT (Recommended for Advanced Features)

  1. Get OpenAI API Key

    • Go to https://platform.openai.com/api-keys
    • Create new secret key
    • Copy your API key
  2. Add Token to .env

    OPENAI_API_KEY=sk-your-openai-key-here
    OPENAI_MODEL=gpt-4o-mini
    OPENAI_MAX_TOKENS=1000
  3. Start Using

    ai-review

✅ Verify Setup

# Test your configuration
ai-review

# You should see: "🤖 GitHub Copilot integration enabled" or "🤖 OpenAI/ChatGPT integration enabled"

🎯 Usage Examples

1. Basic Usage - Get AI Code Review

# Stage your changes
git add .

# Get AI code review
ai-review

# If review passes, commit as usual
git commit -m "Add new feature"

2. Automated Pre-commit Hook

# Setup (one-time)
echo '#!/bin/sh\nnpx ai-commit-reviewer-pro' > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

# Now auto-reviewed on every commit
git commit -m "Your message"

3. Programmatic Usage

import { validateCommit } from 'ai-commit-reviewer-pro';

// Run AI review
await validateCommit();

4. CI/CD Integration

# GitHub Actions example
- name: AI Code Review
  run: npx ai-commit-reviewer-pro
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

📋 Example Output

🔍 Analyzing meaningful code changes...

🤖 ChatGPT Analysis Complete:

WORLD_CLASS_SUGGESTIONS
🚀 Production-Ready Code Improvements:

🟠 HIGH PRIORITY:
   📄 myfile.js:15 - Hardcoded API key detected (STAGED - will fix)
   📄 myfile.js:23 - Empty catch block - silently ignoring errors (STAGED - will fix)

🟡 RECOMMENDED:
   📄 myfile.js:8 - Console.log usage detected (INFO only)
   📄 myfile.js:34 - Traditional for loop can be optimized (STAGED - will fix)

COPILOT_FIXES
1. Move to process.env.API_KEY
2. Add error logging, re-throw, or handle gracefully
3. Consider proper logging (winston, pino) for production

AUTO_APPLICABLE_FIXES
File: myfile.js
Line 15: const apiKey = "sk-123456" → const apiKey = process.env.API_KEY
Line 23: catch(e) {} → catch (error) { console.error('Error occurred:', error); }

🔄 Configuration

Environment Variables

Create .env file in your project root:

# ============================================
# OPTION 1: GitHub Copilot
# ============================================
GITHUB_TOKEN=ghp_your_github_token_here

# ============================================
# OPTION 2: OpenAI / ChatGPT
# ============================================
OPENAI_API_KEY=sk-your-openai-key-here
OPENAI_MODEL=gpt-4o-mini
OPENAI_MAX_TOKENS=1000

# ============================================
# Optional Settings
# ============================================
API_TIMEOUT=30000
ENABLE_AI_FALLBACK=true
AI_AUTO_OPEN_ERRORS=false
AI_SHOW_CODE_COMPARISON=true
NODE_ENV=development

Configuration Options

| Variable | Type | Default | Description | |----------|------|---------|-------------| | GITHUB_TOKEN | string | - | GitHub Personal Access Token (Option 1) | | OPENAI_API_KEY | string | - | OpenAI API Key (Option 2) | | OPENAI_MODEL | string | gpt-4o-mini | ChatGPT model to use | | OPENAI_MAX_TOKENS | number | 1000 | Max tokens for OpenAI response | | API_TIMEOUT | number | 30000 | API request timeout (ms) | | ENABLE_AI_FALLBACK | boolean | true | Use local analysis if AI fails | | AI_AUTO_OPEN_ERRORS | boolean | false | Auto-open files at errors | | AI_SHOW_CODE_COMPARISON | boolean | true | Show side-by-side comparisons | | AI_OPTIONAL_MODE | boolean | false | Make review non-blocking | | AI_PROMPT_TIMEOUT_MS | number | 120000 | Interactive prompt timeout |

🔒 Security

Safe Token Handling

  • ✅ Never logs tokens to console
  • ✅ Tokens stay in .env files
  • ✅ No telemetry or data collection
  • ✅ Works offline with local fallback
  • ✅ MIT Licensed - open source code

Best Practices

  • 🔐 Store tokens in .env (add to .gitignore)
  • 🔄 Rotate tokens regularly
  • 🚫 Never commit .env files
  • 📝 Use minimal required token scopes
  • 🔒 Use environment-specific tokens for CI/CD

🌍 Global Usage

ai-commit-reviewer-pro supports developers worldwide:

  • 🌐 Multi-language - Works with any programming language
  • 🌍 International Teams - Supports diverse coding standards
  • ⚙️ Framework Agnostic - Node.js, Python, Go, Rust, Java, etc.
  • 🔧 Platform Independent - Windows, macOS, Linux
  • 💬 Multiple AI Providers - GitHub Copilot or OpenAI

📊 Performance Metrics

| Metric | Value | |--------|-------| | Average Review Time | 2-5 seconds | | Supported File Types | All text-based files | | Multi-language Support | 50+ languages | | API Cost | ~$0.01 per commit (OpenAI) | | Uptime | 99.9% (GitHub/OpenAI) | | Team Size | Unlimited |

🐛 Troubleshooting

"No AI provider configured"

# Solution: Add either token to .env
GITHUB_TOKEN=ghp_...  # OR
OPENAI_API_KEY=sk-...

"Invalid API Key"

# Solution: Verify your token/key
# GitHub: https://github.com/settings/tokens
# OpenAI: https://platform.openai.com/api-keys

"No staged changes found"

# Solution: Stage files first
git add .
ai-review

"Rate limit exceeded"

# Solution: Wait for limit reset (usually 1 hour)
# Or set SKIP_ON_RATE_LIMIT=true

📚 Full Documentation

For detailed setup, configuration, and advanced usage:

🤝 Contributing

Contributions welcome! Please see CONTRIBUTING.md

📄 License

MIT License - See LICENSE for details

🎯 Use Cases

For Individual Developers

  • ✅ Learn best practices from AI feedback
  • ✅ Catch bugs before pushing
  • ✅ Improve code quality automatically
  • ✅ Better commit messages

For Teams

  • ✅ Consistent code standards
  • ✅ Knowledge sharing through AI feedback
  • ✅ Reduce code review bottlenecks
  • ✅ Scale code quality across team

For Enterprises

  • ✅ GitHub Copilot integration for organizations
  • ✅ OpenAI for advanced team use
  • ✅ Production-ready reliability
  • ✅ Flexible provider options
  • ✅ Non-blocking workflow integration

🚀 Getting Started

# 1. Install globally
npm install -g ai-commit-reviewer-pro

# 2. Create .env with your AI provider
echo "GITHUB_TOKEN=your_token" > .env
# OR
echo "OPENAI_API_KEY=your_key" > .env

# 3. Stage and review code
git add .
ai-review

# 4. Commit with confidence!
git commit -m "Better code with AI review"

Made with ❤️ by developers for developers

🚀 Installation

Global Installation

npm install -g ai-commit-reviewer-pro

Local Installation

npm install ai-commit-reviewer-pro

⚙️ Configuration

1. GitHub Token Setup (Required for AI Code Review)

ai-commit-reviewer-pro uses GitHub's Copilot API for intelligent code analysis. You'll need a valid GitHub Personal Access Token with Copilot API access.

Step 1: Create GitHub Personal Access Token

  1. Go to GitHub Settings

  2. Token Configuration

    • Token name: ai-commit-reviewer-pro
    • Expiration: 90 days (or your preference)
    • Scopes to select:
      • repo (full control of private repositories)
      • gist (create gists)
      • read:user (read user profile data)
      • user:email (access email addresses)
  3. Generate & Save

    • Click "Generate token"
    • ⚠️ Important: Copy the token immediately (you won't see it again!)
    • Store it safely - you'll need it in the next step

Step 2: Configure Environment Variables

Create a .env file in your project root:

GITHUB_TOKEN=ghp_your_github_token_here

Full Configuration Example:

# GitHub Copilot API Token (REQUIRED)
GITHUB_TOKEN=ghp_your_personal_access_token

# Optional: AI Review Mode Settings
AI_OPTIONAL_MODE=true
AI_AUTO_OPEN_ERRORS=false
AI_PROMPT_TIMEOUT_MS=30000

Step 3: Verify Token Works

# Test your configuration
npm start

Environment Variables

| Variable | Required | Description | Default | |----------|----------|-------------|---------| | GITHUB_TOKEN | ✅ Required | GitHub Personal Access Token for Copilot API | - | | AI_OPTIONAL_MODE | 💡 Recommended | Make AI review non-blocking (allows commits even if review fails) | true | | AI_AUTO_OPEN_ERRORS | ❌ Optional | Auto-open files at error locations in your editor | false | | AI_DEFAULT_ON_CANCEL | ❌ Optional | Default action on prompt timeout | auto-apply | | AI_PROMPT_TIMEOUT_MS | ❌ Optional | Timeout for interactive prompts (milliseconds) | 30000 | | AI_AUTO_SELECT | ❌ Optional | Auto-respond in non-interactive mode | - | | AI_FORCE_PROMPT | ❌ Optional | Force prompts in non-TTY environments | false |

🎯 Non-Blocking Review Mode (Recommended)

Set AI_OPTIONAL_MODE=true in your .env file for the best development experience:

# Enable non-blocking AI review (recommended for teams)
AI_OPTIONAL_MODE=true
AI_AUTO_OPEN_ERRORS=true
GITHUB_TOKEN=ghp_your_github_token_here

Benefits of Non-Blocking Mode:

  • Never blocks commits - Commits always proceed (even if review fails)
  • 🤖 Smart suggestions - AI provides code improvement suggestions when available
  • 🌐 Network resilient - Works gracefully when API is unavailable
  • Fast commits - No waiting for AI analysis when in a hurry
  • 🔧 Intelligent fallback - Uses local analysis when remote review unavailable
  • 👥 Team-friendly - Doesn't disrupt development workflow

🎯 Usage

Command Line Interface

# Review staged changes
ai-review

Git Hook Integration

Option 1: Pre-commit Hook (Recommended)

Create .git/hooks/pre-commit:

#!/bin/sh
# Run AI Commit Reviewer Pro
npx ai-review

Make it executable:

chmod +x .git/hooks/pre-commit

Option 2: Manual Review Before Commit

# Stage your changes
git add .

# Run AI review
ai-review

# If review passes (or you approve), commit
git commit -m "Your commit message"

Option 3: Programmatic Usage

import { validateCommit } from 'ai-commit-reviewer-pro';

// Run AI review
await validateCommit();

🔄 Workflow

  1. Stage Changes: Add files to git staging area

    git add .
  2. AI Analysis: The validator automatically:

    • Analyzes your staged changes
    • Sends the diff to GitHub Copilot API for intelligent review
    • Receives professional code feedback
  3. Interactive Decision: Based on AI feedback, you can:

    • Apply suggestions - Make recommended changes
    • ⚠️ Skip with justification - Bypass with required reason
    • Cancel commit - Stop the commit process
  4. Commit: If validation passes or is bypassed, proceed with commit

📝 Example Output

🔍 Checking your staged changes...
🧠 Sending code diff to AI for review...

🤖 AI Review Feedback:

I found a few areas for improvement:

1. **Security Issue**: The API key is hardcoded in line 15. Consider using environment variables.
2. **Performance**: The loop in `processData()` could be optimized using `map()` instead of `forEach()`.
3. **Error Handling**: Missing try-catch block around the database query on line 23.

What do you want to do?
❯ Apply suggestions and continue
  Skip validation with comment
  Cancel commit

🎨 Features in Detail

AI-Powered Analysis

  • Code Quality: Identifies potential bugs, security issues, and performance problems
  • Best Practices: Suggests improvements following coding standards
  • Documentation: Recommends better comments and documentation
  • Refactoring: Suggests cleaner, more maintainable code patterns

Interactive Experience

  • Colored Output: Beautiful terminal interface with chalk.js
  • Progress Indicators: Clear feedback during AI processing
  • Smart Prompts: Contextual questions based on analysis results

Bypass Protection

  • Justification Required: Must provide reason when skipping suggestions
  • Audit Trail: Logs bypass reasons for team accountability
  • Configurable: Can be customized for team requirements

🛠️ Advanced Configuration

Custom AI Analysis

Modify the analysis settings in .env:

# Adjust timeout for slower networks
AI_PROMPT_TIMEOUT_MS=45000

# Enable auto-opening of files with errors
AI_AUTO_OPEN_ERRORS=true

# Keep AI review non-blocking (recommended)
AI_OPTIONAL_MODE=true

Custom Prompts

Customize the AI review prompt for your team's needs by creating a .aicommitrc.json:

{
  "customPrompt": "You are a code reviewer for our team. Focus on: security, performance, and maintainability according to our coding standards.",
  "rules": ["security", "performance", "readability"],
  "maxAnalysisTime": 30000
}

🔧 Troubleshooting

Common Issues

Error: No GitHub Token

Error: GITHUB_TOKEN not found

Solution: Ensure .env file exists with GITHUB_TOKEN=ghp_your_token. See GitHub Token Setup section.

Error: Invalid Token Scopes

Error: Token does not have required scopes

Solution: Regenerate your token with proper scopes: repo, gist, read:user, user:email

Error: No staged changes

⚠️ No staged changes found

Solution: Stage files first with git add .

Error: API Rate Limit

Error: GitHub API rate limit exceeded

Solution: Wait an hour for rate limit reset, or optimize your repository size.

Debug Mode

Enable debug logging:

# On Windows
set DEBUG=ai-commit-reviewer-pro:*
ai-review

# On macOS/Linux
DEBUG=ai-commit-reviewer-pro:* ai-review

📊 Performance

  • Average Analysis Time: 2-5 seconds
  • API Cost: ~$0.001-0.01 per commit (depending on change size)
  • Supported File Types: All text-based files (JS, TS, Python, etc.)

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Stage your changes: git add .
  4. Run AI review: ai-review
  5. Commit your changes: git commit -m "Add amazing feature"
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a pull request

See CONTRIBUTING.md for detailed guidelines.

📋 Requirements

  • Node.js: >= 12.0.0
  • Git: Any recent version
  • GitHub Token: Required for GitHub Copilot API access (free tier available)
  • Internet Connection: Required for AI code review (optional mode available for offline)

✅ Getting Started (5 Minutes)

1. Install Globally

npm install -g ai-commit-reviewer-pro

2. Generate GitHub Token (2 min)

Follow the GitHub Token Setup guide above.

3. Configure

# Create .env file in your project
echo "GITHUB_TOKEN=ghp_your_token_here" > .env

4. Start Using

# Review your staged changes
ai-review

That's it! You now have AI-powered code review. 🚀

📊 Use Cases

Perfect for:

  • 👥 Teams wanting automated code review
  • 🚀 CI/CD pipelines needing quality gates
  • 📈 Projects requiring consistent code standards
  • 🔐 Security-conscious development teams
  • 🌐 Remote teams needing async code review
  • 🎓 Learning best practices through AI feedback

Works with:

  • JavaScript/TypeScript projects
  • Python applications
  • Java, Go, Rust, and more
  • Any git repository
  • All platforms (Windows, macOS, Linux)

📜 License

MIT License - see LICENSE file for details.

👨‍💻 Author

Sanjib Roy

🙏 Acknowledgments

  • GitHub for providing Copilot API and powerful developer tools
  • The open-source community for excellent libraries and inspiration
  • All contributors and users of ai-commit-reviewer-pro

🔗 Related Projects

📈 Roadmap

  • [ ] Support for multiple AI providers (Claude, Gemini)
  • [ ] Team-specific rule customization
  • [ ] Integration with popular IDEs
  • [ ] Batch analysis for multiple commits
  • [ ] Custom rule engine
  • [ ] Performance metrics and analytics

👤 Author & Creator

Sanjib Roy

Full Stack Developer | Open Source Contributor | AI/DevOps Specialist

I'm passionate about building intelligent developer tools that transform how teams work with code. With deep expertise in Node.js, Python, and modern DevOps practices, I create production-grade open-source solutions that help developers write better code faster.

ai-commit-reviewer-pro represents my commitment to leveraging AI for code quality without disrupting your workflow.

🌟 What I Build

  • 🤖 AI-powered developer tools
  • 🔧 Production-ready npm packages
  • 🌐 Open-source solutions
  • 📊 DevOps automation platforms
  • 🚀 Code quality & workflow tools

🔗 Connect With Me

Professional Profiles:

📊 Stats & Expertise

  • Primary Languages: JavaScript/TypeScript, Python, Bash
  • Specialties: AI Integration, CI/CD Pipelines, Code Quality Tools
  • Focus Areas: Developer Experience, Automation, Open Source
  • Experience: Enterprise & startup development
  • Open Source: Multiple npm packages published

🎯 Mission

Creating developer tools that:

  • ✅ Improve code quality automatically
  • ✅ Never block your workflow
  • ✅ Integrate seamlessly with Git
  • ✅ Leverage latest AI capabilities
  • ✅ Work across all platforms
  • ✅ Remain production-grade & reliable

🤝 Contributing & Support

Found a bug or have a feature request? Please open an issue on GitHub.

Want to contribute? Check out CONTRIBUTING.md for guidelines.

Questions or partnerships? Reach out on LinkedIn or email me directly.


Crafting intelligent code review tools for teams worldwide 🚀

Made with ❤️ by Sanjib Roy | MIT License | GitHub | v3.15.1