Skip to content

🤖 AI-powered code review assistant with customizable prompts: enforce commit messages, branch names and code standards your way.

License

Notifications You must be signed in to change notification settings

AlexShan2008/review-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | 中文

ReviewCopilot Logo

ReviewCopilot

AI-powered code review assistant for GitHub with customizable rules and multi-provider support

CI Status codecov npm version Total Downloads License: MIT PRs Welcome


📋 Table of Contents


✨ Features

🤖 AI-Powered Reviews

  • OpenAI GPT models support
  • DeepSeek integration
  • Customizable review prompts
  • Multi-provider support

📝 Smart Rules

  • Commit message validation
  • Branch naming conventions
  • Custom review points
  • File pattern filtering

🔧 Easy Integration

  • GitHub Actions ready
  • GitLab CI (coming soon)
  • Environment-based config
  • Zero-config setup

🎯 Flexible & Secure

  • YAML configuration
  • Environment variables
  • Glob pattern filtering
  • Secure API key management

🚀 Quick Start

Get ReviewCopilot running in under 2 minutes:

# 1. Install
npm install -D review-copilot

# 2. Initialize
npx review-copilot init

# 3. Set your API key
echo "AI_API_KEY_DEEPSEEK=your-api-key" >> .env

# 4. Run review
npx review-copilot review

💡 Tip: DeepSeek is recommended for stability. OpenAI support is in beta.

🎯 What you get:

  • ✅ Automated code quality analysis
  • ✅ Security vulnerability detection
  • ✅ Performance optimization suggestions
  • ✅ Best practices enforcement
  • ✅ Direct PR comments integration

💭 Why ReviewCopilot?

⏰ Save Time

  • Instant feedback on code changes
  • Reduce manual review time by 60%
  • Focus on architecture, not syntax

🔧 Easy Setup

  • Zero configuration required
  • Works with existing CI/CD
  • Supports multiple AI providers

📈 Improve Quality

  • Consistent review standards
  • Catch issues early
  • Learn from AI suggestions

💰 Cost Effective

  • Reduce senior developer review time
  • DeepSeek: ~$0.001 per request
  • OpenAI: ~$0.01 per request

📦 Installation

Using npm

npm install -D review-copilot

Using pnpm

pnpm add -D review-copilot

Using yarn

yarn add -D review-copilot

⚙️ Configuration

Basic Setup

After running npx review-copilot init, you'll get a .review-copilot.yaml file:

providers:
  deepseek:
    enabled: true
    apiKey: ${AI_API_KEY_DEEPSEEK}
    model: deepseek-chat

rules:
  commitMessage:
    enabled: true
    pattern: '^(feat|fix|docs|style|refactor|test|chore|ci)(\\(.+\\))?: .{1,50}'
  
  branchName:
    enabled: true
    pattern: '^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+-.+'
  
  codeChanges:
    enabled: true
    filePatterns:
      - '**/*.{ts,tsx,js,jsx}'
      - '!**/dist/**'
      - '!**/node_modules/**'

Environment Variables

Create a .env file in your project root:

# Choose your AI provider
AI_API_KEY_DEEPSEEK=your-deepseek-api-key
AI_API_KEY_OPENAI=your-openai-api-key

Advanced Configuration

📖 Click to expand advanced configuration options
providers:
  openai:
    enabled: false
    apiKey: ${AI_API_KEY_OPENAI}
    model: gpt-4o-mini
    baseURL: https://api.openai.com/v1
  
  deepseek:
    enabled: true
    apiKey: ${AI_API_KEY_DEEPSEEK}
    model: deepseek-chat
    baseURL: https://api.deepseek.com/v1

customReviewPoints:
  - name: 'Security Check'
    prompt: 'Review code for potential security vulnerabilities, focusing on input validation, authentication, and data handling.'
  
  - name: 'Performance Review'
    prompt: 'Analyze code for performance bottlenecks, memory usage, and optimization opportunities.'
  
  - name: 'Accessibility Check'
    prompt: 'Review frontend code for accessibility compliance and best practices.'

rules:
  commitMessage:
    enabled: true
    pattern: '^(feat|fix|docs|style|refactor|test|chore|ci)(\\(.+\\))?: .{1,50}'
    prompt: 'Ensure commit messages follow Conventional Commits specification.'
  
  branchName:
    enabled: true
    pattern: '^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+-.+'
    prompt: 'Check if branch name follows the pattern: <type>/<ticket-id>-<description>'
  
  codeChanges:
    enabled: true
    filePatterns:
      - '**/*.{ts,tsx,js,jsx,py,java,go,rs}'
      - '!**/test/**'
      - '!**/tests/**' 
      - '!**/*.test.*'
      - '!**/*.spec.*'
      - '!**/dist/**'
      - '!**/build/**'
      - '!**/node_modules/**'
      - '!**/coverage/**'
    prompt: 'Review code changes focusing on code quality, potential bugs, performance, security, and best practices.'

