0.2.6 • Published 3 months ago

review-copilot v0.2.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

ReviewCopilot

CI Status codecov npm version Downloads License: MIT PRs Welcome

šŸ¤– AI-powered code review assistant that helps you maintain code quality with customizable rules.

Quick Start

  1. Install:
npm install -g review-copilot
  1. Initialize config:
review-copilot init
  1. Set your AI provider key in .env:
AI_API_KEY_OPENAI=your-key
# or
AI_API_KEY_DEEPSEEK=your-key
  1. Run review:
review-copilot review

Configuration

.review-copilot.yaml example:

# AI Provider Configuration
providers:
  openai:
    enabled: true
    apiKey: ${AI_API_KEY_OPENAI}
    model: gpt-4-turbo-preview
    baseURL: https://api.openai.com/v1

  deepseek:
    enabled: false
    apiKey: ${AI_API_KEY_DEEPSEEK}
    model: deepseek-chat
    baseURL: https://api.deepseek.com/v1

# Review Triggers
triggers:
  - on: pull_request
  - on: merge_request
  - on: push

# Code Review Rules
rules:
  # Review commit messages
  commitMessage:
    enabled: true
    pattern: '^(feat|fix|docs|style|refactor|test|chore|ci)(\\(.+\\))?: .{1,50}'
    prompt: |
      Review this commit message and ensure it follows conventional commits format.
      Format: <type>(<scope>): <description>
      Types: feat, fix, docs, style, refactor, test, chore, ci

  # Review branch names
  branchName:
    enabled: true
    pattern: '^(feature|bugfix|hotfix|release)/[A-Z]+-[0-9]+-.+'
    prompt: |
      Verify branch name follows the pattern:
      <type>/<ticket-id>-<description>
      Types: feature, bugfix, hotfix, release

  # Review code changes
  codeChanges:
    enabled: true
    filePatterns:
      - '**/*.{ts,tsx}'
      - '**/*.{js,jsx}'
      - '!**/dist/**'
      - '!**/node_modules/**'
    prompt: |
      Review the code changes for:
      1. Code style and formatting
      2. Potential bugs and issues
      3. Performance considerations
      4. Security vulnerabilities
      5. Best practices compliance

# Custom Review Points
customReviewPoints:
  - name: 'Security Check'
    prompt: 'Review code for security vulnerabilities...'
  - name: 'Performance Review'
    prompt: 'Analyze code for performance bottlenecks...'

Features

  • šŸ” AI-powered code review with multiple provider support
  • šŸ”„ Environment variable substitution in configuration
  • āœ… Conventional commit message validation
  • 🌿 Branch name pattern checking
  • šŸ“ Customizable review prompts
  • šŸŽÆ Flexible file pattern filtering
  • šŸ¤– Multiple AI providers (OpenAI, DeepSeek)
  • šŸ”’ Secure API key handling
  • šŸŽØ Beautiful CLI interface with progress indicators

File Filtering

Control which files to review using glob patterns:

filePatterns:
  - '**/*.ts' # Review all TypeScript files
  - '!**/test/**' # Ignore test files
  - '!**/dist/**' # Ignore build output
  - '!**/node_modules/**' # Ignore dependencies

AI Provider Configuration

You can configure multiple AI providers and enable the one you want to use:

providers:
  openai:
    enabled: true
    apiKey: ${AI_API_KEY_OPENAI}
    model: gpt-4-turbo-preview
    baseURL: https://api.openai.com/v1
    # Optional settings
    defaultHeaders:
      'X-Custom-Header': 'value'
    timeout: 60000

  deepseek:
    enabled: false
    apiKey: ${AI_API_KEY_DEEPSEEK}
    model: deepseek-chat
    baseURL: https://api.deepseek.com/v1

Environment Variables

The configuration supports environment variable substitution using ${VAR_NAME} syntax:

providers:
  openai:
    apiKey: ${AI_API_KEY_OPENAI}
    baseURL: ${OPENAI_API_BASE_URL}

CI/CD Integration

ReviewCopilot automatically detects CI environments (GitHub Actions, GitLab CI) and can post review comments directly on pull/merge requests.

License

MIT

0.2.6

3 months ago

0.2.5

3 months ago

0.2.4

4 months ago

0.2.3

4 months ago

0.2.2

4 months ago

0.2.1

4 months ago

0.2.0

4 months ago

0.1.0

4 months ago