code-review-ai-cli 1.0.1__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- code_review_ai_cli-1.1.0/PKG-INFO +220 -0
- code_review_ai_cli-1.1.0/README.md +183 -0
- code_review_ai_cli-1.1.0/code_review_ai_cli.egg-info/PKG-INFO +220 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/code_review_ai_cli.egg-info/SOURCES.txt +3 -1
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/pyproject.toml +1 -1
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/src/ai_review.py +691 -32
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/src/config.py +157 -10
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/src/formatter.py +2 -2
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/src/llm_client.py +788 -58
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/src/prompts/config.yaml.template +86 -7
- code_review_ai_cli-1.1.0/src/tfs_client.py +1725 -0
- code_review_ai_cli-1.1.0/src/usage_tracker.py +364 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/tests/test_ai_review.py +306 -6
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/tests/test_config.py +115 -2
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/tests/test_llm_client.py +264 -11
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/tests/test_tfs_client.py +313 -1
- code_review_ai_cli-1.1.0/tests/test_usage_tracker.py +186 -0
- code_review_ai_cli-1.0.1/PKG-INFO +0 -418
- code_review_ai_cli-1.0.1/README.md +0 -381
- code_review_ai_cli-1.0.1/code_review_ai_cli.egg-info/PKG-INFO +0 -418
- code_review_ai_cli-1.0.1/src/tfs_client.py +0 -751
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/code_review_ai_cli.egg-info/dependency_links.txt +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/code_review_ai_cli.egg-info/entry_points.txt +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/code_review_ai_cli.egg-info/requires.txt +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/code_review_ai_cli.egg-info/top_level.txt +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/setup.cfg +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/src/__init__.py +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/src/git_utils.py +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/src/prompts/review_prompt.md.template +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/tests/test_formatter.py +0 -0
- {code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/tests/test_git_utils.py +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code-review-ai-cli
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Automated AI-powered code review CLI for Azure DevOps / TFS Pull Requests
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: code-review,ai,azure-devops,tfs,pull-request,llm
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: requests>=2.28.0
|
|
19
|
+
Requires-Dist: PyYAML>=6.0
|
|
20
|
+
Provides-Extra: bedrock
|
|
21
|
+
Requires-Dist: boto3>=1.34.0; extra == "bedrock"
|
|
22
|
+
Provides-Extra: openai
|
|
23
|
+
Requires-Dist: openai>=1.0.0; extra == "openai"
|
|
24
|
+
Provides-Extra: gemini
|
|
25
|
+
Requires-Dist: google-generativeai>=0.3.0; extra == "gemini"
|
|
26
|
+
Provides-Extra: claude
|
|
27
|
+
Requires-Dist: anthropic>=0.18.0; extra == "claude"
|
|
28
|
+
Provides-Extra: all
|
|
29
|
+
Requires-Dist: boto3>=1.34.0; extra == "all"
|
|
30
|
+
Requires-Dist: openai>=1.0.0; extra == "all"
|
|
31
|
+
Requires-Dist: google-generativeai>=0.3.0; extra == "all"
|
|
32
|
+
Requires-Dist: anthropic>=0.18.0; extra == "all"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=8.3.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
|
|
37
|
+
|
|
38
|
+
# AI Code Review CLI
|
|
39
|
+
|
|
40
|
+
Automated code review tool with Pull Request integration for Azure DevOps/TFS and support for multiple LLM providers.
|
|
41
|
+
**Documentation where** [docs/index.md](docs/index.md) for complete guides on CLI usage, LLM configuration, and architecture.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- **AI Pull Request Review** — Automated code analysis with configurable LLM providers
|
|
46
|
+
- **Structured Comments** — Inline suggestions + general summary comments
|
|
47
|
+
- **Dry-run Mode** — Validate reviews before posting
|
|
48
|
+
- **Multiple LLM Providers** — OpenAI, Azure OpenAI, Gemini, Claude, Ollama, GitHub Copilot, AWS Bedrock
|
|
49
|
+
- **Smart Filtering** — Filter by file extensions, limit diff size
|
|
50
|
+
- **Project-aware PR Context** — Sends repository and linked work item context while restricting findings to modified PR lines
|
|
51
|
+
- **Customizable Prompts** — Markdown-based review guidelines
|
|
52
|
+
- **Usage Tracking** — Store per-PR token usage and optional cost estimates
|
|
53
|
+
- **Interactive CLI** — Menu-driven selection and confirmation
|
|
54
|
+
|
|
55
|
+
## Installation & Quick Start
|
|
56
|
+
|
|
57
|
+
### 1. Install Package
|
|
58
|
+
|
|
59
|
+
From PyPI:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install code-review-ai-cli
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
With optional LLM SDK extras:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
|
|
69
|
+
pip install "code-review-ai-cli[openai]" # OpenAI SDK
|
|
70
|
+
pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
|
|
71
|
+
pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
|
|
72
|
+
pip install "code-review-ai-cli[all]" # All optional SDKs
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
For development:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install -r requirements.txt
|
|
79
|
+
pip install "code-review-ai-cli[dev]" # Test suite + linting
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Initialize Configuration
|
|
83
|
+
|
|
84
|
+
Generate config templates in your project directory:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
ai-review init
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Creates:
|
|
91
|
+
- `config.yaml` — LLM and review settings
|
|
92
|
+
- `review_prompt.md` — Customizable review guidelines
|
|
93
|
+
|
|
94
|
+
### 3. Run Your First Review
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# List active PRs
|
|
98
|
+
ai-review list-prs
|
|
99
|
+
|
|
100
|
+
# Review a specific PR
|
|
101
|
+
ai-review pr-review 42
|
|
102
|
+
|
|
103
|
+
# Dry-run (preview without posting)
|
|
104
|
+
ai-review pr-review 42 --dry-run
|
|
105
|
+
|
|
106
|
+
# Check stored token/cost usage
|
|
107
|
+
ai-review usage
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Configuration File
|
|
111
|
+
|
|
112
|
+
After `ai-review init`, edit `config.yaml`:
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
llm:
|
|
116
|
+
provider: bedrock # or: openai, gemini, claude, etc.
|
|
117
|
+
model: anthropic.claude-3-5-sonnet-20240620-v1:0
|
|
118
|
+
|
|
119
|
+
bedrock:
|
|
120
|
+
region: us-east-1
|
|
121
|
+
|
|
122
|
+
tfs:
|
|
123
|
+
base_url: https://dev.azure.com/your-org
|
|
124
|
+
project: YourProject
|
|
125
|
+
pat: xxxxxxxxx
|
|
126
|
+
|
|
127
|
+
review:
|
|
128
|
+
language: pt
|
|
129
|
+
verbosity: detailed # or: quick, security
|
|
130
|
+
scope: diff_with_context # diff_with_context, diff_only, full_code
|
|
131
|
+
file_extensions_filter: [".cs", ".ts", ".py"]
|
|
132
|
+
max_diff_files: 50
|
|
133
|
+
project_context:
|
|
134
|
+
enabled: true
|
|
135
|
+
mode: on_demand # on_demand, full
|
|
136
|
+
manifest_max_chars: 60000
|
|
137
|
+
retrieval_max_rounds: 2
|
|
138
|
+
retrieval_max_files: 20
|
|
139
|
+
retrieval_max_chars: 120000
|
|
140
|
+
retrieval_file_max_chars: 30000
|
|
141
|
+
work_item_context:
|
|
142
|
+
enabled: true
|
|
143
|
+
max_items: 20
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
By default, repository context is loaded on demand: the prompt includes the PR
|
|
147
|
+
diff, full changed-file contents, linked work item documentation, and a
|
|
148
|
+
repository manifest, then the model requests any extra files it needs. Set
|
|
149
|
+
`review.project_context.mode: full` to send the full eligible repository
|
|
150
|
+
snapshot instead. Bedrock uses a default estimated prompt budget of 180000
|
|
151
|
+
tokens; override it with `llm.max_prompt_tokens` if your model supports more or
|
|
152
|
+
less.
|
|
153
|
+
|
|
154
|
+
## Development & Testing
|
|
155
|
+
|
|
156
|
+
This is a standard Python project with the following structure:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
src/
|
|
160
|
+
ai_review.py # CLI entry point
|
|
161
|
+
config.py # Configuration management
|
|
162
|
+
llm_client.py # LLM provider abstraction
|
|
163
|
+
tfs_client.py # Azure DevOps integration
|
|
164
|
+
git_utils.py # Git diff processing
|
|
165
|
+
formatter.py # Output formatting (terminal, markdown, JSON)
|
|
166
|
+
|
|
167
|
+
tests/
|
|
168
|
+
test_*.py # Unit and integration tests
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Run Tests
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
python -m pytest --cov=src --cov-report=term
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Code Quality
|
|
178
|
+
|
|
179
|
+
Project follows PEP8 with Black formatter and Ruff linter:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Format code
|
|
183
|
+
black src/ tests/
|
|
184
|
+
|
|
185
|
+
# Lint
|
|
186
|
+
ruff check src/ tests/
|
|
187
|
+
|
|
188
|
+
# Type checking (if using mypy)
|
|
189
|
+
mypy src/
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## VS Code Integration
|
|
194
|
+
|
|
195
|
+
Predefined tasks for quick execution in VS Code:
|
|
196
|
+
|
|
197
|
+
### Available Tasks
|
|
198
|
+
|
|
199
|
+
1. **AI Review: Pull Request (Interactive)**
|
|
200
|
+
- Interactive mode with main menu
|
|
201
|
+
- Run with: `Ctrl+Shift+B` → Select task
|
|
202
|
+
|
|
203
|
+
2. **AI Review: PR (Dry-Run)**
|
|
204
|
+
- Dry-run for a specific PR
|
|
205
|
+
- Prompts for PR ID
|
|
206
|
+
|
|
207
|
+
3. **AI Review: List Active PRs**
|
|
208
|
+
- Lists active PRs
|
|
209
|
+
- Quick diagnostics
|
|
210
|
+
|
|
211
|
+
4. **AI Review: Interactive Mode**
|
|
212
|
+
- Full tool menu
|
|
213
|
+
- Runs in background
|
|
214
|
+
|
|
215
|
+
### How to run tasks
|
|
216
|
+
|
|
217
|
+
In VS Code:
|
|
218
|
+
1. `Ctrl+Shift+P` → "Tasks: Run Task"
|
|
219
|
+
2. Select the desired task
|
|
220
|
+
3. Fill in parameters if needed
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# AI Code Review CLI
|
|
2
|
+
|
|
3
|
+
Automated code review tool with Pull Request integration for Azure DevOps/TFS and support for multiple LLM providers.
|
|
4
|
+
**Documentation where** [docs/index.md](docs/index.md) for complete guides on CLI usage, LLM configuration, and architecture.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **AI Pull Request Review** — Automated code analysis with configurable LLM providers
|
|
9
|
+
- **Structured Comments** — Inline suggestions + general summary comments
|
|
10
|
+
- **Dry-run Mode** — Validate reviews before posting
|
|
11
|
+
- **Multiple LLM Providers** — OpenAI, Azure OpenAI, Gemini, Claude, Ollama, GitHub Copilot, AWS Bedrock
|
|
12
|
+
- **Smart Filtering** — Filter by file extensions, limit diff size
|
|
13
|
+
- **Project-aware PR Context** — Sends repository and linked work item context while restricting findings to modified PR lines
|
|
14
|
+
- **Customizable Prompts** — Markdown-based review guidelines
|
|
15
|
+
- **Usage Tracking** — Store per-PR token usage and optional cost estimates
|
|
16
|
+
- **Interactive CLI** — Menu-driven selection and confirmation
|
|
17
|
+
|
|
18
|
+
## Installation & Quick Start
|
|
19
|
+
|
|
20
|
+
### 1. Install Package
|
|
21
|
+
|
|
22
|
+
From PyPI:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install code-review-ai-cli
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
With optional LLM SDK extras:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
|
|
32
|
+
pip install "code-review-ai-cli[openai]" # OpenAI SDK
|
|
33
|
+
pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
|
|
34
|
+
pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
|
|
35
|
+
pip install "code-review-ai-cli[all]" # All optional SDKs
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For development:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install -r requirements.txt
|
|
42
|
+
pip install "code-review-ai-cli[dev]" # Test suite + linting
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Initialize Configuration
|
|
46
|
+
|
|
47
|
+
Generate config templates in your project directory:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
ai-review init
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Creates:
|
|
54
|
+
- `config.yaml` — LLM and review settings
|
|
55
|
+
- `review_prompt.md` — Customizable review guidelines
|
|
56
|
+
|
|
57
|
+
### 3. Run Your First Review
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# List active PRs
|
|
61
|
+
ai-review list-prs
|
|
62
|
+
|
|
63
|
+
# Review a specific PR
|
|
64
|
+
ai-review pr-review 42
|
|
65
|
+
|
|
66
|
+
# Dry-run (preview without posting)
|
|
67
|
+
ai-review pr-review 42 --dry-run
|
|
68
|
+
|
|
69
|
+
# Check stored token/cost usage
|
|
70
|
+
ai-review usage
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Configuration File
|
|
74
|
+
|
|
75
|
+
After `ai-review init`, edit `config.yaml`:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
llm:
|
|
79
|
+
provider: bedrock # or: openai, gemini, claude, etc.
|
|
80
|
+
model: anthropic.claude-3-5-sonnet-20240620-v1:0
|
|
81
|
+
|
|
82
|
+
bedrock:
|
|
83
|
+
region: us-east-1
|
|
84
|
+
|
|
85
|
+
tfs:
|
|
86
|
+
base_url: https://dev.azure.com/your-org
|
|
87
|
+
project: YourProject
|
|
88
|
+
pat: xxxxxxxxx
|
|
89
|
+
|
|
90
|
+
review:
|
|
91
|
+
language: pt
|
|
92
|
+
verbosity: detailed # or: quick, security
|
|
93
|
+
scope: diff_with_context # diff_with_context, diff_only, full_code
|
|
94
|
+
file_extensions_filter: [".cs", ".ts", ".py"]
|
|
95
|
+
max_diff_files: 50
|
|
96
|
+
project_context:
|
|
97
|
+
enabled: true
|
|
98
|
+
mode: on_demand # on_demand, full
|
|
99
|
+
manifest_max_chars: 60000
|
|
100
|
+
retrieval_max_rounds: 2
|
|
101
|
+
retrieval_max_files: 20
|
|
102
|
+
retrieval_max_chars: 120000
|
|
103
|
+
retrieval_file_max_chars: 30000
|
|
104
|
+
work_item_context:
|
|
105
|
+
enabled: true
|
|
106
|
+
max_items: 20
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
By default, repository context is loaded on demand: the prompt includes the PR
|
|
110
|
+
diff, full changed-file contents, linked work item documentation, and a
|
|
111
|
+
repository manifest, then the model requests any extra files it needs. Set
|
|
112
|
+
`review.project_context.mode: full` to send the full eligible repository
|
|
113
|
+
snapshot instead. Bedrock uses a default estimated prompt budget of 180000
|
|
114
|
+
tokens; override it with `llm.max_prompt_tokens` if your model supports more or
|
|
115
|
+
less.
|
|
116
|
+
|
|
117
|
+
## Development & Testing
|
|
118
|
+
|
|
119
|
+
This is a standard Python project with the following structure:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
src/
|
|
123
|
+
ai_review.py # CLI entry point
|
|
124
|
+
config.py # Configuration management
|
|
125
|
+
llm_client.py # LLM provider abstraction
|
|
126
|
+
tfs_client.py # Azure DevOps integration
|
|
127
|
+
git_utils.py # Git diff processing
|
|
128
|
+
formatter.py # Output formatting (terminal, markdown, JSON)
|
|
129
|
+
|
|
130
|
+
tests/
|
|
131
|
+
test_*.py # Unit and integration tests
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Run Tests
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
python -m pytest --cov=src --cov-report=term
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Code Quality
|
|
141
|
+
|
|
142
|
+
Project follows PEP8 with Black formatter and Ruff linter:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Format code
|
|
146
|
+
black src/ tests/
|
|
147
|
+
|
|
148
|
+
# Lint
|
|
149
|
+
ruff check src/ tests/
|
|
150
|
+
|
|
151
|
+
# Type checking (if using mypy)
|
|
152
|
+
mypy src/
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
## VS Code Integration
|
|
157
|
+
|
|
158
|
+
Predefined tasks for quick execution in VS Code:
|
|
159
|
+
|
|
160
|
+
### Available Tasks
|
|
161
|
+
|
|
162
|
+
1. **AI Review: Pull Request (Interactive)**
|
|
163
|
+
- Interactive mode with main menu
|
|
164
|
+
- Run with: `Ctrl+Shift+B` → Select task
|
|
165
|
+
|
|
166
|
+
2. **AI Review: PR (Dry-Run)**
|
|
167
|
+
- Dry-run for a specific PR
|
|
168
|
+
- Prompts for PR ID
|
|
169
|
+
|
|
170
|
+
3. **AI Review: List Active PRs**
|
|
171
|
+
- Lists active PRs
|
|
172
|
+
- Quick diagnostics
|
|
173
|
+
|
|
174
|
+
4. **AI Review: Interactive Mode**
|
|
175
|
+
- Full tool menu
|
|
176
|
+
- Runs in background
|
|
177
|
+
|
|
178
|
+
### How to run tasks
|
|
179
|
+
|
|
180
|
+
In VS Code:
|
|
181
|
+
1. `Ctrl+Shift+P` → "Tasks: Run Task"
|
|
182
|
+
2. Select the desired task
|
|
183
|
+
3. Fill in parameters if needed
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code-review-ai-cli
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Automated AI-powered code review CLI for Azure DevOps / TFS Pull Requests
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: code-review,ai,azure-devops,tfs,pull-request,llm
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: requests>=2.28.0
|
|
19
|
+
Requires-Dist: PyYAML>=6.0
|
|
20
|
+
Provides-Extra: bedrock
|
|
21
|
+
Requires-Dist: boto3>=1.34.0; extra == "bedrock"
|
|
22
|
+
Provides-Extra: openai
|
|
23
|
+
Requires-Dist: openai>=1.0.0; extra == "openai"
|
|
24
|
+
Provides-Extra: gemini
|
|
25
|
+
Requires-Dist: google-generativeai>=0.3.0; extra == "gemini"
|
|
26
|
+
Provides-Extra: claude
|
|
27
|
+
Requires-Dist: anthropic>=0.18.0; extra == "claude"
|
|
28
|
+
Provides-Extra: all
|
|
29
|
+
Requires-Dist: boto3>=1.34.0; extra == "all"
|
|
30
|
+
Requires-Dist: openai>=1.0.0; extra == "all"
|
|
31
|
+
Requires-Dist: google-generativeai>=0.3.0; extra == "all"
|
|
32
|
+
Requires-Dist: anthropic>=0.18.0; extra == "all"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=8.3.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
|
|
37
|
+
|
|
38
|
+
# AI Code Review CLI
|
|
39
|
+
|
|
40
|
+
Automated code review tool with Pull Request integration for Azure DevOps/TFS and support for multiple LLM providers.
|
|
41
|
+
**Documentation where** [docs/index.md](docs/index.md) for complete guides on CLI usage, LLM configuration, and architecture.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- **AI Pull Request Review** — Automated code analysis with configurable LLM providers
|
|
46
|
+
- **Structured Comments** — Inline suggestions + general summary comments
|
|
47
|
+
- **Dry-run Mode** — Validate reviews before posting
|
|
48
|
+
- **Multiple LLM Providers** — OpenAI, Azure OpenAI, Gemini, Claude, Ollama, GitHub Copilot, AWS Bedrock
|
|
49
|
+
- **Smart Filtering** — Filter by file extensions, limit diff size
|
|
50
|
+
- **Project-aware PR Context** — Sends repository and linked work item context while restricting findings to modified PR lines
|
|
51
|
+
- **Customizable Prompts** — Markdown-based review guidelines
|
|
52
|
+
- **Usage Tracking** — Store per-PR token usage and optional cost estimates
|
|
53
|
+
- **Interactive CLI** — Menu-driven selection and confirmation
|
|
54
|
+
|
|
55
|
+
## Installation & Quick Start
|
|
56
|
+
|
|
57
|
+
### 1. Install Package
|
|
58
|
+
|
|
59
|
+
From PyPI:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install code-review-ai-cli
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
With optional LLM SDK extras:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
|
|
69
|
+
pip install "code-review-ai-cli[openai]" # OpenAI SDK
|
|
70
|
+
pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
|
|
71
|
+
pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
|
|
72
|
+
pip install "code-review-ai-cli[all]" # All optional SDKs
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
For development:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install -r requirements.txt
|
|
79
|
+
pip install "code-review-ai-cli[dev]" # Test suite + linting
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Initialize Configuration
|
|
83
|
+
|
|
84
|
+
Generate config templates in your project directory:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
ai-review init
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Creates:
|
|
91
|
+
- `config.yaml` — LLM and review settings
|
|
92
|
+
- `review_prompt.md` — Customizable review guidelines
|
|
93
|
+
|
|
94
|
+
### 3. Run Your First Review
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# List active PRs
|
|
98
|
+
ai-review list-prs
|
|
99
|
+
|
|
100
|
+
# Review a specific PR
|
|
101
|
+
ai-review pr-review 42
|
|
102
|
+
|
|
103
|
+
# Dry-run (preview without posting)
|
|
104
|
+
ai-review pr-review 42 --dry-run
|
|
105
|
+
|
|
106
|
+
# Check stored token/cost usage
|
|
107
|
+
ai-review usage
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Configuration File
|
|
111
|
+
|
|
112
|
+
After `ai-review init`, edit `config.yaml`:
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
llm:
|
|
116
|
+
provider: bedrock # or: openai, gemini, claude, etc.
|
|
117
|
+
model: anthropic.claude-3-5-sonnet-20240620-v1:0
|
|
118
|
+
|
|
119
|
+
bedrock:
|
|
120
|
+
region: us-east-1
|
|
121
|
+
|
|
122
|
+
tfs:
|
|
123
|
+
base_url: https://dev.azure.com/your-org
|
|
124
|
+
project: YourProject
|
|
125
|
+
pat: xxxxxxxxx
|
|
126
|
+
|
|
127
|
+
review:
|
|
128
|
+
language: pt
|
|
129
|
+
verbosity: detailed # or: quick, security
|
|
130
|
+
scope: diff_with_context # diff_with_context, diff_only, full_code
|
|
131
|
+
file_extensions_filter: [".cs", ".ts", ".py"]
|
|
132
|
+
max_diff_files: 50
|
|
133
|
+
project_context:
|
|
134
|
+
enabled: true
|
|
135
|
+
mode: on_demand # on_demand, full
|
|
136
|
+
manifest_max_chars: 60000
|
|
137
|
+
retrieval_max_rounds: 2
|
|
138
|
+
retrieval_max_files: 20
|
|
139
|
+
retrieval_max_chars: 120000
|
|
140
|
+
retrieval_file_max_chars: 30000
|
|
141
|
+
work_item_context:
|
|
142
|
+
enabled: true
|
|
143
|
+
max_items: 20
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
By default, repository context is loaded on demand: the prompt includes the PR
|
|
147
|
+
diff, full changed-file contents, linked work item documentation, and a
|
|
148
|
+
repository manifest, then the model requests any extra files it needs. Set
|
|
149
|
+
`review.project_context.mode: full` to send the full eligible repository
|
|
150
|
+
snapshot instead. Bedrock uses a default estimated prompt budget of 180000
|
|
151
|
+
tokens; override it with `llm.max_prompt_tokens` if your model supports more or
|
|
152
|
+
less.
|
|
153
|
+
|
|
154
|
+
## Development & Testing
|
|
155
|
+
|
|
156
|
+
This is a standard Python project with the following structure:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
src/
|
|
160
|
+
ai_review.py # CLI entry point
|
|
161
|
+
config.py # Configuration management
|
|
162
|
+
llm_client.py # LLM provider abstraction
|
|
163
|
+
tfs_client.py # Azure DevOps integration
|
|
164
|
+
git_utils.py # Git diff processing
|
|
165
|
+
formatter.py # Output formatting (terminal, markdown, JSON)
|
|
166
|
+
|
|
167
|
+
tests/
|
|
168
|
+
test_*.py # Unit and integration tests
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Run Tests
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
python -m pytest --cov=src --cov-report=term
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Code Quality
|
|
178
|
+
|
|
179
|
+
Project follows PEP8 with Black formatter and Ruff linter:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Format code
|
|
183
|
+
black src/ tests/
|
|
184
|
+
|
|
185
|
+
# Lint
|
|
186
|
+
ruff check src/ tests/
|
|
187
|
+
|
|
188
|
+
# Type checking (if using mypy)
|
|
189
|
+
mypy src/
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## VS Code Integration
|
|
194
|
+
|
|
195
|
+
Predefined tasks for quick execution in VS Code:
|
|
196
|
+
|
|
197
|
+
### Available Tasks
|
|
198
|
+
|
|
199
|
+
1. **AI Review: Pull Request (Interactive)**
|
|
200
|
+
- Interactive mode with main menu
|
|
201
|
+
- Run with: `Ctrl+Shift+B` → Select task
|
|
202
|
+
|
|
203
|
+
2. **AI Review: PR (Dry-Run)**
|
|
204
|
+
- Dry-run for a specific PR
|
|
205
|
+
- Prompts for PR ID
|
|
206
|
+
|
|
207
|
+
3. **AI Review: List Active PRs**
|
|
208
|
+
- Lists active PRs
|
|
209
|
+
- Quick diagnostics
|
|
210
|
+
|
|
211
|
+
4. **AI Review: Interactive Mode**
|
|
212
|
+
- Full tool menu
|
|
213
|
+
- Runs in background
|
|
214
|
+
|
|
215
|
+
### How to run tasks
|
|
216
|
+
|
|
217
|
+
In VS Code:
|
|
218
|
+
1. `Ctrl+Shift+P` → "Tasks: Run Task"
|
|
219
|
+
2. Select the desired task
|
|
220
|
+
3. Fill in parameters if needed
|
{code_review_ai_cli-1.0.1 → code_review_ai_cli-1.1.0}/code_review_ai_cli.egg-info/SOURCES.txt
RENAMED
|
@@ -13,6 +13,7 @@ src/formatter.py
|
|
|
13
13
|
src/git_utils.py
|
|
14
14
|
src/llm_client.py
|
|
15
15
|
src/tfs_client.py
|
|
16
|
+
src/usage_tracker.py
|
|
16
17
|
src/prompts/config.yaml.template
|
|
17
18
|
src/prompts/review_prompt.md.template
|
|
18
19
|
tests/test_ai_review.py
|
|
@@ -20,4 +21,5 @@ tests/test_config.py
|
|
|
20
21
|
tests/test_formatter.py
|
|
21
22
|
tests/test_git_utils.py
|
|
22
23
|
tests/test_llm_client.py
|
|
23
|
-
tests/test_tfs_client.py
|
|
24
|
+
tests/test_tfs_client.py
|
|
25
|
+
tests/test_usage_tracker.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "code-review-ai-cli"
|
|
7
|
-
version = "1.0
|
|
7
|
+
version = "1.1.0"
|
|
8
8
|
description = "Automated AI-powered code review CLI for Azure DevOps / TFS Pull Requests"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|