AI-powered code review CLI - run locally or in CI/CD pipelines
npm install @oddessentials/odd-ai-reviewersAI-powered code review CLI that runs locally or in CI/CD pipelines. Get instant feedback on your code changes using LLMs like GPT-4 and Claude.
``bashRun local review on current changes
npx @oddessentials/odd-ai-reviewers .
Features
- Local Review Mode: Get instant AI feedback before pushing
- CI/CD Integration: GitHub Actions and Azure DevOps support
- Zero Configuration: Works out of the box with sensible defaults
- Multiple AI Providers: OpenAI, Anthropic, Azure OpenAI, Ollama
- Cost Control: Built-in budget limits and cost estimation
- Customizable: Configure passes, agents, and output formats
Prerequisites
- Node.js >= 22.0.0
- Git
- API key for your preferred AI provider
Environment Variables
Set one of these API keys:
`bash
OpenAI
export OPENAI_API_KEY=sk-...Anthropic
export ANTHROPIC_API_KEY=sk-ant-...Azure OpenAI
export AZURE_OPENAI_API_KEY=...
export AZURE_OPENAI_ENDPOINT=https://...
export AZURE_OPENAI_DEPLOYMENT=...Ollama (local)
export OLLAMA_BASE_URL=http://localhost:11434
`Usage
$3
`bash
Review uncommitted changes
ai-review .Review only staged changes (for pre-commit hooks)
ai-review . --stagedReview changes between current branch and main
ai-review . --base mainDry run - see what would be reviewed
ai-review . --dry-runCost estimate only
ai-review . --cost-onlyJSON output for tooling integration
ai-review . --format jsonSARIF output for IDE integration
ai-review . --format sarif
`$3
`bash
Review a specific commit range
ai-review review --repo . --base $BASE_SHA --head $HEAD_SHAWith PR number for GitHub integration
ai-review review --repo . --base $BASE_SHA --head $HEAD_SHA --pr 123
`$3
`bash
Generate a new configuration file
ai-review config initValidate existing configuration
ai-review validate --repo .
`Configuration File
Create
.ai-review.yml in your repository root:`yaml
AI Provider configuration
provider: openaiModel selection
models:
default: gpt-4o-miniReview passes
passes:
- name: ai-review
enabled: true
agents:
- opencodeResource limits
limits:
max_files: 50
max_diff_lines: 5000
max_usd_per_pr: 0.50Gating (fail CI on findings)
gating:
enabled: true
fail_on_severity: error
`CLI Reference
$3
Run AI review on local changes.
| Option | Description |
| ----------------- | --------------------------------------------- |
|
--base | Base reference for comparison (auto-detected) |
| --head | Head reference (default: HEAD) |
| --range | Git range (e.g., HEAD~3..) |
| --staged | Review only staged changes |
| --uncommitted | Include uncommitted changes (default: true) |
| --pass | Run specific pass only |
| --agent | Run specific agent only |
| --format | Output format: pretty, json, sarif |
| --no-color | Disable colored output |
| --quiet | Minimal output (errors only) |
| --verbose | Show debug information |
| --dry-run | Preview without running agents |
| --cost-only | Estimate cost without running |
| -c, --config | Path to config file |$3
| Code | Meaning |
| ---- | ---------------------------------------------- |
| 0 | Success (no blocking findings) |
| 1 | Failure (blocking findings or execution error) |
| 2 | Invalid arguments or configuration |
Pre-commit Hook Integration
Add to
.pre-commit-config.yaml:`yaml
repos:
- repo: local
hooks:
- id: ai-review
name: AI Code Review
entry: npx @oddessentials/odd-ai-reviewers . --staged --quiet
language: system
pass_filenames: false
`Or use with Husky:
`bash
.husky/pre-commit
npx @oddessentials/odd-ai-reviewers . --staged --quiet || exit 1
``This package uses semantic-release for automated versioning and changelog generation. The changelog is auto-generated from conventional commit messages.
See CHANGELOG.md for the full release history.
MIT