🤖 AI Providers

DeepSeek (Recommended)

  • ✅ Stable and reliable
  • ✅ Cost-effective
  • ✅ Good code understanding
  • 🔑 Get your API key: DeepSeek Platform

OpenAI (Beta)

  • ⚠️ Beta support
  • ✅ High-quality reviews
  • ⚠️ Higher cost
  • 🔑 Get your API key: OpenAI Platform

🔧 Usage

Command Line

# Review current branch changes
npx review-copilot review

# Review specific pull request
npx review-copilot review --pr 123

# Initialize configuration
npx review-copilot init

# Show help
npx review-copilot --help

File Filtering

Control which files are reviewed using glob patterns:

filePatterns:
  # Include patterns
  - '**/*.{ts,tsx,js,jsx}'
  - '**/*.{py,java,go,rs}'
  
  # Exclude patterns
  - '!**/node_modules/**'
  - '!**/dist/**'
  - '!**/build/**'
  - '!**/*.test.*'
  - '!**/*.spec.*'

🏗️ CI/CD Integration

GitHub Actions

Create .github/workflows/review.yml:

name: Code Review

on:
  pull_request:
    types: [opened, synchronize]
  issue_comment:
    types: [created]

jobs:
  review:
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request' || contains(github.event.comment.body, '@review-copilot')
    
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      
      - uses: actions/setup-node@v4
        with:
          node-version: '18'
      
      - run: npm install -g review-copilot
      
      - name: Run Review
        env:
          AI_API_KEY_DEEPSEEK: ${{ secrets.AI_API_KEY_DEEPSEEK }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: review-copilot review

Repository Secrets

Add your API key to GitHub repository secrets:

  1. Go to SettingsSecrets and variablesActions
  2. Click New repository secret
  3. Name: AI_API_KEY_DEEPSEEK
  4. Value: Your DeepSeek API key

🔒 Security Note: Never commit API keys directly to your repository. Always use GitHub Secrets or environment variables.


📚 Examples

Manual Review Trigger

Comment @review-copilot on any pull request to trigger a manual review:

Mention Review

Automated PR Reviews

ReviewCopilot automatically reviews code changes and posts detailed feedback:

Review Comments

For complete setup instructions, see our examples directory.


🖼️ Screenshots

📸 Click to view more screenshots

Review Comment Example

ReviewCopilot Review Example

Manual Trigger Example

ReviewCopilot Mention Review Example

Live Example

See a real review comment: ReviewCopilot PR Review Example


🐛 Troubleshooting

🔧 Common Issues and Solutions

API Key Issues

# Error: No API key found
# Solution: Check your .env file
echo "AI_API_KEY_DEEPSEEK=your-key" >> .env

GitHub Actions Permissions

# Add to your workflow if needed
permissions:
  contents: read
  pull-requests: write
  issues: write

File Pattern Issues

# Make sure to escape special characters
filePatterns:
  - '**/*.{ts,tsx}' # ✅ Correct
  - '**/*.{ts,tsx}' # ❌ May cause issues without quotes

Common Error Messages

Error Solution
No changes detected Ensure you're in a git repository with changes
API key not found Check your .env file and environment variables
Rate limit exceeded Wait a moment and try again, or upgrade your API plan
File pattern error Verify your glob patterns in configuration

🤝 Contributing

We welcome contributions! Here's how you can help:

Development Setup

# Clone the repository
git clone https://github.com/AlexShan2008/review-copilot.git
cd review-copilot

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build the project
pnpm build

Ways to Contribute

  • 🐛 Report bugs by opening an issue
  • Suggest features or improvements
  • 📖 Improve documentation
  • 🔧 Submit pull requests
  • 🧪 Add test cases

Please read our Contributing Guide for detailed guidelines.


📊 Project Status

Current Status

  • GitHub integration: Fully supported
  • 🚧 GitLab integration: In development
  • DeepSeek provider: Stable
  • ⚠️ OpenAI provider: Beta (PRs welcome!)

🌟 Community & Support

GitHub stars GitHub forks GitHub issues

📞 Get Help


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤️ by the ReviewCopilot team

Report BugRequest Feature⭐ Star Us

About

🤖 AI-powered code review assistant with customizable prompts: enforce commit messages, branch names and code standards your way.

Resources

License

Contributing

Stars

Watchers

Forks