Automated AI-powered code review CLI for Azure DevOps / TFS Pull Requests
Project description
AI Code Review CLI
Automated code review tool with Pull Request integration for Azure DevOps/TFS and support for multiple LLM providers. Documentation where docs/index.md for complete guides on CLI usage, LLM configuration, and architecture.
The CLI must be run from inside the local clone of the repository being reviewed.
Features
- AI Pull Request Review — Automated code analysis with configurable LLM providers
- Structured Comments — Inline suggestions + general summary comments
- Dry-run Mode — Validate reviews before posting
- Multiple LLM Providers — OpenAI, Azure OpenAI, Gemini, Claude, Ollama, GitHub Copilot, AWS Bedrock
- Smart Filtering — Filter by file extensions, limit diff size
- Project-aware PR Context — Sends repository and linked work item context while restricting findings to modified PR lines
- RAG Context — Enriches the review with related code snippets found via
git grepin the local repository - Single Reviewer Context — One Markdown context file with local override support
- Usage Tracking — Store per-PR token usage and optional cost estimates
- Interactive CLI — Menu-driven selection and confirmation
Installation & Quick Start
1. Install Package
From PyPI:
pip install code-review-ai-cli
With optional LLM SDK extras:
pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
pip install "code-review-ai-cli[openai]" # OpenAI SDK
pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
pip install "code-review-ai-cli[all]" # All optional SDKs
For development:
pip install -r requirements.txt
pip install "code-review-ai-cli[dev]" # Test suite + linting
2. Initialize Configuration
Generate config templates in your project directory:
ai-review init
Creates:
config.yaml— LLM and review settingsreview_context.example.md— Canonical example reviewer contextreview_context.local.md— Local reviewer context override, ignored by git.gitignoreentry forreview_context.local.md
Configuration File
After ai-review init, edit config.yaml:
llm:
provider: bedrock # or: openai, gemini, claude, etc.
model: anthropic.claude-3-5-sonnet-20240620-v1:0
bedrock:
region: us-east-1
tfs:
base_url: https://dev.azure.com/your-org
project: YourProject
pat: xxxxxxxxx
review:
language: pt
verbosity: detailed # or: quick, security
scope: diff_with_context # diff_with_context, diff_only
file_extensions_filter: [".cs", ".ts", ".py"]
max_diff_files: 50
max_comments_to_post: 20
custom_prompt_file: review_context.local.md
rag:
enabled: true # requires local branch == PR target
max_chars: 40000
project_context:
enabled: true
mode: on_demand # on_demand, full
manifest_max_chars: 60000
retrieval_max_rounds: 2
retrieval_max_files: 20
retrieval_max_chars: 120000
retrieval_file_max_chars: 30000
work_item_context:
enabled: true
max_items: 20
3. Run Your First Review
# List active PRs
ai-review list-prs
# Review a specific PR
ai-review pr-review 42
# Dry-run (preview without posting)
ai-review pr-review 42 --dry-run
# Check stored token/cost usage
ai-review usage
Run Tests
python -m pytest --cov=src --cov-report=term
Code Quality
Project follows PEP8 with Black formatter and Ruff linter:
# Format code
black src/ tests/
# Lint
ruff check src/ tests/
# Type checking (if using mypy)
mypy src/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_review_ai_cli-1.3.1.tar.gz.
File metadata
- Download URL: code_review_ai_cli-1.3.1.tar.gz
- Upload date:
- Size: 108.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e97c67da85a63eaa5c7a254702e96f2bf9406778ff03b40fdc9d3e1b71671eff
|
|
| MD5 |
85b907a5c8e35211cbc6b961faf53a46
|
|
| BLAKE2b-256 |
2dc092a9bd7d89bf1a8a769c8ce0df15b8acb2cc8f39400f75d0fd43e32cf669
|
File details
Details for the file code_review_ai_cli-1.3.1-py3-none-any.whl.
File metadata
- Download URL: code_review_ai_cli-1.3.1-py3-none-any.whl
- Upload date:
- Size: 79.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5b925bf2617587973e78d3ef1050beca67ce2d4dfe623db0b563ee97d6707ce
|
|
| MD5 |
31015c6193709321d5f1330fcc5966f7
|
|
| BLAKE2b-256 |
4ef034ffec8ac6da799acdfe607066c49b5d1979dc31e716d1fd364e861e8696
|