A community-driven registry for the Claude Code ecosystem. Not affiliated with Anthropic.
Are you the author? Sign in to claim
AI-powered code review CLI with multiple providers (Gemini, Claude, OpenAI). Features 95%+ token reduction via semantic
[!WARNING] This project is archived as of 2026-05-19. No further updates will be released.
AI Code Review has been succeeded by trusty-analyze — a deterministic static analysis daemon (Rust) that delivers reproducible results, zero API cost, and sub-millisecond query latency.
This repository and the
@bobmatnyc/ai-code-reviewnpm package remain available for cloning, downloading, and continued local use. Issues and pull requests are closed.See DEPRECATED.md for the full announcement, a detailed feature comparison, and a migration guide.
A TypeScript-based tool for automated code reviews using Google's Gemini AI models, Anthropic Claude models (including Claude 4), OpenAI models, and OpenRouter API with LangChain integration for enhanced prompt management.
.ai-code-review/config.yaml.gitignore patterns--skip-key-check to bypass API key validation on startupThe tool now follows a clear configuration hierarchy:
.ai-code-review/config.yaml).env.local, .env)$ ai-code-review .
🔑 Validating API key for OpenRouter...
❌ API key validation failed: Invalid API key
Options:
[1] Enter a new API key
[2] Switch to a different provider
[3] Continue anyway (review may fail)
[4] Exit
Select [1-4]: 1
Enter your OpenRouter API key: sk-or-v1-xxx...
🔑 Validating new API key...
✅ API key is valid!
Would you like to save this key for future use? (y/n): y
📁 Saved to .ai-code-review/config.yaml
Continuing with review...
--output-dir flag for custom review output locations.ai-code-review.yaml configuration files with automatic discovery--individual flag (single-file behavior is automatic based on target)-i as alias for --interactive mode for better user experienceFor detailed version history and release notes, see CHANGELOG.md.
--individual flag, enhanced user experienceany types with proper interfacesnpm run ci:local for pre-push validationRuby/Rails Support: Complete support for Ruby and Ruby on Rails projects
Enhanced Reviews: Added file list and comprehensive dependency security analysis
./scripts/fix-global-command.sh script to quickly resolve global installation issuesmodel-test) and verify all models on build
ai-code-review model-test gemini:gemini-2.5-proai-code-review model-test -p geminiai-code-review model-test --allai-code-review test-build--models flag to list all supported models with their configuration names--listmodels flag to display all available modelsThis tool analyzes code from specified files or directories in sibling projects and generates structured code evaluations. It leverages Google's Gemini AI models, Anthropic Claude models, and OpenRouter API to provide insightful feedback on code quality, best practices, and potential improvements. With support for multiple AI models, you can choose the best model for your specific needs.
--listmodels flag--estimate flagAI Code Review provides comprehensive support for multiple programming languages and frameworks with specialized analysis templates and automatic project detection.
| Language | Auto-Detection | Specialized Templates | Framework Support | Key Features |
|---|---|---|---|---|
| TypeScript | ✅ .ts, .tsx files | ✅ All review types | React, Next.js, Angular, Vue | Type system analysis, modern TS features |
| JavaScript | ✅ .js, .jsx files | ✅ All review types | React, Next.js, Vue, Node.js | ES6+, async patterns, framework-specific |
| Dart | ✅ .dart files, pubspec.yaml | ✅ All review types | Flutter | Null safety, async/await, widget optimization |
| Python | ✅ .py files, requirements.txt | ✅ All review types | Django, Flask, FastAPI | PEP compliance, async patterns, web frameworks |
| Ruby | ✅ .rb files, Gemfile | ✅ All review types | Ruby on Rails | Rails conventions, ActiveRecord, security |
| PHP | ✅ .php files, composer.json | ✅ All review types | Laravel, Symfony | Modern PHP, framework patterns, security |
| Go | ✅ .go files, go.mod | ✅ All review types | Gin, Echo, Fiber | Idiomatic Go, concurrency, performance |
| Java | ✅ .java files | ✅ Best practices | Spring, Spring Boot | Enterprise patterns, dependency injection |
| Rust | ✅ .rs files, Cargo.toml | ✅ Best practices | Actix, Rocket, Axum | Memory safety, ownership, async |
The tool automatically detects your project type based on:
| Detection Method | Files/Patterns | Confidence |
|---|---|---|
| Package Files | package.json, pubspec.yaml, Gemfile, composer.json, go.mod, Cargo.toml | High (0.9-1.0) |
| File Extensions | .dart, .ts, .py, .rb, .php, .go, .rs, .java | Medium (0.7-0.8) |
| Directory Structure | lib/ (Flutter), app/ (Rails), src/ (general) | Medium (0.6-0.7) |
| Framework Files | next.config.js, angular.json, django/settings.py | High (0.9) |
All languages support these review types with language-specific optimizations:
comprehensive - Complete analysis combining all review types ⭐ NEWquick-fixes - Language-specific syntax and best practicesarchitectural - Framework patterns and design principlessecurity - Language/framework-specific vulnerabilitiesperformance - Runtime optimization and efficiencybest-practices - Idiomatic code patterns and conventions# Automatic detection (recommended)
ai-code-review . --type comprehensive
# Flutter/Dart project
ai-code-review . --type comprehensive --language dart --framework flutter
# React/TypeScript project
ai-code-review src --type architectural --language typescript --framework react
# Rails application
ai-code-review app --type security --language ruby --framework rails
# Python Django project
ai-code-review . --type performance --language python --framework django
# Go web service
ai-code-review . --type best-practices --language go
⚠️ IMPORTANT: Never commit real API keys to your repository!
.env.local to your .gitignore fileyour_api_key_here)New to AI Code Review? Check out our Quick Start Guide for a 5-minute setup.
# Using pnpm (recommended)
pnpm add -g @bobmatnyc/ai-code-review
# Using npm (alternative)
npm install -g @bobmatnyc/ai-code-review
# Using pnpm (recommended)
pnpm add -D @bobmatnyc/ai-code-review
# Using npm (alternative)
npm install --save-dev @bobmatnyc/ai-code-review
Create a .env.local file in your project root with your API keys:
# Required: Model selection
AI_CODE_REVIEW_MODEL=gemini:gemini-2.5-pro
# or
# AI_CODE_REVIEW_MODEL=openrouter:anthropic/claude-3-opus
# or
# AI_CODE_REVIEW_MODEL=anthropic:claude-3-opus
# Required: API key for the selected model type
# For Google Gemini models
AI_CODE_REVIEW_GOOGLE_API_KEY=your_google_api_key_here
# For OpenRouter models (Claude, GPT-4, etc.)
AI_CODE_REVIEW_OPENROUTER_API_KEY=your_openrouter_api_key_here
# For direct Anthropic Claude models
AI_CODE_REVIEW_ANTHROPIC_API_KEY=your_anthropic_api_key_here
You can get API keys from:
# Global installation
ai-code-review [target] [options]
# Local installation with pnpm
pnpm exec ai-code-review [target] [options]
# Local installation with npm
npx ai-code-review [target] [options]
# Note: The tool only works within the current project
# If no target is specified, it defaults to the current directory (".")
AI Code Review now supports the Model Context Protocol (MCP), making it accessible through MCP-compatible AI assistants like Claude Desktop!
AI Code Review can now be used as a library in other Node.js applications! This is perfect for integrating code analysis into web applications, CI/CD pipelines, or other tools.
npm install @bobmatnyc/ai-code-review
import { performCodeReview, testModelConnection } from '@bobmatnyc/ai-code-review/lib';
// Perform a code review
const result = await performCodeReview({
target: './src',
config: {
model: 'openrouter:anthropic/claude-3.5-sonnet',
reviewType: 'security',
apiKeys: {
openrouter: 'your-api-key-here'
},
outputFormat: 'json'
},
options: {
maxFiles: 50,
onProgress: (progress) => {
console.log(`${progress.stage}: ${progress.progress}%`);
}
}
});
console.log('Review completed:', result);
import {
orchestrateReview,
createAIClient,
getAvailableModels,
validateLibraryConfig
} from '@bobmatnyc/ai-code-review/lib';
// Test model connection
const testResult = await testModelConnection('openrouter:anthropic/claude-3.5-sonnet');
if (!testResult.success) {
console.error('Model test failed:', testResult.error);
}
// Get available models
const models = getAvailableModels();
console.log('Available models:', models);
// Validate configuration
const config = { /* your config */ };
const validation = validateLibraryConfig(config);
if (!validation.valid) {
console.error('Config errors:', validation.errors);
}
Perfect for Next.js API routes, Express servers, or any Node.js web application:
// pages/api/review.ts (Next.js)
import { performCodeReview } from '@bobmatnyc/ai-code-review/lib';
export default async function handler(req, res) {
try {
const result = await performCodeReview({
target: req.body.target,
config: {
model: req.body.model,
apiKeys: {
openrouter: process.env.OPENROUTER_API_KEY
}
}
});
res.json(result);
} catch (error) {
res.status(500).json({ error: error.message });
}
}
# Start the MCP server
ai-code-review mcp
# Start with debug logging
ai-code-review mcp --debug
Configure Claude Desktop:
Add to your Claude Desktop configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"ai-code-review": {
"command": "ai-code-review",
"args": ["mcp"]
}
}
}
Available MCP Tools:
code-review - Comprehensive code analysis and reviewpr-review - Pull Request diff analysis and reviewgit-analysis - Git repository history and pattern analysisfile-analysis - Individual file analysis and metricsExample Usage in Claude:
📖 Complete MCP Integration Guide 📖 Web Integration Guide
# Review a single file in the current project
ai-code-review src/index.ts
# Review the current directory (two equivalent commands)
ai-code-review
ai-code-review .
# Review an entire directory with interactive mode
ai-code-review src/utils --interactive
# Perform an architectural review with file list and dependency security analysis
ai-code-review src --type architectural
# Review a Ruby on Rails application with Rails-specific analysis
ai-code-review app --type architectural --language ruby
# Find security vulnerabilities in a Rails application with package security analysis
ai-code-review app --type security
ai-code-review app/controllers --type security --language ruby
# Find unused code that can be safely removed
ai-code-review src --type unused-code
# Use specific review types
ai-code-review src --type focused-unused-code
ai-code-review src --type code-tracing-unused-code
ai-code-review src --type consolidated
ai-code-review src --type best-practices
ai-code-review src --type evaluation
ai-code-review src --type extract-patterns
ai-code-review src --type ai-integration
ai-code-review src --type cloud-native
ai-code-review src --type developer-experience
# Perform coding test evaluation with AI detection
ai-code-review ./candidate-submission --type coding-test --enable-ai-detection
# Advanced coding test with custom threshold and specific analyzers
ai-code-review ./submission --type coding-test \
--enable-ai-detection \
--ai-detection-threshold 0.8 \
--ai-detection-analyzers git,documentation
# Include test files in the review
ai-code-review src --include-tests
# Specify output format (markdown or json)
ai-code-review src/index.ts --output json
# Specify output directory for review results
ai-code-review src --output-dir ./reviews
# Use specific model
ai-code-review src --model anthropic:claude-4-sonnet
# List all available models
ai-code-review --listmodels
# List all supported models with their configuration names
ai-code-review --models
# Test a specific model
ai-code-review model-test gemini:gemini-2.5-pro
# Test all models for a specific provider
ai-code-review model-test --provider anthropic
# Test all available models
ai-code-review model-test --all
# Estimate token usage and cost without performing a review
ai-code-review src/utils --estimate
# Skip confirmation for multi-pass reviews
ai-code-review src/utils --no-confirm
# Use multi-pass review for large codebases
ai-code-review src --multi-pass
# Force single-pass review
ai-code-review src --force-single-pass
# Test API connections before review
ai-code-review src --test-api
# Enable interactive mode
ai-code-review src --interactive
# Check the version of the tool
ai-code-review --version
# Show version information
ai-code-review --show-version
# Run in debug mode for additional logging
ai-code-review src/utils --debug
# Specify programming language and framework
ai-code-review src --language typescript --framework next.js
# Use configuration file
ai-code-review src --config .ai-code-review.yaml
Options:
# Basic Options
-t, --type <type> Type of review (choices: quick-fixes, architectural, security, performance, unused-code, focused-unused-code, code-tracing-unused-code, consolidated, best-practices, evaluation, extract-patterns, coding-test, ai-integration, cloud-native, developer-experience) (default: "quick-fixes")
-o, --output <format> Output format (markdown, json) (default: "markdown")
--output-dir <dir> Directory to save review output
-m, --model <model> Model to use for the review (format: provider:model) (default: "gemini:gemini-2.5-pro")
-v, --version Output the current version
--show-version Show version information (default: false)
-h, --help Display help information
--debug Enable debug logging (default: false)
# Processing Options
--include-tests Include test files in the review (default: false)
--include-project-docs Include project documentation in the review context (default: true)
--include-dependency-analysis Include dependency analysis in the review (default: false)
--enable-semantic-chunking Enable semantic chunking for intelligent code analysis (default: true)
# Execution Options
-i, --interactive Run in interactive mode, processing review results in real-time (default: false)
--test-api Test API connections before running the review (default: false)
--estimate Estimate token usage and cost without performing the review (default: false)
# Multi-pass Options
--multi-pass Use multi-pass review for large codebases (default: false)
--force-single-pass Force single-pass review even if token analysis suggests multiple passes are needed (default: false)
--context-maintenance-factor Context maintenance factor for multi-pass reviews (0-1) (default: 0.15)
# Configuration Options
--no-confirm Skip confirmation prompts (default: false)
--language <language> Specify the programming language (auto-detected if not specified)
--framework <framework> Specify the framework (auto-detected if not specified)
--config <path> Path to JSON configuration file
# Model and Information Options
--listmodels List available models based on configured API keys (default: false)
--models List all supported models and their configuration names (default: false)
# API Key Options
--google-api-key <key> Google API key for Gemini models
--openrouter-api-key <key> OpenRouter API key
--anthropic-api-key <key> Anthropic API key for Claude models
--openai-api-key <key> OpenAI API key for GPT models
# AI Detection Options (for coding-test type)
--enable-ai-detection Enable AI-generated code detection (default: false)
--ai-detection-threshold <threshold> AI detection confidence threshold 0.0-1.0 (default: 0.7)
--ai-detection-analyzers <analyzers> Comma-separated list of analyzers: git,documentation,structural,statistical,linguistic (default: "git,documentation")
--ai-detection-include-in-report Include AI detection results in review report (default: true)
--ai-detection-fail-on-detection Automatically fail evaluation if AI-generated code detected (default: false)
Command: model-test
Description: Test AI models to verify API keys and model availability
Arguments:
[provider:model] Provider and model to test (e.g. gemini:gemini-2.5-pro, anthropic:claude-3-opus)
Options:
--all Test all available models
-p, --provider <provider> Test all models for a specific provider
-h, --help Display help information
Command: test-build
Description: Test the build by running a simple command
Options:
-h, --help Display help information
Review results are stored in the ai-code-review-docs/ directory. For consolidated reviews, the output follows this naming pattern:
ai-code-review-docs/[ai-model]-[review-type]-[file-or-directory-name]-[date].md
For example:
ai-code-review-docs/openai-gpt-4o-quick-fixes-review-src-2024-04-06.md
ai-code-review-docs/gemini-1.5-pro-architectural-review-src-utils-2024-04-06.md
When reviewing a single file, the output filename will include the specific file name:
ai-code-review-docs/[ai-model]-[review-type]-[file-name]-[date].md
Each review includes comprehensive metadata in a standardized format:
# Code Review: /path/to/reviewed/file
> **Review Type**: quick-fixes
> **Generated**: April 18, 2025, 3:45:27 PM
> **Reviewed**: /path/to/reviewed/file
---
## Metadata
| Property | Value |
|----------|-------|
| Review Type | quick-fixes |
| Generated At | April 18, 2025, 3:45:27 PM EDT |
| Model Provider | OpenAI |
| Model Name | gpt-4o |
| Input Tokens | 12,345 |
| Output Tokens | 2,456 |
| Total Tokens | 14,801 |
| Estimated Cost | $0.0295 |
| Tool Version | 2.1.1 |
| Command Options | --type=quick-fixes --output=markdown |
[Review content here...]
---
*Generated by Code Review Tool using OpenAI (gpt-4o)*
When using --output json, the review includes a structured metadata object:
{
"filePath": "/path/to/reviewed/file",
"reviewType": "quick-fixes",
"content": "...",
"timestamp": "2025-04-18T15:45:27.123Z",
"modelUsed": "openai:gpt-4o",
"toolVersion": "2.1.1",
"commandOptions": "--type=quick-fixes --output=json",
"meta": {
"model": {
"provider": "OpenAI",
"name": "gpt-4o",
"fullName": "OpenAI (gpt-4o)"
},
"review": {
"type": "quick-fixes",
"path": "/path/to/reviewed/file",
"generatedAt": "2025-04-18T15:45:27.123Z",
"formattedDate": "April 18, 2025, 3:45:27 PM EDT"
},
"cost": {
"inputTokens": 12345,
"outputTokens": 2456,
"totalTokens": 14801,
"estimatedCost": 0.0295,
"formattedCost": "$0.0295"
},
"tool": {
"version": "2.1.1",
"commandOptions": "--type=quick-fixes --output=json"
}
}
}
This enhanced metadata makes it easier to track and analyze reviews, understand the context in which they were generated, and reproduce the same review conditions if needed.
You can customize the review process in several ways:
The tool comes with built-in prompt templates in the prompts/templates/ directory:
quick-fixes-review.md - For quick fixes reviewssecurity-review.md - For security reviewsarchitectural-review.md - For architectural reviewsperformance-review.md - For performance reviewsYou can create your own prompt templates and use them with the --prompt flag. Custom templates should include metadata in YAML format at the top of the file:
---
name: Custom Security Review
description: A custom prompt template for security-focused code reviews
version: 1.0.0
author: Your Name
reviewType: security
language: typescript
tags: security, custom
---
# Security Code Review
Please review the following code for security vulnerabilities:
{{LANGUAGE_INSTRUCTIONS}}
## Output Format
Please provide your findings in the following format:
1. **Vulnerability**: Description of the vulnerability
2. **Severity**: High/Medium/Low
3. **Location**: File and line number
4. **Recommendation**: How to fix the issue
{{SCHEMA_INSTRUCTIONS}}
You can inject custom fragments into the prompt with the --prompt-fragment flag:
ai-code-review src/index.ts --prompt-fragment "Focus on performance issues"
You can also specify the position of the fragment with the --prompt-fragment-position flag (start, middle, or end):
ai-code-review src/index.ts --prompt-fragment "Focus on security issues" --prompt-fragment-position start
You can use model-specific prompt strategies with the --prompt-strategy flag:
ai-code-review src/index.ts --prompt-strategy anthropic
Available strategies:
anthropic - Optimized for Claude modelsgemini - Optimized for Gemini modelsopenai - Optimized for GPT modelslangchain - Uses LangChain for enhanced prompt managementThe LangChain strategy is particularly useful for complex reviews that benefit from:
# Use LangChain for an unused code review
ai-code-review src/utils --type unused-code --prompt-strategy langchain
# Use LangChain for quick fixes with enhanced prompts
ai-code-review src/components --type quick-fixes --prompt-strategy langchain
For multi-pass reviews and report consolidation, you can specify a separate model for the final report generation. This is useful for optimizing costs by using a more powerful model for code analysis and a cheaper/faster model for report writing.
There are two ways to specify a writer model:
Via Command Line:
# Use Claude Opus for analysis, Haiku for report writing
ai-code-review . --model anthropic:claude-3-opus --writer-model anthropic:claude-3-haiku
# Use GPT-4 for analysis, GPT-4o-mini for consolidation
ai-code-review . --model openai:gpt-4 --writer-model openai:gpt-4o-mini
Via Environment Variable:
# In your .env.local file
AI_CODE_REVIEW_MODEL=anthropic:claude-3-opus
AI_CODE_REVIEW_WRITER_MODEL=anthropic:claude-3-haiku
--model or AI_CODE_REVIEW_MODEL) performs the code analysis--writer-model or AI_CODE_REVIEW_WRITER_MODEL) consolidates the results into the final reportYou can sync GitHub projects to local directory for better project management:
# Sync GitHub projects to local directory
ai-code-review sync-github-projects --token <token> --org <org> --output-dir ./projects
ai-code-review code-review [target] - Run a code review on the specified target (default)ai-code-review mcp - Start the MCP (Model Context Protocol) server 🆕ai-code-review test-model - Test the configured model with a simple promptai-code-review test-build - Test the build by running a simple commandai-code-review sync-github-projects - Sync GitHub projects to local directoryai-code-review generate-config - Generate a sample configuration file--debug - Enable debug logging (default: false)--name <name> - Server name (default: "ai-code-review")--max-requests <number> - Maximum concurrent requests (default: 5)--timeout <number> - Request timeout in milliseconds (default: 300000)--token <token> - GitHub token [required]--org <org> - GitHub organization [required]--output-dir <dir> - Output directory (default: "./github-projects")-o, --output <path> - Output file path for the configuration-f, --format <format> - Configuration file format (choices: yaml, json) (default: "yaml")--force - Overwrite existing configuration file (default: false)Generate a sample configuration file:
# Generate YAML configuration
ai-code-review generate-config --output .ai-code-review.yaml --format yaml
# Generate JSON configuration
ai-code-review generate-config --output .ai-code-review.json --format json
All environment variables use the AI_CODE_REVIEW_ prefix:
# API Keys
AI_CODE_REVIEW_GOOGLE_API_KEY=your_google_api_key_here
AI_CODE_REVIEW_ANTHROPIC_API_KEY=your_anthropic_api_key_here
AI_CODE_REVIEW_OPENROUTER_API_KEY=your_openrouter_api_key_here
AI_CODE_REVIEW_OPENAI_API_KEY=your_openai_api_key_here
# Model Configuration
AI_CODE_REVIEW_MODEL=gemini:gemini-2.5-pro
AI_CODE_REVIEW_WRITER_MODEL=openai:gpt-4o-mini
# Debug Options
AI_CODE_REVIEW_LOG_LEVEL=info
When installed globally, you can use the setup script to create your .env.local file:
# If installed via pnpm
pnpm exec @bobmatnyc/ai-code-review/scripts/setup-env.js
# If installed via npm
npx @bobmatnyc/ai-code-review/scripts/setup-env.js
# If installed via Homebrew
node /opt/homebrew/lib/node_modules/@bobmatnyc/ai-code-review/scripts/setup-env.js
The script will guide you through setting up your API keys and will place the .env.local file in the correct directory.
If you're seeing errors about missing .env or .env.local files when running the globally installed tool, use this quick fix script:
# Download and run the fix script
curl -O https://raw.githubusercontent.com/bobmatnyc/ai-code-review/develop/scripts/global-env-fix.js
node global-env-fix.js
# You may need to run with sudo if permission errors occur
sudo node global-env-fix.js
This script will patch the global installation to avoid errors when environment files are missing and help you set up your API keys properly.
Alternatively, you can manually place your .env.local file in one of these locations:
If you installed via npm:
/path/to/global/node_modules/@bobmatnyc/ai-code-review/.env.local
If you installed via Homebrew:
/opt/homebrew/lib/node_modules/@bobmatnyc/ai-code-review/.env.local
Or, you can set the AI_CODE_REVIEW_DIR environment variable to specify the directory containing your .env.local:
export AI_CODE_REVIEW_DIR=/path/to/your/config/directory
Important: The tool first looks for
.env.localin its own installation directory, not in the target project being reviewed. This allows you to keep your API keys in one place and review any project without modifying it.
AI_CODE_REVIEW_MODEL=gemini:gemini-2.5-pro
AI_CODE_REVIEW_WRITER_MODEL=openai:gpt-4o-mini
AI_CODE_REVIEW_CONTEXT=README.md,docs/architecture.md,src/types.ts
> Note: For backward compatibility, the tool also supports the old `CODE_REVIEW` prefix for environment variables, but the `AI_CODE_REVIEW` prefix is recommended.
## Supported Models
### Model Mapping System
The tool uses a centralized model mapping system that automatically converts user-friendly model names to provider-specific API formats. This ensures that you can use consistent model names across different providers without worrying about the specific API requirements of each provider.
For example, when you specify `anthropic:claude-3-opus` as your model, the tool automatically maps this to the correct API model name `claude-3-opus-20240229` when making requests to the Anthropic API.
The model mapping system provides the following benefits:
- **Consistent Model Names**: Use the same model naming convention across all providers
- **Automatic API Format Conversion**: No need to remember provider-specific model formats
- **Centralized Configuration**: All model mappings are defined in a single location for easy maintenance
- **Extensible**: New models can be added easily without changing the core code
You can see all available models and their mappings by running `ai-code-review --listmodels`.
### Google Models
| Model Name | Description | Context Window | API Key Required |
|------------|-------------|----------------|------------------|
| `gemini:gemini-2.5-pro` | Production-ready advanced reasoning model **(DEFAULT)** | 1M tokens | `AI_CODE_REVIEW_GOOGLE_API_KEY` |
| `gemini:gemini-2.5-pro-preview` | Most advanced reasoning and multimodal capabilities | 1M tokens | `AI_CODE_REVIEW_GOOGLE_API_KEY` |
| `gemini:gemini-2.0-flash` | Fast, efficient model with strong performance | 1M tokens | `AI_CODE_REVIEW_GOOGLE_API_KEY` |
| `gemini:gemini-2.0-flash-lite` | Ultra-fast, cost-efficient model | 1M tokens | `AI_CODE_REVIEW_GOOGLE_API_KEY` |
| `gemini:gemini-1.5-pro` | Previous generation large context model | 1M tokens | `AI_CODE_REVIEW_GOOGLE_API_KEY` |
| `gemini:gemini-1.5-flash` | Previous generation fast model | 1M tokens | `AI_CODE_REVIEW_GOOGLE_API_KEY` |
### OpenRouter Models
| Model Name | Description | Context Window | API Key Required |
|------------|-------------|----------------|------------------|
| `openrouter:anthropic/claude-4-opus` | Access Claude 4 Opus through OpenRouter | 200K tokens | `AI_CODE_REVIEW_OPENROUTER_API_KEY` |
| `openrouter:anthropic/claude-4-sonnet` | Access Claude 4 Sonnet through OpenRouter | 200K tokens | `AI_CODE_REVIEW_OPENROUTER_API_KEY` |
| `openrouter:openai/gpt-4o` | Access GPT-4o through OpenRouter | 128K tokens | `AI_CODE_REVIEW_OPENROUTER_API_KEY` |
| `openrouter:google/gemini-2.5-pro` | Access Gemini 2.5 Pro through OpenRouter | 1M tokens | `AI_CODE_REVIEW_OPENROUTER_API_KEY` |
| `openrouter:meta-llama/llama-3.3-70b` | Open source alternative | 131K tokens | `AI_CODE_REVIEW_OPENROUTER_API_KEY` |
| `openrouter:anthropic/claude-3-haiku` | Fast, affordable model | 200K tokens | `AI_CODE_REVIEW_OPENROUTER_API_KEY` |
### Anthropic Models
| Model Name | Description | Context Window | API Key Required |
|------------|-------------|----------------|------------------|
| `anthropic:claude-4-opus` | Most capable Claude model with superior reasoning | 200K tokens | `AI_CODE_REVIEW_ANTHROPIC_API_KEY` |
| `anthropic:claude-4-sonnet` | Balanced performance and cost for code review | 200K tokens | `AI_CODE_REVIEW_ANTHROPIC_API_KEY` |
| `anthropic:claude-3.5-sonnet` | Enhanced Claude 3 with improved capabilities | 200K tokens | `AI_CODE_REVIEW_ANTHROPIC_API_KEY` |
| `anthropic:claude-3-opus` | DEPRECATED: Migrate to Claude 4 Opus | 200K tokens | `AI_CODE_REVIEW_ANTHROPIC_API_KEY` |
| `anthropic:claude-3-sonnet` | Previous generation balanced model | 200K tokens | `AI_CODE_REVIEW_ANTHROPIC_API_KEY` |
| `anthropic:claude-3.5-haiku` | Fast, cost-effective model | 200K tokens | `AI_CODE_REVIEW_ANTHROPIC_API_KEY` |
| `anthropic:claude-3-haiku` | DEPRECATED: Migrate to Claude 3.5 Haiku | 200K tokens | `AI_CODE_REVIEW_ANTHROPIC_API_KEY` |
### OpenAI Models
| Model Name | Description | Context Window | API Key Required |
|------------|-------------|----------------|------------------|
| `openai:gpt-4o` | Multimodal model with vision capabilities | 128K tokens | `AI_CODE_REVIEW_OPENAI_API_KEY` |
| `openai:gpt-4.1` | Latest GPT-4 with improved reasoning | 128K tokens | `AI_CODE_REVIEW_OPENAI_API_KEY` |
| `openai:gpt-4.5` | DEPRECATED: Migrate to GPT-4.1 | 128K tokens | `AI_CODE_REVIEW_OPENAI_API_KEY` |
| `openai:gpt-4-turbo` | Fast GPT-4 variant | 128K tokens | `AI_CODE_REVIEW_OPENAI_API_KEY` |
| `openai:gpt-3.5-turbo` | Fast, cost-effective model | 16K tokens | `AI_CODE_REVIEW_OPENAI_API_KEY` |
| `openai:o3` | Advanced reasoning model | 100K tokens | `AI_CODE_REVIEW_OPENAI_API_KEY` |
| `openai:o3-mini` | Efficient reasoning model | 60K tokens | `AI_CODE_REVIEW_OPENAI_API_KEY` |
### Extending the Model Mapping System
If you need to add support for a new model or update an existing model mapping, you can modify the `MODEL_MAP` in `src/clients/utils/modelMaps.ts`. The model mapping system uses a simple key-value structure where the key is the user-friendly model name (e.g., `anthropic:claude-3-opus`) and the value contains the API-specific details:
```typescript
export const MODEL_MAP: Record<string, ModelMapping> = {
'anthropic:claude-3-opus': {
apiName: 'claude-3-opus-20240229', // The actual API model name
displayName: 'Claude 3 Opus', // Human-readable name
provider: 'anthropic', // Provider identifier
contextWindow: 200000, // Context window size in tokens
description: 'Claude 3 Opus - Anthropic\'s most powerful model',
apiKeyEnvVar: 'AI_CODE_REVIEW_ANTHROPIC_API_KEY' // Required API key
},
// Add more models here...
};
After adding a new model mapping, you can use it by setting the AI_CODE_REVIEW_MODEL environment variable to the new model key.
The model mapping system provides several utility functions that you can use in your code:
// Get the API name for a model key
const apiName = getApiNameFromKey('anthropic:claude-3-opus');
// Returns: 'claude-3-opus-20240229'
// Get the full model mapping
const modelMapping = getModelMapping('anthropic:claude-3-opus');
// Returns: { apiName: 'claude-3-opus-20240229', displayName: 'Claude 3 Opus', ... }
// Get all models for a provider
const anthropicModels = getModelsByProvider('anthropic');
// Returns: ['anthropic:claude-3-opus', 'anthropic:claude-3-sonnet', ...]
// Parse a model string
const { provider, modelName } = parseModelString('anthropic:claude-3-opus');
// Returns: { provider: 'anthropic', modelName: 'claude-3-opus' }
// Get the full model key from provider and model name
const fullModelKey = getFullModelKey('anthropic', 'claude-3-opus');
// Returns: 'anthropic:claude-3-opus'
These utility functions make it easy to work with the model mapping system in your code.
The tool includes advanced AI detection capabilities specifically designed for coding test evaluations and hiring assessments. This feature analyzes code submissions to identify patterns that suggest AI assistance, helping maintain the integrity of technical assessments.
The AI detection system uses a multi-analyzer approach that examines various aspects of code submissions:
# Enable AI detection for coding tests
ai-code-review ./candidate-submission --type coding-test --enable-ai-detection
# Use AI detection with custom confidence threshold
ai-code-review ./submission --type coding-test \
--enable-ai-detection \
--ai-detection-threshold 0.8
# Specify which analyzers to use
ai-code-review ./submission --type coding-test \
--enable-ai-detection \
--ai-detection-analyzers git,documentation \
--ai-detection-threshold 0.7
# Fail evaluation automatically if AI is detected
ai-code-review ./submission --type coding-test \
--enable-ai-detection \
--ai-detection-fail-on-detection
# Include detailed AI detection results in report
ai-code-review ./submission --type coding-test \
--enable-ai-detection \
--ai-detection-include-in-report
| Parameter | Description | Default | Type |
|---|---|---|---|
--enable-ai-detection | Enable AI-generated code detection | false | boolean |
--ai-detection-threshold | Confidence threshold (0.0-1.0) for AI detection | 0.7 | number |
--ai-detection-analyzers | Comma-separated list of analyzers to use | git,documentation | string |
--ai-detection-include-in-report | Include AI detection results in the review report | true | boolean |
--ai-detection-fail-on-detection | Automatically fail if AI-generated code is detected | false | boolean |
High Confidence Patterns:
Medium Confidence Patterns:
Low Confidence Patterns:
# Strict evaluation for senior-level positions
ai-code-review ./candidate-submission --type coding-test \
--enable-ai-detection \
--ai-detection-threshold 0.6 \
--ai-detection-fail-on-detection
# Detailed analysis for code review positions
ai-code-review ./submission --type coding-test \
--enable-ai-detection \
--ai-detection-analyzers git,documentation \
--ai-detection-include-in-report
# Moderate threshold for student assessments
ai-code-review ./student-project --type coding-test \
--enable-ai-detection \
--ai-detection-threshold 0.75 \
--ai-detection-include-in-report
# Light detection for internal code reviews
ai-code-review ./feature-branch --type coding-test \
--enable-ai-detection \
--ai-detection-threshold 0.8
You can configure AI detection in your .ai-code-review.yaml file:
# .ai-code-review.yaml
reviewType: coding-test
enableAiDetection: true
aiDetectionThreshold: 0.7
aiDetectionAnalyzers: "git,documentation"
aiDetectionIncludeInReport: true
aiDetectionFailOnDetection: false
# Assignment configuration
assignment:
title: "Backend API Implementation"
difficulty: "mid"
type: "take-home"
timeLimit: 240
# Evaluation criteria
criteria:
correctness: 30
codeQuality: 25
architecture: 20
performance: 15
testing: 10
False Positives:
False Negatives:
# Enable debug logging for detailed analysis
ai-code-review ./submission --type coding-test \
--enable-ai-detection \
--debug
# Use multiple analyzers for comprehensive analysis
ai-code-review ./submission --type coding-test \
--enable-ai-detection \
--ai-detection-analyzers git,documentation,structural
# GitHub Actions example
name: Code Review with AI Detection
on: [pull_request]
jobs:
ai-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Important for git history analysis
- name: AI Code Review with Detection
run: |
npx @bobmatnyc/ai-code-review ./src \
--type coding-test \
--enable-ai-detection \
--ai-detection-threshold 0.8 \
--format json \
--output ai-review-results.json
- name: Check AI Detection Results
run: |
if grep -q '"isAIGenerated": true' ai-review-results.json; then
echo "::warning::AI-generated code detected"
exit 1
fi
#!/bin/bash
# Process multiple candidate submissions
for submission in ./candidates/*/; do
candidate=$(basename "$submission")
echo "Analyzing $candidate..."
ai-code-review "$submission" \
--type coding-test \
--enable-ai-detection \
--ai-detection-threshold 0.7 \
--format json \
--output "results/${candidate}-analysis.json"
done
# Generate summary report
echo "Generating summary report..."
node scripts/generate-summary-report.js results/
AI detection works best with:
The tool includes a powerful code tracing feature for identifying unused code with high confidence. This feature uses a multi-pass approach to analyze code dependencies and references, providing detailed evidence for each element identified as unused.
The code tracing feature follows a comprehensive approach:
To enable code tracing:
# Basic unused code detection
ai-code-review src --type unused-code
# Enhanced detection with deep code tracing
ai-code-review src --type unused-code --trace-code
Code tracing assigns confidence levels to each finding:
You can test your API connections to verify that your API keys are valid and working correctly:
# Test the configured model
ai-code-review test-model
# Test a specific model
ai-code-review test-model --model anthropic:claude-4-sonnet
# Test API connections before running a review
ai-code-review src --test-api
This will test connections to the configured API providers and provide detailed feedback on the status of each connection.
MIT
1000+ skills curated from Anthropic, Vercel, Stripe, and other engineering teams
Design enforcement with memory — keeps your UI consistent across a project
Universal SEO skill for Claude Code. 25 sub-skills + 18 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, bac
Route Claude Code traffic to any of 17 provider backends including free or local models