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.
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
- Customizable Prompts — Markdown-based review guidelines
- 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_prompt.md— Customizable review guidelines
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
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, full_code
file_extensions_filter: [".cs", ".ts", ".py"]
max_diff_files: 50
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
By default, repository context is loaded on demand: the prompt includes the PR
diff, full changed-file contents, linked work item documentation, and a
repository manifest, then the model requests any extra files it needs. Set
review.project_context.mode: full to send the full eligible repository
snapshot instead. Bedrock uses a default estimated prompt budget of 180000
tokens; override it with llm.max_prompt_tokens if your model supports more or
less.
Development & Testing
This is a standard Python project with the following structure:
src/
ai_review.py # CLI entry point
config.py # Configuration management
llm_client.py # LLM provider abstraction
tfs_client.py # Azure DevOps integration
git_utils.py # Git diff processing
formatter.py # Output formatting (terminal, markdown, JSON)
tests/
test_*.py # Unit and integration tests
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/
VS Code Integration
Predefined tasks for quick execution in VS Code:
Available Tasks
- AI Review: Pull Request (Interactive)
- Interactive mode with main menu
- Run with:
Ctrl+Shift+B→ Select task
- AI Review: PR (Dry-Run)
- Dry-run for a specific PR
- Prompts for PR ID
- AI Review: List Active PRs
- Lists active PRs
- Quick diagnostics
- AI Review: Interactive Mode
- Full tool menu
- Runs in background
How to run tasks
In VS Code:
Ctrl+Shift+P→ "Tasks: Run Task"- Select the desired task
- Fill in parameters if needed
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.1.0.tar.gz.
File metadata
- Download URL: code_review_ai_cli-1.1.0.tar.gz
- Upload date:
- Size: 88.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb668825451cece28fa7add6699e656e836c40d0bfa4c889b5baf23756f4daad
|
|
| MD5 |
700903049735c5ea6c413e2f143d8b4c
|
|
| BLAKE2b-256 |
330fe1fb4c081b2a22020e278071ab9c3a35f12ed5faa4e0c3627e5e3060e3cd
|
File details
Details for the file code_review_ai_cli-1.1.0-py3-none-any.whl.
File metadata
- Download URL: code_review_ai_cli-1.1.0-py3-none-any.whl
- Upload date:
- Size: 66.3 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 |
98d25bce1dfa8447c6b292a2f460e080868ca8f3723af1ee4843f3476f9cac75
|
|
| MD5 |
7a536512c3a27e0dcea9055d6bf34e5d
|
|
| BLAKE2b-256 |
d5737806b7c7a6ad131dcda3e042951b1556a14684a2d6d123e907e498254af2
|