github-code-review 3.4.3__tar.gz → 3.6.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.
- {github_code_review-3.4.3 → github_code_review-3.6.0}/LICENSE +1 -1
- {github_code_review-3.4.3 → github_code_review-3.6.0}/PKG-INFO +137 -30
- {github_code_review-3.4.3 → github_code_review-3.6.0}/README.md +135 -28
- github_code_review-3.6.0/gito/__main__.py +7 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/bootstrap.py +3 -1
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/cli.py +26 -18
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/cli_base.py +23 -5
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/fix.py +13 -1
- github_code_review-3.6.0/gito/entrypoint.py +10 -0
- github_code_review-3.6.0/gito/env.py +22 -0
- github_code_review-3.6.0/gito/git_installation_check.py +57 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/report_struct.py +1 -1
- {github_code_review-3.4.3 → github_code_review-3.6.0}/pyproject.toml +3 -3
- github_code_review-3.4.3/gito/__main__.py +0 -4
- github_code_review-3.4.3/gito/env.py +0 -8
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/__init__.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/__init__.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/deploy.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/gh_post_review_comment.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/gh_react_to_comment.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/linear_comment.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/repl.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/version.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/config.toml +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/constants.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/context.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/core.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/gh_api.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/issue_trackers.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/pipeline.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/pipeline_steps/__init__.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/pipeline_steps/jira.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/pipeline_steps/linear.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/project_config.py +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/answer.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/github_workflows/components/env-vars.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/github_workflows/components/installs.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/github_workflows/gito-code-review.yml.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/github_workflows/gito-react-to-comments.yml.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/partial/aux_files.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/questions/changes_summary.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/questions/release_notes.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/tpl/questions/test_cases.j2 +0 -0
- {github_code_review-3.4.3 → github_code_review-3.6.0}/gito/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: github-code-review
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.6.0
|
|
4
4
|
Summary: AI code review tool that works with any language model provider. It detects issues in GitHub pull requests or local changes—instantly, reliably, and without vendor lock-in.
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.14
|
|
19
19
|
Classifier: Topic :: Software Development
|
|
20
20
|
Requires-Dist: GitPython (>=3.1.44,<4.0.0)
|
|
21
|
-
Requires-Dist: ai-microcore (>=4
|
|
21
|
+
Requires-Dist: ai-microcore (>=4,<5)
|
|
22
22
|
Requires-Dist: anthropic (>=0.57.1,<1)
|
|
23
23
|
Requires-Dist: ghapi (>=1.0.6,<1.1.0)
|
|
24
24
|
Requires-Dist: google-generativeai (>=0.8.5,<0.9.0)
|
|
@@ -51,12 +51,21 @@ Get consistent, thorough code reviews in seconds—no waiting for human availabi
|
|
|
51
51
|
- [1. Review Pull Requests via GitHub Actions](#1-review-pull-requests-via-github-actions)
|
|
52
52
|
- [2. Running Code Analysis Locally](#2-running-code-analysis-locally)
|
|
53
53
|
- [Configuration](#-configuration)
|
|
54
|
-
- [
|
|
54
|
+
- [Guides & Reference](#-guides--reference)
|
|
55
|
+
- [Command Line Reference](https://github.com/Nayjest/Gito/blob/main/documentation/command_line_reference.md) ↗
|
|
56
|
+
- [Configuration Cookbook](https://github.com/Nayjest/Gito/blob/main/documentation/config_cookbook.md) ↗
|
|
57
|
+
- [GitHub Setup Guide](https://github.com/Nayjest/Gito/blob/main/documentation/github_setup.md) ↗
|
|
58
|
+
- Integrations
|
|
59
|
+
- [Linear Integration](https://github.com/Nayjest/Gito/blob/main/documentation/linear_integration.md) ↗
|
|
60
|
+
- [Atlassian Jira Integration](https://github.com/Nayjest/Gito/blob/main/documentation/jira_integration.md) ↗
|
|
61
|
+
- [Troubleshooting](https://github.com/Nayjest/Gito/blob/main/documentation/troubleshooting.md) ↗
|
|
62
|
+
- [Documentation generation with Gito](https://github.com/Nayjest/Gito/blob/main/documentation/documentation_generation.md) ↗
|
|
63
|
+
- [Known Limitations](#-known-limitations)
|
|
55
64
|
- [Development Setup](#-development-setup)
|
|
56
65
|
- [Contributing](#-contributing)
|
|
57
66
|
- [License](#-license)
|
|
58
67
|
|
|
59
|
-
## ✨ Why Gito
|
|
68
|
+
## ✨ Why Gito?<a id="-why-gito"></a>
|
|
60
69
|
|
|
61
70
|
- [⚡] **Lightning Fast:** Get detailed code reviews in seconds, not days — powered by parallelized LLM processing
|
|
62
71
|
- [🔧] **Vendor Agnostic:** Works with any language model provider (OpenAI, Anthropic, Google, local models, etc.)
|
|
@@ -66,7 +75,7 @@ Get consistent, thorough code reviews in seconds—no waiting for human availabi
|
|
|
66
75
|
- [🚀] **Easy Integration:** Automatically reviews pull requests via GitHub Actions and posts results as PR comments
|
|
67
76
|
- [🎛️] **Infinitely Flexible:** Adapt to any project's standards—configure review rules, severity levels, and focus areas, build custom workflows
|
|
68
77
|
|
|
69
|
-
## 🎯 Perfect For
|
|
78
|
+
## 🎯 Perfect For<a id="-perfect-for"></a>
|
|
70
79
|
|
|
71
80
|
- Solo developers who want expert-level code review without the wait
|
|
72
81
|
- Teams looking to catch issues before human review
|
|
@@ -75,12 +84,11 @@ Get consistent, thorough code reviews in seconds—no waiting for human availabi
|
|
|
75
84
|
|
|
76
85
|
✨ See [code review in action](https://github.com/Nayjest/Gito/pull/99) ✨
|
|
77
86
|
|
|
78
|
-
## 🚀 Quickstart
|
|
87
|
+
## 🚀 Quickstart<a id="-quickstart"></a>
|
|
79
88
|
|
|
80
|
-
### 1. Review Pull Requests via GitHub Actions
|
|
89
|
+
### 1. Review Pull Requests via GitHub Actions<a id="1-review-pull-requests-via-github-actions"></a>
|
|
81
90
|
|
|
82
91
|
Create a `.github/workflows/gito-code-review.yml` file:
|
|
83
|
-
|
|
84
92
|
```yaml
|
|
85
93
|
name: "Gito: AI Code Review"
|
|
86
94
|
on:
|
|
@@ -102,7 +110,7 @@ jobs:
|
|
|
102
110
|
uses: actions/setup-python@v6
|
|
103
111
|
with: { python-version: "3.13" }
|
|
104
112
|
- name: Install AI Code Review tool
|
|
105
|
-
run: pip install gito.bot~=3.
|
|
113
|
+
run: pip install gito.bot~=3.6
|
|
106
114
|
- name: Run AI code analysis
|
|
107
115
|
env:
|
|
108
116
|
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
|
@@ -127,11 +135,15 @@ jobs:
|
|
|
127
135
|
PRs to your repository will now receive AI code reviews automatically. ✨
|
|
128
136
|
See [GitHub Setup Guide](https://github.com/Nayjest/Gito/blob/main/documentation/github_setup.md) for more details.
|
|
129
137
|
|
|
130
|
-
### 2. Running Code Analysis Locally
|
|
138
|
+
### 2. Running Code Analysis Locally<a id="2-running-code-analysis-locally"></a>
|
|
131
139
|
|
|
132
140
|
#### Initial Local Setup
|
|
133
141
|
|
|
134
|
-
**Prerequisites:**
|
|
142
|
+
**Prerequisites:**
|
|
143
|
+
- [Python](https://www.python.org/downloads/) 3.11 / 3.12 / 3.13
|
|
144
|
+
- [Git](https://git-scm.com)
|
|
145
|
+
|
|
146
|
+
#### Option A: Install via pip (recommended)
|
|
135
147
|
|
|
136
148
|
**Step 1:** Install [gito.bot](https://github.com/Nayjest/Gito) using [pip](https://en.wikipedia.org/wiki/Pip_(package_manager)).
|
|
137
149
|
```bash
|
|
@@ -141,12 +153,21 @@ pip install gito.bot
|
|
|
141
153
|
> **Troubleshooting:**
|
|
142
154
|
> pip may also be available via cli as `pip3` depending on your Python installation.
|
|
143
155
|
|
|
156
|
+
#### Option B: Windows Standalone Installer
|
|
157
|
+
|
|
158
|
+
Download the latest Windows installer from [Releases](https://github.com/Nayjest/Gito/releases).
|
|
159
|
+
|
|
160
|
+
The installer includes:
|
|
161
|
+
- Standalone executable (no Python required)
|
|
162
|
+
- Automatic PATH configuration
|
|
163
|
+
- Start Menu shortcuts
|
|
164
|
+
- Easy uninstallation
|
|
165
|
+
|
|
144
166
|
**Step 2:** Perform initial setup
|
|
145
167
|
|
|
146
168
|
The following command will perform one-time setup using an interactive wizard.
|
|
147
169
|
You will be prompted to enter LLM configuration details (API type, API key, etc).
|
|
148
170
|
Configuration will be saved to `~/.gito/.env`.
|
|
149
|
-
|
|
150
171
|
```bash
|
|
151
172
|
gito setup
|
|
152
173
|
```
|
|
@@ -160,7 +181,7 @@ gito setup
|
|
|
160
181
|
|
|
161
182
|
**Step 1:** Navigate to your repository root directory.
|
|
162
183
|
**Step 2:** Switch to the branch you want to review.
|
|
163
|
-
**Step 3:** Run following command
|
|
184
|
+
**Step 3:** Run the following command:
|
|
164
185
|
```bash
|
|
165
186
|
gito review
|
|
166
187
|
```
|
|
@@ -170,7 +191,6 @@ gito review
|
|
|
170
191
|
> See `gito --help` for more options.
|
|
171
192
|
|
|
172
193
|
**Reviewing remote repository**
|
|
173
|
-
|
|
174
194
|
```bash
|
|
175
195
|
gito remote git@github.com:owner/repo.git <FEATURE_BRANCH>..<MAIN_BRANCH>
|
|
176
196
|
```
|
|
@@ -179,58 +199,145 @@ Use interactive help for details:
|
|
|
179
199
|
gito remote --help
|
|
180
200
|
```
|
|
181
201
|
|
|
182
|
-
## 🔧 Configuration
|
|
202
|
+
## 🔧 Configuration<a id="-configuration"></a>
|
|
203
|
+
|
|
204
|
+
Gito uses a two-layer configuration model:
|
|
205
|
+
|
|
206
|
+
| Scope | Location | Purpose |
|
|
207
|
+
|-------|----------|---------|
|
|
208
|
+
| **Environment** | `~/.gito/.env` or OS environment variables | LLM provider, model, API keys, concurrency |
|
|
209
|
+
| **Project** | `<repo>/.gito/config.toml` | Review behavior, prompts, templates, integrations |
|
|
210
|
+
|
|
211
|
+
> **Note:** Environment configuration defines external resources and credentials — it's machine-specific and never committed to version control. Project configuration defines review behavior and can be shared across your team.
|
|
212
|
+
|
|
213
|
+
### Environment Configuration
|
|
214
|
+
|
|
215
|
+
Environment settings control LLM inference, API Keys and apply system-wide.
|
|
216
|
+
|
|
217
|
+
Gito uses [ai-microcore](https://github.com/Nayjest/ai-microcore) for vendor-agnostic LLM access. All settings are configured via OS environment variables or `.env` files.
|
|
218
|
+
|
|
219
|
+
**Default location:** `~/.gito/.env`
|
|
220
|
+
*(Created automatically via `gito setup`)*
|
|
221
|
+
|
|
222
|
+
#### Example
|
|
223
|
+
```bash
|
|
224
|
+
# ~/.gito/.env
|
|
225
|
+
LLM_API_TYPE=openai
|
|
226
|
+
LLM_API_KEY=sk-...
|
|
227
|
+
LLM_API_BASE=https://api.openai.com/v1/
|
|
228
|
+
MODEL=gpt-5.2
|
|
229
|
+
MAX_CONCURRENT_TASKS=20
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
For all supported options, see the [ai-microcore configuration guide](https://github.com/Nayjest/ai-microcore?tab=readme-ov-file#%EF%B8%8F-configuring).
|
|
233
|
+
|
|
234
|
+
#### CI/CD Environments
|
|
235
|
+
|
|
236
|
+
In CI workflows, configure LLM settings via workflow environment variables. Use your platform's secrets management (GitHub Secrets, GitLab CI Variables) for API keys.
|
|
237
|
+
|
|
183
238
|
|
|
184
|
-
|
|
239
|
+
### Project Configuration
|
|
185
240
|
|
|
186
|
-
-
|
|
187
|
-
- Tagging, severity, and confidence settings
|
|
188
|
-
- Custom AI awards for developer brilliance
|
|
189
|
-
- Output customization
|
|
241
|
+
Gito supports per-repository customization through a `.gito/config.toml` file placed at the root of your project. This allows you to tailor code review behavior to your specific codebase, coding standards, and workflow requirements.
|
|
190
242
|
|
|
191
|
-
|
|
243
|
+
#### Configuration Inheritance Model
|
|
192
244
|
|
|
245
|
+
Project settings follow a layered override model:
|
|
193
246
|
|
|
194
|
-
|
|
247
|
+
**Bundled Defaults** ([config.toml](https://github.com/Nayjest/Gito/blob/main/gito/config.toml)) → **Project Config** (`<your-repo>/.gito/config.toml`)
|
|
195
248
|
|
|
196
|
-
|
|
249
|
+
Any values defined in your project's `.gito/config.toml` are merged on top of the built-in defaults. You only need to specify the settings you want to change—everything else falls back to sensible defaults.
|
|
197
250
|
|
|
198
|
-
|
|
251
|
+
#### Common Customizations
|
|
252
|
+
|
|
253
|
+
- **Review prompts** — Tailor AI instructions, review criteria, and quality thresholds
|
|
254
|
+
- **Output templates** — Customize report format for GitHub comments and CLI
|
|
255
|
+
- **Post-processing** — Python snippets to filter or transform detected issues
|
|
256
|
+
- **Bot behavior** — Mention triggers, retries, comment handling
|
|
257
|
+
- **Pipeline integrations** — Jira, Linear, etc.
|
|
258
|
+
|
|
259
|
+
Explore the bundled [config.toml](https://github.com/Nayjest/Gito/blob/main/gito/config.toml) for the complete list of available options.
|
|
260
|
+
|
|
261
|
+
#### Example
|
|
262
|
+
```toml
|
|
263
|
+
# .gito/config.toml
|
|
264
|
+
mention_triggers = ["gito", "/check"]
|
|
265
|
+
collapse_previous_code_review_comments = true
|
|
266
|
+
|
|
267
|
+
# Files to provide as context
|
|
268
|
+
aux_files = [
|
|
269
|
+
'documentation/command_line_reference.md'
|
|
270
|
+
]
|
|
271
|
+
|
|
272
|
+
exclude_files = [
|
|
273
|
+
'poetry.lock',
|
|
274
|
+
]
|
|
275
|
+
|
|
276
|
+
[prompt_vars]
|
|
277
|
+
# Custom instructions injected into the system prompts
|
|
278
|
+
awards = "" # Disable awards
|
|
279
|
+
requirements = """
|
|
280
|
+
- All public functions must have docstrings.
|
|
281
|
+
"""
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
For detailed guidance, see the [📖 Configuration Cookbook](https://github.com/Nayjest/Gito/blob/main/documentation/config_cookbook.md).
|
|
285
|
+
|
|
286
|
+
## 📚 Guides & Reference<a id="-guides--reference"></a>
|
|
287
|
+
|
|
288
|
+
For more detailed information, check out these articles:
|
|
199
289
|
|
|
200
290
|
- [Command Line Reference](https://github.com/Nayjest/Gito/blob/main/documentation/command_line_reference.md)
|
|
201
291
|
- [Configuration Cookbook](https://github.com/Nayjest/Gito/blob/main/documentation/config_cookbook.md)
|
|
202
292
|
- [GitHub Setup Guide](https://github.com/Nayjest/Gito/blob/main/documentation/github_setup.md)
|
|
293
|
+
- Integrations
|
|
294
|
+
- [Linear Integration](https://github.com/Nayjest/Gito/blob/main/documentation/linear_integration.md)
|
|
295
|
+
- [Atlassian Jira Integration](https://github.com/Nayjest/Gito/blob/main/documentation/jira_integration.md)
|
|
296
|
+
- [Documentation generation with Gito](https://github.com/Nayjest/Gito/blob/main/documentation/documentation_generation.md)
|
|
203
297
|
- [Troubleshooting](https://github.com/Nayjest/Gito/blob/main/documentation/troubleshooting.md)
|
|
204
298
|
|
|
299
|
+
Or browse all documentation in the [`/documentation`](https://github.com/Nayjest/Gito/tree/main/documentation) directory.
|
|
205
300
|
|
|
206
|
-
##
|
|
301
|
+
## 🚧 Known Limitations<a id="-known-limitations"></a>
|
|
207
302
|
|
|
208
|
-
|
|
303
|
+
Gito cannot modify files inside `.github/workflows` when reacting to GitHub PR comments (e.g., "Gito fix issue 2").
|
|
304
|
+
This is a GitHub security restriction that prevents workflows from modifying other workflow files using the default `GITHUB_TOKEN`.
|
|
305
|
+
|
|
306
|
+
While using a Personal Access Token (PAT) with the `workflow` scope would bypass this limitation, it is not recommended as a workaround.
|
|
307
|
+
PATs have broader permissions, longer lifespans, and are tied to individual user accounts, making them less secure than the default `GITHUB_TOKEN` for CI/CD pipelines.
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
## 💻 Development Setup<a id="-development-setup"></a>
|
|
311
|
+
|
|
312
|
+
Cloning the repository:
|
|
313
|
+
```bash
|
|
314
|
+
git clone https://github.com/Nayjest/Gito.git
|
|
315
|
+
cd Gito
|
|
316
|
+
```
|
|
209
317
|
|
|
318
|
+
Install dependencies:
|
|
210
319
|
```bash
|
|
211
320
|
make install
|
|
212
321
|
```
|
|
213
322
|
|
|
214
323
|
Format code and check style:
|
|
215
|
-
|
|
216
324
|
```bash
|
|
217
325
|
make black
|
|
218
326
|
make cs
|
|
219
327
|
```
|
|
220
328
|
|
|
221
329
|
Run tests:
|
|
222
|
-
|
|
223
330
|
```bash
|
|
224
331
|
pytest
|
|
225
332
|
```
|
|
226
333
|
|
|
227
|
-
## 🤝 Contributing
|
|
334
|
+
## 🤝 Contributing<a id="-contributing"></a>
|
|
228
335
|
|
|
229
336
|
**Looking for a specific feature or having trouble?**
|
|
230
337
|
Contributions are welcome! ❤️
|
|
231
338
|
See [CONTRIBUTING.md](https://github.com/Nayjest/Gito/blob/main/CONTRIBUTING.md) for details.
|
|
232
339
|
|
|
233
|
-
## 📝 License
|
|
340
|
+
## 📝 License<a id="-license"></a>
|
|
234
341
|
|
|
235
342
|
Licensed under the [MIT License](https://github.com/Nayjest/Gito/blob/main/LICENSE).
|
|
236
343
|
|
|
@@ -19,12 +19,21 @@ Get consistent, thorough code reviews in seconds—no waiting for human availabi
|
|
|
19
19
|
- [1. Review Pull Requests via GitHub Actions](#1-review-pull-requests-via-github-actions)
|
|
20
20
|
- [2. Running Code Analysis Locally](#2-running-code-analysis-locally)
|
|
21
21
|
- [Configuration](#-configuration)
|
|
22
|
-
- [
|
|
22
|
+
- [Guides & Reference](#-guides--reference)
|
|
23
|
+
- [Command Line Reference](https://github.com/Nayjest/Gito/blob/main/documentation/command_line_reference.md) ↗
|
|
24
|
+
- [Configuration Cookbook](https://github.com/Nayjest/Gito/blob/main/documentation/config_cookbook.md) ↗
|
|
25
|
+
- [GitHub Setup Guide](https://github.com/Nayjest/Gito/blob/main/documentation/github_setup.md) ↗
|
|
26
|
+
- Integrations
|
|
27
|
+
- [Linear Integration](https://github.com/Nayjest/Gito/blob/main/documentation/linear_integration.md) ↗
|
|
28
|
+
- [Atlassian Jira Integration](https://github.com/Nayjest/Gito/blob/main/documentation/jira_integration.md) ↗
|
|
29
|
+
- [Troubleshooting](https://github.com/Nayjest/Gito/blob/main/documentation/troubleshooting.md) ↗
|
|
30
|
+
- [Documentation generation with Gito](https://github.com/Nayjest/Gito/blob/main/documentation/documentation_generation.md) ↗
|
|
31
|
+
- [Known Limitations](#-known-limitations)
|
|
23
32
|
- [Development Setup](#-development-setup)
|
|
24
33
|
- [Contributing](#-contributing)
|
|
25
34
|
- [License](#-license)
|
|
26
35
|
|
|
27
|
-
## ✨ Why Gito
|
|
36
|
+
## ✨ Why Gito?<a id="-why-gito"></a>
|
|
28
37
|
|
|
29
38
|
- [⚡] **Lightning Fast:** Get detailed code reviews in seconds, not days — powered by parallelized LLM processing
|
|
30
39
|
- [🔧] **Vendor Agnostic:** Works with any language model provider (OpenAI, Anthropic, Google, local models, etc.)
|
|
@@ -34,7 +43,7 @@ Get consistent, thorough code reviews in seconds—no waiting for human availabi
|
|
|
34
43
|
- [🚀] **Easy Integration:** Automatically reviews pull requests via GitHub Actions and posts results as PR comments
|
|
35
44
|
- [🎛️] **Infinitely Flexible:** Adapt to any project's standards—configure review rules, severity levels, and focus areas, build custom workflows
|
|
36
45
|
|
|
37
|
-
## 🎯 Perfect For
|
|
46
|
+
## 🎯 Perfect For<a id="-perfect-for"></a>
|
|
38
47
|
|
|
39
48
|
- Solo developers who want expert-level code review without the wait
|
|
40
49
|
- Teams looking to catch issues before human review
|
|
@@ -43,12 +52,11 @@ Get consistent, thorough code reviews in seconds—no waiting for human availabi
|
|
|
43
52
|
|
|
44
53
|
✨ See [code review in action](https://github.com/Nayjest/Gito/pull/99) ✨
|
|
45
54
|
|
|
46
|
-
## 🚀 Quickstart
|
|
55
|
+
## 🚀 Quickstart<a id="-quickstart"></a>
|
|
47
56
|
|
|
48
|
-
### 1. Review Pull Requests via GitHub Actions
|
|
57
|
+
### 1. Review Pull Requests via GitHub Actions<a id="1-review-pull-requests-via-github-actions"></a>
|
|
49
58
|
|
|
50
59
|
Create a `.github/workflows/gito-code-review.yml` file:
|
|
51
|
-
|
|
52
60
|
```yaml
|
|
53
61
|
name: "Gito: AI Code Review"
|
|
54
62
|
on:
|
|
@@ -70,7 +78,7 @@ jobs:
|
|
|
70
78
|
uses: actions/setup-python@v6
|
|
71
79
|
with: { python-version: "3.13" }
|
|
72
80
|
- name: Install AI Code Review tool
|
|
73
|
-
run: pip install gito.bot~=3.
|
|
81
|
+
run: pip install gito.bot~=3.6
|
|
74
82
|
- name: Run AI code analysis
|
|
75
83
|
env:
|
|
76
84
|
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
|
@@ -95,11 +103,15 @@ jobs:
|
|
|
95
103
|
PRs to your repository will now receive AI code reviews automatically. ✨
|
|
96
104
|
See [GitHub Setup Guide](https://github.com/Nayjest/Gito/blob/main/documentation/github_setup.md) for more details.
|
|
97
105
|
|
|
98
|
-
### 2. Running Code Analysis Locally
|
|
106
|
+
### 2. Running Code Analysis Locally<a id="2-running-code-analysis-locally"></a>
|
|
99
107
|
|
|
100
108
|
#### Initial Local Setup
|
|
101
109
|
|
|
102
|
-
**Prerequisites:**
|
|
110
|
+
**Prerequisites:**
|
|
111
|
+
- [Python](https://www.python.org/downloads/) 3.11 / 3.12 / 3.13
|
|
112
|
+
- [Git](https://git-scm.com)
|
|
113
|
+
|
|
114
|
+
#### Option A: Install via pip (recommended)
|
|
103
115
|
|
|
104
116
|
**Step 1:** Install [gito.bot](https://github.com/Nayjest/Gito) using [pip](https://en.wikipedia.org/wiki/Pip_(package_manager)).
|
|
105
117
|
```bash
|
|
@@ -109,12 +121,21 @@ pip install gito.bot
|
|
|
109
121
|
> **Troubleshooting:**
|
|
110
122
|
> pip may also be available via cli as `pip3` depending on your Python installation.
|
|
111
123
|
|
|
124
|
+
#### Option B: Windows Standalone Installer
|
|
125
|
+
|
|
126
|
+
Download the latest Windows installer from [Releases](https://github.com/Nayjest/Gito/releases).
|
|
127
|
+
|
|
128
|
+
The installer includes:
|
|
129
|
+
- Standalone executable (no Python required)
|
|
130
|
+
- Automatic PATH configuration
|
|
131
|
+
- Start Menu shortcuts
|
|
132
|
+
- Easy uninstallation
|
|
133
|
+
|
|
112
134
|
**Step 2:** Perform initial setup
|
|
113
135
|
|
|
114
136
|
The following command will perform one-time setup using an interactive wizard.
|
|
115
137
|
You will be prompted to enter LLM configuration details (API type, API key, etc).
|
|
116
138
|
Configuration will be saved to `~/.gito/.env`.
|
|
117
|
-
|
|
118
139
|
```bash
|
|
119
140
|
gito setup
|
|
120
141
|
```
|
|
@@ -128,7 +149,7 @@ gito setup
|
|
|
128
149
|
|
|
129
150
|
**Step 1:** Navigate to your repository root directory.
|
|
130
151
|
**Step 2:** Switch to the branch you want to review.
|
|
131
|
-
**Step 3:** Run following command
|
|
152
|
+
**Step 3:** Run the following command:
|
|
132
153
|
```bash
|
|
133
154
|
gito review
|
|
134
155
|
```
|
|
@@ -138,7 +159,6 @@ gito review
|
|
|
138
159
|
> See `gito --help` for more options.
|
|
139
160
|
|
|
140
161
|
**Reviewing remote repository**
|
|
141
|
-
|
|
142
162
|
```bash
|
|
143
163
|
gito remote git@github.com:owner/repo.git <FEATURE_BRANCH>..<MAIN_BRANCH>
|
|
144
164
|
```
|
|
@@ -147,58 +167,145 @@ Use interactive help for details:
|
|
|
147
167
|
gito remote --help
|
|
148
168
|
```
|
|
149
169
|
|
|
150
|
-
## 🔧 Configuration
|
|
170
|
+
## 🔧 Configuration<a id="-configuration"></a>
|
|
171
|
+
|
|
172
|
+
Gito uses a two-layer configuration model:
|
|
173
|
+
|
|
174
|
+
| Scope | Location | Purpose |
|
|
175
|
+
|-------|----------|---------|
|
|
176
|
+
| **Environment** | `~/.gito/.env` or OS environment variables | LLM provider, model, API keys, concurrency |
|
|
177
|
+
| **Project** | `<repo>/.gito/config.toml` | Review behavior, prompts, templates, integrations |
|
|
178
|
+
|
|
179
|
+
> **Note:** Environment configuration defines external resources and credentials — it's machine-specific and never committed to version control. Project configuration defines review behavior and can be shared across your team.
|
|
180
|
+
|
|
181
|
+
### Environment Configuration
|
|
182
|
+
|
|
183
|
+
Environment settings control LLM inference, API Keys and apply system-wide.
|
|
184
|
+
|
|
185
|
+
Gito uses [ai-microcore](https://github.com/Nayjest/ai-microcore) for vendor-agnostic LLM access. All settings are configured via OS environment variables or `.env` files.
|
|
186
|
+
|
|
187
|
+
**Default location:** `~/.gito/.env`
|
|
188
|
+
*(Created automatically via `gito setup`)*
|
|
189
|
+
|
|
190
|
+
#### Example
|
|
191
|
+
```bash
|
|
192
|
+
# ~/.gito/.env
|
|
193
|
+
LLM_API_TYPE=openai
|
|
194
|
+
LLM_API_KEY=sk-...
|
|
195
|
+
LLM_API_BASE=https://api.openai.com/v1/
|
|
196
|
+
MODEL=gpt-5.2
|
|
197
|
+
MAX_CONCURRENT_TASKS=20
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
For all supported options, see the [ai-microcore configuration guide](https://github.com/Nayjest/ai-microcore?tab=readme-ov-file#%EF%B8%8F-configuring).
|
|
201
|
+
|
|
202
|
+
#### CI/CD Environments
|
|
203
|
+
|
|
204
|
+
In CI workflows, configure LLM settings via workflow environment variables. Use your platform's secrets management (GitHub Secrets, GitLab CI Variables) for API keys.
|
|
205
|
+
|
|
151
206
|
|
|
152
|
-
|
|
207
|
+
### Project Configuration
|
|
153
208
|
|
|
154
|
-
-
|
|
155
|
-
- Tagging, severity, and confidence settings
|
|
156
|
-
- Custom AI awards for developer brilliance
|
|
157
|
-
- Output customization
|
|
209
|
+
Gito supports per-repository customization through a `.gito/config.toml` file placed at the root of your project. This allows you to tailor code review behavior to your specific codebase, coding standards, and workflow requirements.
|
|
158
210
|
|
|
159
|
-
|
|
211
|
+
#### Configuration Inheritance Model
|
|
160
212
|
|
|
213
|
+
Project settings follow a layered override model:
|
|
161
214
|
|
|
162
|
-
|
|
215
|
+
**Bundled Defaults** ([config.toml](https://github.com/Nayjest/Gito/blob/main/gito/config.toml)) → **Project Config** (`<your-repo>/.gito/config.toml`)
|
|
163
216
|
|
|
164
|
-
|
|
217
|
+
Any values defined in your project's `.gito/config.toml` are merged on top of the built-in defaults. You only need to specify the settings you want to change—everything else falls back to sensible defaults.
|
|
165
218
|
|
|
166
|
-
|
|
219
|
+
#### Common Customizations
|
|
220
|
+
|
|
221
|
+
- **Review prompts** — Tailor AI instructions, review criteria, and quality thresholds
|
|
222
|
+
- **Output templates** — Customize report format for GitHub comments and CLI
|
|
223
|
+
- **Post-processing** — Python snippets to filter or transform detected issues
|
|
224
|
+
- **Bot behavior** — Mention triggers, retries, comment handling
|
|
225
|
+
- **Pipeline integrations** — Jira, Linear, etc.
|
|
226
|
+
|
|
227
|
+
Explore the bundled [config.toml](https://github.com/Nayjest/Gito/blob/main/gito/config.toml) for the complete list of available options.
|
|
228
|
+
|
|
229
|
+
#### Example
|
|
230
|
+
```toml
|
|
231
|
+
# .gito/config.toml
|
|
232
|
+
mention_triggers = ["gito", "/check"]
|
|
233
|
+
collapse_previous_code_review_comments = true
|
|
234
|
+
|
|
235
|
+
# Files to provide as context
|
|
236
|
+
aux_files = [
|
|
237
|
+
'documentation/command_line_reference.md'
|
|
238
|
+
]
|
|
239
|
+
|
|
240
|
+
exclude_files = [
|
|
241
|
+
'poetry.lock',
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
[prompt_vars]
|
|
245
|
+
# Custom instructions injected into the system prompts
|
|
246
|
+
awards = "" # Disable awards
|
|
247
|
+
requirements = """
|
|
248
|
+
- All public functions must have docstrings.
|
|
249
|
+
"""
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
For detailed guidance, see the [📖 Configuration Cookbook](https://github.com/Nayjest/Gito/blob/main/documentation/config_cookbook.md).
|
|
253
|
+
|
|
254
|
+
## 📚 Guides & Reference<a id="-guides--reference"></a>
|
|
255
|
+
|
|
256
|
+
For more detailed information, check out these articles:
|
|
167
257
|
|
|
168
258
|
- [Command Line Reference](https://github.com/Nayjest/Gito/blob/main/documentation/command_line_reference.md)
|
|
169
259
|
- [Configuration Cookbook](https://github.com/Nayjest/Gito/blob/main/documentation/config_cookbook.md)
|
|
170
260
|
- [GitHub Setup Guide](https://github.com/Nayjest/Gito/blob/main/documentation/github_setup.md)
|
|
261
|
+
- Integrations
|
|
262
|
+
- [Linear Integration](https://github.com/Nayjest/Gito/blob/main/documentation/linear_integration.md)
|
|
263
|
+
- [Atlassian Jira Integration](https://github.com/Nayjest/Gito/blob/main/documentation/jira_integration.md)
|
|
264
|
+
- [Documentation generation with Gito](https://github.com/Nayjest/Gito/blob/main/documentation/documentation_generation.md)
|
|
171
265
|
- [Troubleshooting](https://github.com/Nayjest/Gito/blob/main/documentation/troubleshooting.md)
|
|
172
266
|
|
|
267
|
+
Or browse all documentation in the [`/documentation`](https://github.com/Nayjest/Gito/tree/main/documentation) directory.
|
|
173
268
|
|
|
174
|
-
##
|
|
269
|
+
## 🚧 Known Limitations<a id="-known-limitations"></a>
|
|
175
270
|
|
|
176
|
-
|
|
271
|
+
Gito cannot modify files inside `.github/workflows` when reacting to GitHub PR comments (e.g., "Gito fix issue 2").
|
|
272
|
+
This is a GitHub security restriction that prevents workflows from modifying other workflow files using the default `GITHUB_TOKEN`.
|
|
273
|
+
|
|
274
|
+
While using a Personal Access Token (PAT) with the `workflow` scope would bypass this limitation, it is not recommended as a workaround.
|
|
275
|
+
PATs have broader permissions, longer lifespans, and are tied to individual user accounts, making them less secure than the default `GITHUB_TOKEN` for CI/CD pipelines.
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
## 💻 Development Setup<a id="-development-setup"></a>
|
|
279
|
+
|
|
280
|
+
Cloning the repository:
|
|
281
|
+
```bash
|
|
282
|
+
git clone https://github.com/Nayjest/Gito.git
|
|
283
|
+
cd Gito
|
|
284
|
+
```
|
|
177
285
|
|
|
286
|
+
Install dependencies:
|
|
178
287
|
```bash
|
|
179
288
|
make install
|
|
180
289
|
```
|
|
181
290
|
|
|
182
291
|
Format code and check style:
|
|
183
|
-
|
|
184
292
|
```bash
|
|
185
293
|
make black
|
|
186
294
|
make cs
|
|
187
295
|
```
|
|
188
296
|
|
|
189
297
|
Run tests:
|
|
190
|
-
|
|
191
298
|
```bash
|
|
192
299
|
pytest
|
|
193
300
|
```
|
|
194
301
|
|
|
195
|
-
## 🤝 Contributing
|
|
302
|
+
## 🤝 Contributing<a id="-contributing"></a>
|
|
196
303
|
|
|
197
304
|
**Looking for a specific feature or having trouble?**
|
|
198
305
|
Contributions are welcome! ❤️
|
|
199
306
|
See [CONTRIBUTING.md](https://github.com/Nayjest/Gito/blob/main/CONTRIBUTING.md) for details.
|
|
200
307
|
|
|
201
|
-
## 📝 License
|
|
308
|
+
## 📝 License<a id="-license"></a>
|
|
202
309
|
|
|
203
310
|
Licensed under the [MIT License](https://github.com/Nayjest/Gito/blob/main/LICENSE).
|
|
204
311
|
|
|
@@ -71,7 +71,9 @@ def bootstrap(verbosity: int = 1):
|
|
|
71
71
|
mc.logging.LoggingConfig.STRIP_REQUEST_LINES = [300, 15]
|
|
72
72
|
|
|
73
73
|
except mc.LLMConfigError as e:
|
|
74
|
-
msg = str(e)
|
|
74
|
+
msg = str(e).strip()
|
|
75
|
+
if not msg.endswith((".", "!", "?")):
|
|
76
|
+
msg += "."
|
|
75
77
|
if is_running_in_github_action():
|
|
76
78
|
ref = os.getenv("GITHUB_WORKFLOW_REF", "")
|
|
77
79
|
if ref:
|
|
@@ -6,9 +6,8 @@ import textwrap
|
|
|
6
6
|
|
|
7
7
|
import microcore as mc
|
|
8
8
|
import typer
|
|
9
|
-
from git import Repo
|
|
10
|
-
from gito.constants import REFS_VALUE_ALL
|
|
11
9
|
|
|
10
|
+
from .constants import REFS_VALUE_ALL
|
|
12
11
|
from .core import review, get_diff, filter_diff, answer
|
|
13
12
|
from .cli_base import (
|
|
14
13
|
app,
|
|
@@ -18,6 +17,7 @@ from .cli_base import (
|
|
|
18
17
|
arg_filters,
|
|
19
18
|
arg_out,
|
|
20
19
|
arg_against,
|
|
20
|
+
arg_all,
|
|
21
21
|
get_repo_context,
|
|
22
22
|
)
|
|
23
23
|
from .report_struct import Report
|
|
@@ -89,6 +89,23 @@ def cli(
|
|
|
89
89
|
bootstrap(verbosity)
|
|
90
90
|
|
|
91
91
|
|
|
92
|
+
def _consider_arg_all(all: bool, refs: str, merge_base: bool) -> tuple[str, bool]:
|
|
93
|
+
"""
|
|
94
|
+
Handle the --all option logic for commands.
|
|
95
|
+
Returns:
|
|
96
|
+
Updated (refs, merge_base) tuple.
|
|
97
|
+
"""
|
|
98
|
+
if all:
|
|
99
|
+
if refs and refs != REFS_VALUE_ALL:
|
|
100
|
+
raise typer.BadParameter(
|
|
101
|
+
"The --all option overrides the refs argument. "
|
|
102
|
+
"Please remove the refs argument if you want to review all codebase."
|
|
103
|
+
)
|
|
104
|
+
refs = REFS_VALUE_ALL
|
|
105
|
+
merge_base = False
|
|
106
|
+
return refs, merge_base
|
|
107
|
+
|
|
108
|
+
|
|
92
109
|
@app_no_subcommand.command(name="review", help="Perform code review")
|
|
93
110
|
@app.command(name="review", help="Perform a code review of the target codebase changes.")
|
|
94
111
|
@app.command(name="run", hidden=True)
|
|
@@ -110,16 +127,9 @@ def cmd_review(
|
|
|
110
127
|
""")
|
|
111
128
|
),
|
|
112
129
|
out: str = arg_out(),
|
|
113
|
-
all: bool =
|
|
130
|
+
all: bool = arg_all(),
|
|
114
131
|
):
|
|
115
|
-
|
|
116
|
-
if refs and refs != REFS_VALUE_ALL:
|
|
117
|
-
raise typer.BadParameter(
|
|
118
|
-
"The --all option overrides the refs argument. "
|
|
119
|
-
"Please remove the refs argument if you want to review all codebase."
|
|
120
|
-
)
|
|
121
|
-
refs = REFS_VALUE_ALL
|
|
122
|
-
merge_base = False
|
|
132
|
+
refs, merge_base = _consider_arg_all(all, refs, merge_base)
|
|
123
133
|
_what, _against = args_to_target(refs, what, against)
|
|
124
134
|
pr = pr or os.getenv("PR_NUMBER_FROM_WORKFLOW_DISPATCH")
|
|
125
135
|
with get_repo_context(url, _what) as (repo, out_folder):
|
|
@@ -151,7 +161,6 @@ def cmd_review(
|
|
|
151
161
|
|
|
152
162
|
@app.command(name="ask", help="Answer questions about the target codebase changes.")
|
|
153
163
|
@app.command(name="answer", hidden=True)
|
|
154
|
-
@app.command(name="talk", hidden=True)
|
|
155
164
|
def cmd_answer(
|
|
156
165
|
question: str = typer.Argument(help="Question to ask about the codebase changes"),
|
|
157
166
|
refs: str = arg_refs(),
|
|
@@ -174,11 +183,13 @@ def cmd_answer(
|
|
|
174
183
|
help="Auxiliary files that might be helpful"
|
|
175
184
|
),
|
|
176
185
|
save_to: str = typer.Option(
|
|
177
|
-
help="
|
|
186
|
+
help="Write the answer to the target file",
|
|
178
187
|
default=None,
|
|
179
188
|
show_default=False
|
|
180
|
-
)
|
|
189
|
+
),
|
|
190
|
+
all: bool = arg_all(),
|
|
181
191
|
):
|
|
192
|
+
refs, merge_base = _consider_arg_all(all, refs, merge_base)
|
|
182
193
|
_what, _against = args_to_target(refs, what, against)
|
|
183
194
|
pr = pr or os.getenv("PR_NUMBER_FROM_WORKFLOW_DISPATCH")
|
|
184
195
|
if str(question).startswith("tpl:"):
|
|
@@ -241,8 +252,7 @@ def files(
|
|
|
241
252
|
diff: bool = typer.Option(default=False, help="Show diff content")
|
|
242
253
|
):
|
|
243
254
|
_what, _against = args_to_target(refs, what, against)
|
|
244
|
-
|
|
245
|
-
try:
|
|
255
|
+
with get_repo_context(url=None, branch=_what) as (repo, out_folder):
|
|
246
256
|
patch_set = get_diff(repo=repo, what=_what, against=_against, use_merge_base=merge_base)
|
|
247
257
|
patch_set = filter_diff(patch_set, filters)
|
|
248
258
|
cfg = ProjectConfig.load_for_repo(repo)
|
|
@@ -266,5 +276,3 @@ def files(
|
|
|
266
276
|
print(f"- {color(patch.path)}")
|
|
267
277
|
if diff:
|
|
268
278
|
print(mc.ui.gray(textwrap.indent(str(patch), " ")))
|
|
269
|
-
finally:
|
|
270
|
-
repo.close()
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
"""Common CLI arguments and utilities for Gito commands."""
|
|
1
2
|
import contextlib
|
|
2
3
|
import logging
|
|
3
4
|
import tempfile
|
|
5
|
+
from typing import Iterator
|
|
4
6
|
|
|
5
7
|
import microcore as mc
|
|
6
8
|
import typer
|
|
7
|
-
from git import Repo
|
|
8
|
-
from gito.constants import REFS_VALUE_ALL
|
|
9
|
+
from git import Repo, InvalidGitRepositoryError
|
|
9
10
|
|
|
11
|
+
from .constants import REFS_VALUE_ALL
|
|
10
12
|
from .utils import parse_refs_pair
|
|
11
13
|
from .env import Env
|
|
12
14
|
|
|
@@ -73,14 +75,27 @@ def arg_against() -> typer.Option:
|
|
|
73
75
|
)
|
|
74
76
|
|
|
75
77
|
|
|
78
|
+
def arg_all() -> typer.Option:
|
|
79
|
+
return typer.Option(default=False, help="Review whole codebase")
|
|
80
|
+
|
|
81
|
+
|
|
76
82
|
app = typer.Typer(pretty_exceptions_show_locals=False)
|
|
77
83
|
|
|
78
84
|
|
|
79
85
|
@contextlib.contextmanager
|
|
80
|
-
def get_repo_context(
|
|
86
|
+
def get_repo_context(
|
|
87
|
+
url: str | None,
|
|
88
|
+
branch: str | None
|
|
89
|
+
) -> Iterator[tuple[Repo, str]]:
|
|
90
|
+
"""
|
|
91
|
+
Context manager for handling both local and remote repositories.
|
|
92
|
+
Yields a tuple of (Repo object, path to the repository)
|
|
93
|
+
Args:
|
|
94
|
+
url (str): URL of the remote repository. If empty, uses the local repository.
|
|
95
|
+
branch (str): Branch to checkout when cloning the remote repository.
|
|
96
|
+
"""
|
|
81
97
|
if branch == REFS_VALUE_ALL:
|
|
82
98
|
branch = None
|
|
83
|
-
"""Context manager for handling both local and remote repositories."""
|
|
84
99
|
if url:
|
|
85
100
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
86
101
|
logging.info(
|
|
@@ -97,7 +112,10 @@ def get_repo_context(url: str, branch: str):
|
|
|
97
112
|
Env.working_folder = prev_folder
|
|
98
113
|
else:
|
|
99
114
|
logging.info("get_repo_context: Using local repo...")
|
|
100
|
-
|
|
115
|
+
try:
|
|
116
|
+
repo = Repo(".")
|
|
117
|
+
except InvalidGitRepositoryError:
|
|
118
|
+
raise typer.BadParameter("Current folder is not a git repository.")
|
|
101
119
|
try:
|
|
102
120
|
yield repo, "."
|
|
103
121
|
finally:
|
|
@@ -145,6 +145,10 @@ def commit_changes(
|
|
|
145
145
|
commit_message: str = "fix by AI",
|
|
146
146
|
push: bool = True
|
|
147
147
|
) -> None:
|
|
148
|
+
"""
|
|
149
|
+
Commit and optionally push changes to the remote repository.
|
|
150
|
+
Raises typer.Exit on failure.
|
|
151
|
+
"""
|
|
148
152
|
if opened_repo := not repo:
|
|
149
153
|
repo = git.Repo(".")
|
|
150
154
|
for i in files:
|
|
@@ -152,7 +156,15 @@ def commit_changes(
|
|
|
152
156
|
repo.index.commit(commit_message)
|
|
153
157
|
if push:
|
|
154
158
|
origin = repo.remotes.origin
|
|
155
|
-
origin.push()
|
|
159
|
+
push_results = origin.push()
|
|
160
|
+
for push_info in push_results:
|
|
161
|
+
if push_info.flags & (
|
|
162
|
+
git.PushInfo.ERROR
|
|
163
|
+
| git.PushInfo.REJECTED
|
|
164
|
+
| git.PushInfo.REMOTE_REJECTED
|
|
165
|
+
):
|
|
166
|
+
logging.error(f"Push failed: {push_info.summary}")
|
|
167
|
+
raise typer.Exit(code=1)
|
|
156
168
|
logging.info(f"Changes pushed to {origin.name}")
|
|
157
169
|
else:
|
|
158
170
|
logging.info("Changes committed but not pushed to remote")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Entry point for the Gito command-line interface (CLI)."""
|
|
2
|
+
|
|
3
|
+
from .git_installation_check import ensure_git_installed
|
|
4
|
+
|
|
5
|
+
ensure_git_installed() # should be called before importing other modules that depend on Git
|
|
6
|
+
|
|
7
|
+
# flake8: noqa: E402, F401
|
|
8
|
+
from .cli import main
|
|
9
|
+
|
|
10
|
+
__all__ = ["main"]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def gito_version() -> str:
|
|
6
|
+
"""
|
|
7
|
+
Retrieve the current version of gito.bot package.
|
|
8
|
+
Returns:
|
|
9
|
+
str: The version string of the gito.bot package, or "{Dev}" if not found.
|
|
10
|
+
"""
|
|
11
|
+
try:
|
|
12
|
+
return version("gito.bot")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
logging.warning("Could not retrieve gito.bot version.")
|
|
15
|
+
return "{Dev}"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Env:
|
|
19
|
+
logging_level: int = 1
|
|
20
|
+
verbosity: int = 1
|
|
21
|
+
gito_version: str = gito_version()
|
|
22
|
+
working_folder = "."
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Checks if Git is installed; if not, provides installation instructions.
|
|
3
|
+
"""
|
|
4
|
+
import platform
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
from microcore import ui
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def ensure_git_installed() -> None:
|
|
11
|
+
"""Ensures that Git is installed on the system."""
|
|
12
|
+
try:
|
|
13
|
+
from git import Repo # noqa: F401
|
|
14
|
+
except ImportError:
|
|
15
|
+
_exit_with_git_instructions()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _exit_with_git_instructions() -> None:
|
|
19
|
+
"""Exits the program with instructions to install Git."""
|
|
20
|
+
cmd = _get_git_install_command()
|
|
21
|
+
app_name = f"{ui.bright}Gito AI Code Reviewer{ui.reset}{ui.red}"
|
|
22
|
+
msg_begin = (
|
|
23
|
+
f"{ui.red}Error: {app_name} couldn't find "
|
|
24
|
+
f"{ui.bright}Git{ui.reset}{ui.red} on the system."
|
|
25
|
+
f"\n{ui.red}"
|
|
26
|
+
)
|
|
27
|
+
if cmd:
|
|
28
|
+
details = f"To install {ui.bright}Git{ui.reset}{ui.red}, run: {ui.blue}{cmd}{ui.reset}"
|
|
29
|
+
else:
|
|
30
|
+
details = "Please install it from: https://git-scm.com"
|
|
31
|
+
sys.exit(msg_begin + details)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _get_git_install_command() -> str | None:
|
|
35
|
+
"""Returns the command to install Git based on the operating system."""
|
|
36
|
+
system = platform.system().lower()
|
|
37
|
+
|
|
38
|
+
if system == "windows":
|
|
39
|
+
return "winget install Git.Git"
|
|
40
|
+
elif system == "darwin":
|
|
41
|
+
return "brew install git"
|
|
42
|
+
elif system == "linux":
|
|
43
|
+
try:
|
|
44
|
+
with open("/etc/os-release") as f:
|
|
45
|
+
os_release = f.read().lower()
|
|
46
|
+
except FileNotFoundError:
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
if "alpine" in os_release:
|
|
50
|
+
return "apk add git"
|
|
51
|
+
if "debian" in os_release or "ubuntu" in os_release:
|
|
52
|
+
return "sudo apt install git"
|
|
53
|
+
if "fedora" in os_release:
|
|
54
|
+
return "sudo dnf install git"
|
|
55
|
+
if "arch" in os_release:
|
|
56
|
+
return "sudo pacman -S git"
|
|
57
|
+
return None
|
|
@@ -92,7 +92,7 @@ class Report:
|
|
|
92
92
|
number_of_processed_files: int = field(default=0)
|
|
93
93
|
total_issues: int = field(init=False)
|
|
94
94
|
created_at: str = field(default_factory=lambda: datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
|
95
|
-
model: str = field(default_factory=lambda: mc.config().MODEL)
|
|
95
|
+
model: str = field(default_factory=lambda: mc.config().MODEL or "")
|
|
96
96
|
pipeline_out: dict = field(default_factory=dict)
|
|
97
97
|
processing_warnings: list[ProcessingWarning] = field(default_factory=list)
|
|
98
98
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "github-code-review"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.6.0"
|
|
4
4
|
description = "AI code review tool that works with any language model provider. It detects issues in GitHub pull requests or local changes—instantly, reliably, and without vendor lock-in."
|
|
5
5
|
authors = ["Nayjest <mail@vitaliy.in>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -21,7 +21,7 @@ packages = [
|
|
|
21
21
|
|
|
22
22
|
[tool.poetry.dependencies]
|
|
23
23
|
python = "^3.11"
|
|
24
|
-
ai-microcore = "~4
|
|
24
|
+
ai-microcore = "~4"
|
|
25
25
|
GitPython = "^3.1.44"
|
|
26
26
|
unidiff = "^0.7.5"
|
|
27
27
|
google-generativeai = "^0.8.5"
|
|
@@ -51,7 +51,7 @@ requires = ["poetry-core"]
|
|
|
51
51
|
build-backend = "poetry.core.masonry.api"
|
|
52
52
|
|
|
53
53
|
[tool.poetry.scripts]
|
|
54
|
-
gito = "gito.
|
|
54
|
+
gito = "gito.entrypoint:main"
|
|
55
55
|
|
|
56
56
|
[tool.pytest.ini_options]
|
|
57
57
|
minversion = "6.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_code_review-3.4.3 → github_code_review-3.6.0}/gito/commands/gh_post_review_comment.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|