xai-review 0.16.0__py3-none-any.whl → 0.18.0__py3-none-any.whl
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.
Potentially problematic release.
This version of xai-review might be problematic. Click here for more details.
- ai_review/services/vcs/github/client.py +4 -0
- xai_review-0.18.0.dist-info/METADATA +282 -0
- {xai_review-0.16.0.dist-info → xai_review-0.18.0.dist-info}/RECORD +7 -7
- xai_review-0.16.0.dist-info/METADATA +0 -303
- {xai_review-0.16.0.dist-info → xai_review-0.18.0.dist-info}/WHEEL +0 -0
- {xai_review-0.16.0.dist-info → xai_review-0.18.0.dist-info}/entry_points.txt +0 -0
- {xai_review-0.16.0.dist-info → xai_review-0.18.0.dist-info}/licenses/LICENSE +0 -0
- {xai_review-0.16.0.dist-info → xai_review-0.18.0.dist-info}/top_level.txt +0 -0
|
@@ -124,6 +124,10 @@ class GitHubVCSClient(VCSClient):
|
|
|
124
124
|
|
|
125
125
|
async def create_discussion(self, file: str, line: int, message: str) -> None:
|
|
126
126
|
try:
|
|
127
|
+
logger.info(
|
|
128
|
+
f"Posting inline comment in {self.owner}/{self.repo}#{self.pull_number} at {file}:{line}: {message}"
|
|
129
|
+
)
|
|
130
|
+
|
|
127
131
|
pr = await self.http_client.pr.get_pull_request(
|
|
128
132
|
owner=self.owner, repo=self.repo, pull_number=self.pull_number
|
|
129
133
|
)
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xai-review
|
|
3
|
+
Version: 0.18.0
|
|
4
|
+
Summary: AI-powered code review tool
|
|
5
|
+
Author-email: Nikita Filonov <nikita.filonov@example.com>
|
|
6
|
+
Maintainer-email: Nikita Filonov <nikita.filonov@example.com>
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: Issues, https://github.com/Nikita-Filonov/ai-review/issues
|
|
9
|
+
Project-URL: Homepage, https://github.com/Nikita-Filonov/ai-review
|
|
10
|
+
Project-URL: Repository, https://github.com/Nikita-Filonov/ai-review
|
|
11
|
+
Keywords: ai,code review,llm,openai,claude,gemini
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: typer
|
|
16
|
+
Requires-Dist: httpx
|
|
17
|
+
Requires-Dist: pyyaml
|
|
18
|
+
Requires-Dist: pytest
|
|
19
|
+
Requires-Dist: loguru
|
|
20
|
+
Requires-Dist: aiofiles
|
|
21
|
+
Requires-Dist: pydantic
|
|
22
|
+
Requires-Dist: pydantic-settings
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# AI Review
|
|
26
|
+
|
|
27
|
+
AI-powered code review tool.
|
|
28
|
+
|
|
29
|
+
[](https://github.com/Nikita-Filonov/ai-review/actions/workflows/workflow-test.yml)
|
|
30
|
+
[](https://codecov.io/gh/Nikita-Filonov/ai-review)
|
|
31
|
+
[](https://pypi.org/project/xai-review/)
|
|
32
|
+
[](./LICENSE)
|
|
33
|
+
[](https://github.com/Nikita-Filonov/ai-review/stargazers)
|
|
34
|
+
|
|
35
|
+
_Made with ❤️ by [@NikitaFilonov](https://t.me/sound_right)_
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 📑 Table of Contents
|
|
40
|
+
|
|
41
|
+
- ✨ [About](#-about)
|
|
42
|
+
- 🧪 [Live Preview](#-live-preview)
|
|
43
|
+
- 🚀 [Quick Start](#-quick-start)
|
|
44
|
+
- ⚙️ [️CI/CD Integration](#-cicd-integration)
|
|
45
|
+
- 🚀 [GitHub Actions](#-github-actions)
|
|
46
|
+
- 🚀 [GitLab CI/CD](#-gitlab-cicd)
|
|
47
|
+
- 📘 [Documentation](#-documentation)
|
|
48
|
+
- ⚠️ [Privacy & Responsibility Notice](#-privacy--responsibility-notice)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## ✨ About
|
|
53
|
+
|
|
54
|
+
**AI Review** is a developer tool that brings **AI-powered code review** directly into your workflow. It helps teams
|
|
55
|
+
improve code quality, enforce consistency, and speed up the review process.
|
|
56
|
+
|
|
57
|
+
✨ Key features:
|
|
58
|
+
|
|
59
|
+
- **Multiple LLM providers** — choose between **OpenAI**, **Claude**, and **Gemini**, or switch anytime.
|
|
60
|
+
- **VCS integration** — works out of the box with GitLab, GitHub (more providers coming).
|
|
61
|
+
- **Customizable prompts** — adapt inline, context, and summary reviews to match your team’s coding guidelines.
|
|
62
|
+
- **Flexible configuration** — supports `YAML`, `JSON`, and `ENV`, with seamless overrides in CI/CD pipelines.
|
|
63
|
+
- **AI Review runs fully client-side** — it never proxies or inspects your requests.
|
|
64
|
+
|
|
65
|
+
AI Review runs automatically in your CI/CD pipeline and posts both **inline comments** and **summary reviews** right
|
|
66
|
+
inside your merge requests. This makes reviews faster, more consistent, and less error-prone — while still leaving the
|
|
67
|
+
final decision to human reviewers.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 🧪 Live Preview
|
|
72
|
+
|
|
73
|
+
Curious how **AI Review** works in practice? Here are three real Pull Requests reviewed entirely by the tool — one per
|
|
74
|
+
mode:
|
|
75
|
+
|
|
76
|
+
| Mode | Description | Live Example |
|
|
77
|
+
|------------|----------------------------------------------------|-------------------------------------------------------------------------------|
|
|
78
|
+
| 🧩 Inline | Adds line-by-line comments directly in the diff | [Try AI Review (inline)](https://github.com/Nikita-Filonov/ai-review/pull/4) |
|
|
79
|
+
| 📄 Summary | Posts a concise summary review with key highlights | [Try AI Review (context)](https://github.com/Nikita-Filonov/ai-review/pull/5) |
|
|
80
|
+
| 🧠 Context | Performs broader analysis across multiple files | [Try AI Review (summary)](https://github.com/Nikita-Filonov/ai-review/pull/6) |
|
|
81
|
+
|
|
82
|
+
Each review was generated automatically via GitHub Actions using the corresponding mode:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
ai-review run-inline
|
|
86
|
+
ai-review run-summary
|
|
87
|
+
ai-review run-context
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 🚀 Quick Start
|
|
93
|
+
|
|
94
|
+
Install via **pip**:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install xai-review
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Or run directly via Docker:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
docker run --rm -v $(pwd):/app nikitafilonov/ai-review:latest run-summary
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
👉 Before running, create a basic configuration file [.ai-review.yaml](./docs/configs/.ai-review.yaml) in the root of
|
|
107
|
+
your project:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
llm:
|
|
111
|
+
provider: OPENAI
|
|
112
|
+
|
|
113
|
+
meta:
|
|
114
|
+
model: gpt-4o-mini
|
|
115
|
+
max_tokens: 1200
|
|
116
|
+
temperature: 0.3
|
|
117
|
+
|
|
118
|
+
http_client:
|
|
119
|
+
timeout: 120
|
|
120
|
+
api_url: https://api.openai.com/v1
|
|
121
|
+
api_token: ${OPENAI_API_KEY}
|
|
122
|
+
|
|
123
|
+
vcs:
|
|
124
|
+
provider: GITLAB
|
|
125
|
+
|
|
126
|
+
pipeline:
|
|
127
|
+
project_id: 1
|
|
128
|
+
merge_request_id: 100
|
|
129
|
+
|
|
130
|
+
http_client:
|
|
131
|
+
timeout: 120
|
|
132
|
+
api_url: https://gitlab.com
|
|
133
|
+
api_token: ${GITLAB_API_TOKEN}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
👉 This will:
|
|
137
|
+
|
|
138
|
+
- Run AI Review against your codebase.
|
|
139
|
+
- Generate inline and/or summary comments (depending on the selected mode).
|
|
140
|
+
- Use your chosen LLM provider (OpenAI GPT-4o-mini in this example).
|
|
141
|
+
|
|
142
|
+
> **Note:** Running `ai-review run` executes the full review (inline + summary).
|
|
143
|
+
> To run only one mode, use the dedicated subcommands:
|
|
144
|
+
> - ai-review run-inline
|
|
145
|
+
> - ai-review run-context
|
|
146
|
+
> - ai-review run-summary
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
AI Review can be configured via `.ai-review.yaml`, `.ai-review.json`, or `.env`. See [./docs/configs](./docs/configs)
|
|
151
|
+
for complete, ready-to-use examples.
|
|
152
|
+
|
|
153
|
+
Key things you can customize:
|
|
154
|
+
|
|
155
|
+
- **LLM provider** — OpenAI, Gemini, or Claude
|
|
156
|
+
- **Model settings** — model name, temperature, max tokens
|
|
157
|
+
- **VCS integration** — works out of the box with **GitLab** and **GitHub**.
|
|
158
|
+
- **Review policy** — which files to include/exclude, review modes
|
|
159
|
+
- **Prompts** — inline/context/summary prompt templates
|
|
160
|
+
|
|
161
|
+
👉 Minimal configuration is enough to get started. Use the full reference configs if you want fine-grained control (
|
|
162
|
+
timeouts, artifacts, logging, etc.).
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## ⚙️ CI/CD Integration
|
|
167
|
+
|
|
168
|
+
AI Review works out-of-the-box with major CI providers.
|
|
169
|
+
Use these snippets to run AI Review automatically on Pull/Merge Requests.
|
|
170
|
+
Each integration uses environment variables for LLM and VCS configuration.
|
|
171
|
+
|
|
172
|
+
> For full configuration details (timeouts, artifacts, logging, prompt overrides), see [./docs/configs](./docs/configs).
|
|
173
|
+
|
|
174
|
+
### 🚀 GitHub Actions
|
|
175
|
+
|
|
176
|
+
Add a workflow like this (manual trigger from **Actions** tab):
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
name: AI Review
|
|
180
|
+
on:
|
|
181
|
+
workflow_dispatch:
|
|
182
|
+
inputs:
|
|
183
|
+
review-command:
|
|
184
|
+
type: choice
|
|
185
|
+
default: run
|
|
186
|
+
options: [ run, run-inline, run-context, run-summary ]
|
|
187
|
+
pull-request-number:
|
|
188
|
+
type: string
|
|
189
|
+
required: true
|
|
190
|
+
jobs:
|
|
191
|
+
ai-review:
|
|
192
|
+
runs-on: ubuntu-latest
|
|
193
|
+
steps:
|
|
194
|
+
- uses: actions/checkout@v4
|
|
195
|
+
- uses: Nikita-Filonov/ai-review@v0.18.0
|
|
196
|
+
with:
|
|
197
|
+
review-command: ${{ inputs.review-command }}
|
|
198
|
+
env:
|
|
199
|
+
# --- LLM configuration ---
|
|
200
|
+
LLM__PROVIDER: "OPENAI"
|
|
201
|
+
LLM__META__MODEL: "gpt-4o-mini"
|
|
202
|
+
LLM__META__MAX_TOKENS: "15000"
|
|
203
|
+
LLM__META__TEMPERATURE: "0.3"
|
|
204
|
+
LLM__HTTP_CLIENT__API_URL: "https://api.openai.com/v1"
|
|
205
|
+
LLM__HTTP_CLIENT__API_TOKEN: ${{ secrets.OPENAI_API_KEY }}
|
|
206
|
+
|
|
207
|
+
# --- GitHub integration ---
|
|
208
|
+
VCS__PROVIDER: "GITHUB"
|
|
209
|
+
VCS__PIPELINE__OWNER: ${{ github.repository_owner }}
|
|
210
|
+
VCS__PIPELINE__REPO: ${{ github.event.repository.name }}
|
|
211
|
+
VCS__PIPELINE__PULL_NUMBER: ${{ inputs.pull-request-number }}
|
|
212
|
+
VCS__HTTP_CLIENT__API_URL: "https://api.github.com"
|
|
213
|
+
VCS__HTTP_CLIENT__API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
🔗 Full example: [./docs/ci/github.yaml](./docs/ci/github.yaml)
|
|
218
|
+
|
|
219
|
+
### 🚀 GitLab CI/CD
|
|
220
|
+
|
|
221
|
+
For GitLab users:
|
|
222
|
+
|
|
223
|
+
```yaml
|
|
224
|
+
ai-review:
|
|
225
|
+
when: manual
|
|
226
|
+
stage: review
|
|
227
|
+
image: nikitafilonov/ai-review:latest
|
|
228
|
+
rules:
|
|
229
|
+
- if: '$CI_MERGE_REQUEST_IID'
|
|
230
|
+
script:
|
|
231
|
+
- ai-review run
|
|
232
|
+
variables:
|
|
233
|
+
# --- LLM configuration ---
|
|
234
|
+
LLM__PROVIDER: "OPENAI"
|
|
235
|
+
LLM__META__MODEL: "gpt-4o-mini"
|
|
236
|
+
LLM__META__MAX_TOKENS: "15000"
|
|
237
|
+
LLM__META__TEMPERATURE: "0.3"
|
|
238
|
+
LLM__HTTP_CLIENT__API_URL: "https://api.openai.com/v1"
|
|
239
|
+
LLM__HTTP_CLIENT__API_TOKEN: "$OPENAI_API_KEY"
|
|
240
|
+
|
|
241
|
+
# --- GitLab integration ---
|
|
242
|
+
VCS__PROVIDER: "GITLAB"
|
|
243
|
+
VCS__PIPELINE__PROJECT_ID: "$CI_PROJECT_ID"
|
|
244
|
+
VCS__PIPELINE__MERGE_REQUEST_ID: "$CI_MERGE_REQUEST_IID"
|
|
245
|
+
VCS__HTTP_CLIENT__API_URL: "$CI_SERVER_URL"
|
|
246
|
+
VCS__HTTP_CLIENT__API_TOKEN: "$CI_JOB_TOKEN"
|
|
247
|
+
allow_failure: true # Optional: don't block pipeline if AI review fails
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
🔗 Full example: [./docs/ci/gitlab.yaml](./docs/ci/gitlab.yaml)
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 📘 Documentation
|
|
256
|
+
|
|
257
|
+
See these folders for reference templates and full configuration options:
|
|
258
|
+
|
|
259
|
+
- [./docs/ci](./docs/ci) — CI/CD integration templates (GitHub Actions, GitLab CI)
|
|
260
|
+
- [./docs/configs](./docs/configs) — full configuration examples (`.yaml`, `.json`, `.env`)
|
|
261
|
+
- [./docs/prompts](./docs/prompts) — prompt templates for Python/Go (light & strict modes)
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## ⚠️ Privacy & Responsibility Notice
|
|
266
|
+
|
|
267
|
+
AI Review does **not store**, **log**, or **transmit** your source code to any external service other than the **LLM
|
|
268
|
+
provider** explicitly configured in your `.ai-review.yaml`.
|
|
269
|
+
|
|
270
|
+
All data is sent **directly** from your CI/CD environment to the selected LLM API endpoint (e.g. OpenAI, Gemini,
|
|
271
|
+
Claude). No intermediary servers or storage layers are involved.
|
|
272
|
+
|
|
273
|
+
> ⚠️ Please ensure you use proper API tokens and avoid exposing corporate or personal secrets.
|
|
274
|
+
> If you accidentally leak private code or credentials due to incorrect configuration (e.g., using a personal key
|
|
275
|
+
> instead of an enterprise one), it is **your responsibility** — the tool does not retain or share any data by itself.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
🧠 **AI Review** — open-source AI-powered code reviewer
|
|
280
|
+
|
|
281
|
+
- 📦 [PyPI](https://pypi.org/project/xai-review/)
|
|
282
|
+
- 🐳 [DockerHub](https://hub.docker.com/r/nikitafilonov/ai-review)
|
|
@@ -124,7 +124,7 @@ ai_review/services/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
124
124
|
ai_review/services/vcs/factory.py,sha256=na1AOXgL9oUHqGIdRwT73BofxnkXEFnDr7fL3Sk_hkw,586
|
|
125
125
|
ai_review/services/vcs/types.py,sha256=o3CJ8bZJ8unB9AKSpS66NwPVkFkweV4R02nCYsNqCko,1270
|
|
126
126
|
ai_review/services/vcs/github/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
127
|
-
ai_review/services/vcs/github/client.py,sha256=
|
|
127
|
+
ai_review/services/vcs/github/client.py,sha256=ikW2YikslQm54U8e3yVfL3LizFmYbBzYa_FqkuDOajc,5634
|
|
128
128
|
ai_review/services/vcs/gitlab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
129
129
|
ai_review/services/vcs/gitlab/client.py,sha256=-ZZFFlB7vv2DgEYAU016FP4CcYO8hp5LY1E2xokuCmU,6140
|
|
130
130
|
ai_review/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -173,9 +173,9 @@ ai_review/tests/suites/services/review/policy/test_service.py,sha256=kRWT550OjWY
|
|
|
173
173
|
ai_review/tests/suites/services/review/summary/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
174
174
|
ai_review/tests/suites/services/review/summary/test_schema.py,sha256=xSoydvABZldHaVDa0OBFvYrj8wMuZqUDN3MO-XdvxOI,819
|
|
175
175
|
ai_review/tests/suites/services/review/summary/test_service.py,sha256=8UMvi_NL9frm280vD6Q1NCDrdI7K8YbXzoViIus-I2g,541
|
|
176
|
-
xai_review-0.
|
|
177
|
-
xai_review-0.
|
|
178
|
-
xai_review-0.
|
|
179
|
-
xai_review-0.
|
|
180
|
-
xai_review-0.
|
|
181
|
-
xai_review-0.
|
|
176
|
+
xai_review-0.18.0.dist-info/licenses/LICENSE,sha256=p-v8m7Kmz4KKc7PcvsGiGEmCw9AiSXY4_ylOPy_u--Y,11343
|
|
177
|
+
xai_review-0.18.0.dist-info/METADATA,sha256=OKCfkhU0YA7NGJjjNbMc066V1-5bmrv2ElgQsyNGoG4,9799
|
|
178
|
+
xai_review-0.18.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
179
|
+
xai_review-0.18.0.dist-info/entry_points.txt,sha256=JyC5URanMi5io5P_PXQf7H_I1OGIpk5cZQhaPQ0g4Zs,53
|
|
180
|
+
xai_review-0.18.0.dist-info/top_level.txt,sha256=sTsZbfzLoqvRZKdKa-BcxWvjlHdrpbeJ6DrGY0EuR0E,10
|
|
181
|
+
xai_review-0.18.0.dist-info/RECORD,,
|
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: xai-review
|
|
3
|
-
Version: 0.16.0
|
|
4
|
-
Summary: AI-powered code review tool
|
|
5
|
-
Author-email: Nikita Filonov <nikita.filonov@example.com>
|
|
6
|
-
Maintainer-email: Nikita Filonov <nikita.filonov@example.com>
|
|
7
|
-
License: Apache-2.0
|
|
8
|
-
Project-URL: Issues, https://github.com/Nikita-Filonov/ai-review/issues
|
|
9
|
-
Project-URL: Homepage, https://github.com/Nikita-Filonov/ai-review
|
|
10
|
-
Project-URL: Repository, https://github.com/Nikita-Filonov/ai-review
|
|
11
|
-
Keywords: ai,code review,llm,openai,claude,gemini
|
|
12
|
-
Requires-Python: >=3.11
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE
|
|
15
|
-
Requires-Dist: typer
|
|
16
|
-
Requires-Dist: httpx
|
|
17
|
-
Requires-Dist: pyyaml
|
|
18
|
-
Requires-Dist: pytest
|
|
19
|
-
Requires-Dist: loguru
|
|
20
|
-
Requires-Dist: aiofiles
|
|
21
|
-
Requires-Dist: pydantic
|
|
22
|
-
Requires-Dist: pydantic-settings
|
|
23
|
-
Dynamic: license-file
|
|
24
|
-
|
|
25
|
-
# AI Review
|
|
26
|
-
|
|
27
|
-
AI-powered code review tool.
|
|
28
|
-
|
|
29
|
-
_Made with ❤️ by [@NikitaFilonov](https://t.me/sound_right)_
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## 📑 Table of Contents
|
|
34
|
-
|
|
35
|
-
- 🚀 [Quick Start](#-quick-start)
|
|
36
|
-
- ⚙️ [Configuration](#-configuration)
|
|
37
|
-
- 🛠 [Advanced usage](#-advanced-usage)
|
|
38
|
-
- 📂 [Examples](#-examples)
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## 🚀 Quick Start
|
|
43
|
-
|
|
44
|
-
Install via **pip**:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
pip install xai-review
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Or run directly via Docker:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
docker run --rm -v $(pwd):/app nikitafilonov/ai-review:latest run-summary
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
👉 Before running, create a basic configuration file [.ai-review.yaml](./docs/configs/.ai-review.yaml) in the root of
|
|
57
|
-
your project:
|
|
58
|
-
|
|
59
|
-
```yaml
|
|
60
|
-
llm:
|
|
61
|
-
provider: OPENAI
|
|
62
|
-
|
|
63
|
-
meta:
|
|
64
|
-
model: gpt-4o-mini
|
|
65
|
-
max_tokens: 1200
|
|
66
|
-
temperature: 0.3
|
|
67
|
-
|
|
68
|
-
http_client:
|
|
69
|
-
timeout: 120
|
|
70
|
-
api_url: https://api.openai.com/v1
|
|
71
|
-
api_token: ${OPENAI_API_KEY}
|
|
72
|
-
|
|
73
|
-
vcs:
|
|
74
|
-
provider: GITLAB
|
|
75
|
-
|
|
76
|
-
pipeline:
|
|
77
|
-
project_id: 1
|
|
78
|
-
merge_request_id: 100
|
|
79
|
-
|
|
80
|
-
http_client:
|
|
81
|
-
timeout: 120
|
|
82
|
-
api_url: https://gitlab.com
|
|
83
|
-
api_token: ${GITLAB_API_TOKEN}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
👉 This will:
|
|
87
|
-
|
|
88
|
-
- Run AI Review against your codebase.
|
|
89
|
-
- Generate inline and/or summary comments (depending on the selected mode).
|
|
90
|
-
- Use your chosen LLM provider (e.g., OpenAI GPT-4o-mini by default in this example).
|
|
91
|
-
|
|
92
|
-
> **Note:** Running `ai-review run` executes the full review (inline + summary).
|
|
93
|
-
> To run only one mode, use the dedicated subcommands:
|
|
94
|
-
> - ai-review run-inline
|
|
95
|
-
> - ai-review run-summary
|
|
96
|
-
> - ai-review run-context
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
AI Review can be configured via `.ai-review.yaml`, `.ai-review.json`, or `.env`. See [./docs/configs](./docs/configs)
|
|
101
|
-
for complete, ready-to-use examples.
|
|
102
|
-
|
|
103
|
-
Key things you can customize:
|
|
104
|
-
|
|
105
|
-
- **LLM provider** — OpenAI, Gemini, or Claude
|
|
106
|
-
- **Model settings** — model name, temperature, max tokens
|
|
107
|
-
- **VCS integration** — GitLab (currently supported) with project/MR context
|
|
108
|
-
- **Review policy** — which files to include/exclude, review modes
|
|
109
|
-
- **Prompts** — inline/context/summary prompt templates
|
|
110
|
-
|
|
111
|
-
👉 Minimal configuration is enough to get started. Use the full reference configs if you want fine-grained control (
|
|
112
|
-
timeouts, artifacts, logging, etc.).
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## 🛠 Advanced usage
|
|
117
|
-
|
|
118
|
-
Below is the **full configuration reference** with all available options. Most projects only need a
|
|
119
|
-
minimal `.ai-review.yaml`, but you can use these templates as a starting point for advanced setups:
|
|
120
|
-
|
|
121
|
-
- [docs/configs/.ai-review.yaml](./docs/configs/.ai-review.yaml) — YAML configuration (with comments)
|
|
122
|
-
- [docs/configs/.ai-review.json](./docs/configs/.ai-review.json) — JSON configuration
|
|
123
|
-
- [docs/configs/.env.example](./docs/configs/.env.example) — environment variables example
|
|
124
|
-
|
|
125
|
-
👉 The YAML file includes comments for every option, making it the best place to explore the complete set of settings.
|
|
126
|
-
|
|
127
|
-
Below is an **example GitLab CI job** showing how to run AI Review with these variables:
|
|
128
|
-
|
|
129
|
-
```yaml
|
|
130
|
-
ai-review:
|
|
131
|
-
tags: [ build ]
|
|
132
|
-
when: manual
|
|
133
|
-
stage: checks
|
|
134
|
-
image: nikitafilonov/ai-review:latest
|
|
135
|
-
rules:
|
|
136
|
-
- if: '$CI_MERGE_REQUEST_IID'
|
|
137
|
-
script:
|
|
138
|
-
- ai-review run
|
|
139
|
-
variables:
|
|
140
|
-
# ===============================
|
|
141
|
-
# LLM provider & model
|
|
142
|
-
# ===============================
|
|
143
|
-
# Which LLM to use.
|
|
144
|
-
# Options: OPENAI | GEMINI | CLAUDE
|
|
145
|
-
LLM__PROVIDER: "OPENAI"
|
|
146
|
-
|
|
147
|
-
# --- Model metadata ---
|
|
148
|
-
# For OpenAI: gpt-4o, gpt-4o-mini, gpt-3.5-turbo
|
|
149
|
-
# For Gemini: gemini-2.0-pro, gemini-2.0-flash
|
|
150
|
-
# For Claude: claude-3-opus, claude-3-sonnet, claude-3-haiku
|
|
151
|
-
LLM__META__MODEL: "gpt-4o-mini"
|
|
152
|
-
|
|
153
|
-
# Max tokens for completion.
|
|
154
|
-
LLM__META__MAX_TOKENS: "1200"
|
|
155
|
-
|
|
156
|
-
# Creativity of responses (0 = deterministic, >0 = more creative).
|
|
157
|
-
LLM__META__TEMPERATURE: "0.3"
|
|
158
|
-
|
|
159
|
-
# --- HTTP client configuration ---
|
|
160
|
-
# API endpoint + token (must be set as CI/CD variables).
|
|
161
|
-
LLM__HTTP_CLIENT__API_URL: "https://api.openai.com/v1"
|
|
162
|
-
LLM__HTTP_CLIENT__API_TOKEN: "$OPENAI_API_KEY"
|
|
163
|
-
|
|
164
|
-
# Example for Gemini:
|
|
165
|
-
# LLM__HTTP_CLIENT__API_URL: "https://generativelanguage.googleapis.com"
|
|
166
|
-
# LLM__HTTP_CLIENT__API_TOKEN: "$GEMINI_API_KEY"
|
|
167
|
-
|
|
168
|
-
# Example for Claude:
|
|
169
|
-
# LLM__HTTP_CLIENT__API_URL: "https://api.anthropic.com"
|
|
170
|
-
# LLM__HTTP_CLIENT__API_TOKEN: "$CLAUDE_API_KEY"
|
|
171
|
-
# LLM__HTTP_CLIENT__API_VERSION: "2023-06-01"
|
|
172
|
-
|
|
173
|
-
# ===============================
|
|
174
|
-
# VCS (GitLab integration)
|
|
175
|
-
# ===============================
|
|
176
|
-
VCS__PROVIDER: "GITLAB"
|
|
177
|
-
|
|
178
|
-
# Context of the current pipeline (auto-populated by GitLab).
|
|
179
|
-
VCS__PIPELINE__PROJECT_ID: "$CI_PROJECT_ID"
|
|
180
|
-
VCS__PIPELINE__MERGE_REQUEST_ID: "$CI_MERGE_REQUEST_IID"
|
|
181
|
-
|
|
182
|
-
# GitLab API access.
|
|
183
|
-
VCS__HTTP_CLIENT__API_URL: "$CI_SERVER_URL"
|
|
184
|
-
VCS__HTTP_CLIENT__API_TOKEN: "$CI_JOB_TOKEN"
|
|
185
|
-
|
|
186
|
-
# ===============================
|
|
187
|
-
# Prompts (optional overrides)
|
|
188
|
-
# ===============================
|
|
189
|
-
# Inline prompts (joined in order, local review instructions).
|
|
190
|
-
# PROMPT__INLINE_PROMPT_FILES__0: "./prompts/inline.md"
|
|
191
|
-
|
|
192
|
-
# Inline system prompts (format/contract rules).
|
|
193
|
-
# PROMPT__SYSTEM_INLINE_PROMPT_FILES__0: "./prompts/system_inline.md"
|
|
194
|
-
# PROMPT__INCLUDE_INLINE_SYSTEM_PROMPTS: "true"
|
|
195
|
-
|
|
196
|
-
# Context prompts (joined in order, broader analysis instructions).
|
|
197
|
-
# PROMPT__CONTEXT_PROMPT_FILES__0: "./prompts/context.md"
|
|
198
|
-
|
|
199
|
-
# Context system prompts (format/contract rules).
|
|
200
|
-
# PROMPT__SYSTEM_CONTEXT_PROMPT_FILES__0: "./prompts/system_context.md"
|
|
201
|
-
# PROMPT__INCLUDE_CONTEXT_SYSTEM_PROMPTS: "true"
|
|
202
|
-
|
|
203
|
-
# Summary prompts (joined in order, local review instructions).
|
|
204
|
-
# PROMPT__SUMMARY_PROMPT_FILES__0: "./prompts/summary.md"
|
|
205
|
-
|
|
206
|
-
# Summary system prompts (format/contract rules).
|
|
207
|
-
# PROMPT__SYSTEM_SUMMARY_PROMPT_FILES__0: "./prompts/system_summary.md"
|
|
208
|
-
# PROMPT__INCLUDE_SUMMARY_SYSTEM_PROMPTS: "true"
|
|
209
|
-
|
|
210
|
-
# ===============================
|
|
211
|
-
# Custom context variables
|
|
212
|
-
# ===============================
|
|
213
|
-
# You can inject custom variables into prompts via PROMPT__CONTEXT__*.
|
|
214
|
-
# These will be available in all templates through placeholders.
|
|
215
|
-
#
|
|
216
|
-
# Placeholder syntax is defined separately in PROMPT__CONTEXT_PLACEHOLDER.
|
|
217
|
-
# Default: <<{value}>>
|
|
218
|
-
#
|
|
219
|
-
# Example usage in prompt templates:
|
|
220
|
-
# Project: <<company_name>>
|
|
221
|
-
# Env: <<environment>>
|
|
222
|
-
# Pipeline: <<ci_pipeline_url>>
|
|
223
|
-
#
|
|
224
|
-
# Values override built-in variables if names collide.
|
|
225
|
-
# To avoid clashes, prefer namespaced keys
|
|
226
|
-
# (ci_pipeline_url, org_notify_handle, env_name).
|
|
227
|
-
#
|
|
228
|
-
# PROMPT__CONTEXT__ENVIRONMENT: "staging"
|
|
229
|
-
# PROMPT__CONTEXT__COMPANY_NAME: "ACME Corp"
|
|
230
|
-
# PROMPT__CONTEXT__CI_PIPELINE_URL: "https://gitlab.com/pipelines/123"
|
|
231
|
-
#
|
|
232
|
-
# ===============================
|
|
233
|
-
# Context placeholder
|
|
234
|
-
# ===============================
|
|
235
|
-
# Defines how placeholders are written in prompt templates.
|
|
236
|
-
# Must contain "{value}" which will be replaced by the variable name.
|
|
237
|
-
#
|
|
238
|
-
# Default: <<{value}>>
|
|
239
|
-
#
|
|
240
|
-
# Example:
|
|
241
|
-
# PROMPT__CONTEXT_PLACEHOLDER: "<<{value}>>"
|
|
242
|
-
# Template: "Env: <<environment>>"
|
|
243
|
-
# Result: "Env: staging"
|
|
244
|
-
#
|
|
245
|
-
# PROMPT__CONTEXT_PLACEHOLDER: "<<{value}>>"
|
|
246
|
-
|
|
247
|
-
# ===============================
|
|
248
|
-
# Review options
|
|
249
|
-
# ===============================
|
|
250
|
-
# Available modes:
|
|
251
|
-
# FULL_FILE_DIFF
|
|
252
|
-
# FULL_FILE_CURRENT
|
|
253
|
-
# FULL_FILE_PREVIOUS
|
|
254
|
-
# ONLY_ADDED
|
|
255
|
-
# ONLY_REMOVED
|
|
256
|
-
# ADDED_AND_REMOVED
|
|
257
|
-
# ONLY_ADDED_WITH_CONTEXT
|
|
258
|
-
# ONLY_REMOVED_WITH_CONTEXT
|
|
259
|
-
# ADDED_AND_REMOVED_WITH_CONTEXT
|
|
260
|
-
REVIEW__MODE: "FULL_FILE_DIFF"
|
|
261
|
-
|
|
262
|
-
# Tags used to mark AI-generated comments in MR.
|
|
263
|
-
REVIEW__INLINE_TAG: "#ai-review-inline"
|
|
264
|
-
REVIEW__SUMMARY_TAG: "#ai-review-summary"
|
|
265
|
-
|
|
266
|
-
# Context lines (only for *_WITH_CONTEXT modes).
|
|
267
|
-
REVIEW__CONTEXT_LINES: "10"
|
|
268
|
-
|
|
269
|
-
# Markers for changes in output.
|
|
270
|
-
REVIEW__REVIEW_ADDED_MARKER: " # added"
|
|
271
|
-
REVIEW__REVIEW_REMOVED_MARKER: " # removed"
|
|
272
|
-
|
|
273
|
-
# Optional filters:
|
|
274
|
-
# REVIEW__ALLOW_CHANGES: "src/*,lib/*"
|
|
275
|
-
# REVIEW__IGNORE_CHANGES: "docs/*,README.md"
|
|
276
|
-
|
|
277
|
-
# Optional limits for number of AI comments:
|
|
278
|
-
# REVIEW__MAX_INLINE_COMMENTS: "20" # Max inline comments per file (default: unlimited)
|
|
279
|
-
# REVIEW__MAX_CONTEXT_COMMENTS: "50" # Max context comments per MR (default: unlimited)
|
|
280
|
-
|
|
281
|
-
# ===============================
|
|
282
|
-
# Logger (optional)
|
|
283
|
-
# ===============================
|
|
284
|
-
LOGGER__LEVEL: "INFO"
|
|
285
|
-
LOGGER__FORMAT: "{time:YYYY-MM-DD HH:mm:ss} | {level} | {extra[logger_name]} | {message}"
|
|
286
|
-
|
|
287
|
-
# ===============================
|
|
288
|
-
# Artifacts (optional)
|
|
289
|
-
# ===============================
|
|
290
|
-
ARTIFACTS__LLM_DIR: "./artifacts/llm"
|
|
291
|
-
ARTIFACTS__LLM_ENABLED: "false"
|
|
292
|
-
|
|
293
|
-
allow_failure: true
|
|
294
|
-
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
---
|
|
298
|
-
|
|
299
|
-
## 📂 Examples
|
|
300
|
-
|
|
301
|
-
- [./docs/ci](./docs/ci) — ready-to-use CI snippets
|
|
302
|
-
- [./docs/configs](./docs/configs) — sample `.yaml`, `.json`, `.env` configs
|
|
303
|
-
- [./docs/prompts](./docs/prompts) — prompt templates for Python/Go (light & strict modes)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|