ai-cr 1.0.0__py3-none-any.whl → 2.0.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.
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Vitalii Stepanenko
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Vitalii Stepanenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.3
2
+ Name: ai-cr
3
+ Version: 2.0.0
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
+ License: MIT
6
+ Keywords: static code analysis,code review,code quality,ai,coding,assistant,llm,github,automation,devops,developer tools,github actions,workflows,git
7
+ Author: Nayjest
8
+ Author-email: mail@vitaliy.in
9
+ Requires-Python: >=3.11,<4.0
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development
18
+ Requires-Dist: GitPython (>=3.1.44,<4.0.0)
19
+ Requires-Dist: ai-microcore (==4.0.0)
20
+ Requires-Dist: anthropic (>=0.52.2,<0.53.0)
21
+ Requires-Dist: ghapi (>=1.0.6,<1.1.0)
22
+ Requires-Dist: google-generativeai (>=0.8.5,<0.9.0)
23
+ Requires-Dist: jira (>=3.8.0,<4.0.0)
24
+ Requires-Dist: typer (>=0.16.0,<0.17.0)
25
+ Requires-Dist: unidiff (>=0.7.5,<0.8.0)
26
+ Project-URL: Homepage, https://github.com/Nayjest/Gito
27
+ Project-URL: Repository, https://github.com/Nayjest/Gito
28
+ Description-Content-Type: text/markdown
29
+
30
+ <h1 align="center"><a href="#"><img alt="Gito: AI Code Reviewer" src="press-kit/logo/gito-ai-code-reviewer_logo-180.png" align="center" width="180"></a></h1>
31
+ <p align="center">
32
+ <a href="https://pypi.org/project/gito.bot/" target="_blank"><img src="https://img.shields.io/pypi/v/gito.bot" alt="PYPI Release"></a>
33
+ <a href="https://github.com/Nayjest/Gito/actions/workflows/code-style.yml" target="_blank"><img src="https://github.com/Nayjest/Gito/actions/workflows/code-style.yml/badge.svg" alt="PyLint"></a>
34
+ <a href="https://github.com/Nayjest/Gito/actions/workflows/tests.yml" target="_blank"><img src="https://github.com/Nayjest/Gito/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
35
+ <img src="https://github.com/Nayjest/Gito/blob/main/coverage.svg" alt="Code Coverage">
36
+ <a href="https://github.com/Nayjest/Gito/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/static/v1?label=license&message=MIT&color=d08aff" alt="License"></a>
37
+ </p>
38
+
39
+ **Gito** is an open-source **AI code reviewer** that works with any language model provider.
40
+ It detects issues in GitHub pull requests or local changes—instantly, reliably, and without vendor lock-in.
41
+
42
+ Get consistent, thorough code reviews in seconds—no waiting for human availability.
43
+
44
+ ## ✨ Why Gito?
45
+
46
+ - [⚡] **Lightning Fast:** Get detailed code reviews in seconds, not days — powered by parallelized LLM processing
47
+ - [🔧] **Vendor Agnostic:** Works with any language model provider (OpenAI, Anthropic, Google, local models, etc.)
48
+ - [🌐] **Universal:** Supports all major programming languages and frameworks
49
+ - [🔍] **Comprehensive Analysis:** Detect issues across security, performance, maintainability, best practices, and much more
50
+ - [📈] **Consistent Quality:** Never tired, never biased—consistent review quality every time
51
+ - [🚀] **Easy Integration:** Automatically reviews pull requests via GitHub Actions and posts results as PR comments
52
+ - [🎛️] **Infinitely Flexible:** Adapt to any project's standards—configure review rules, severity levels, and focus areas, build custom workflows
53
+
54
+ ## 🎯 Perfect For
55
+
56
+ - Solo developers who want expert-level code review without the wait
57
+ - Teams looking to catch issues before human review
58
+ - Open source projects maintaining high code quality at scale
59
+ - CI/CD pipelines requiring automated quality gates
60
+
61
+ ✨ See [code review in action](https://github.com/Nayjest/Gito/pull/39#issuecomment-2906968729) ✨
62
+
63
+ ## 🚀 Quickstart
64
+
65
+ ### 1. Review Pull Requests via GitHub Actions
66
+
67
+ Create a `.github/workflows/gito-code-review.yml` file:
68
+
69
+ ```yaml
70
+ name: "Gito: AI Code Review"
71
+ on:
72
+ pull_request:
73
+ types: [opened, synchronize, reopened]
74
+ workflow_dispatch:
75
+ inputs:
76
+ pr_number:
77
+ description: "Pull Request number"
78
+ required: true
79
+ jobs:
80
+ review:
81
+ runs-on: ubuntu-latest
82
+ permissions: { contents: read, pull-requests: write } # 'write' for leaving the summary comment
83
+ steps:
84
+ - uses: actions/checkout@v4
85
+ with: { fetch-depth: 0 }
86
+ - name: Set up Python
87
+ uses: actions/setup-python@v5
88
+ with: { python-version: "3.13" }
89
+ - name: Install AI Code Review tool
90
+ run: pip install gito.bot~=2.0
91
+ - name: Run AI code analysis
92
+ env:
93
+ LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
94
+ LLM_API_TYPE: openai
95
+ MODEL: "gpt-4.1"
96
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97
+ PR_NUMBER_FROM_WORKFLOW_DISPATCH: ${{ github.event.inputs.pr_number }}
98
+ run: |
99
+ gito --verbose review
100
+ gito github-comment --token ${{ secrets.GITHUB_TOKEN }}
101
+ - uses: actions/upload-artifact@v4
102
+ with:
103
+ name: ai-code-review-results
104
+ path: |
105
+ code-review-report.md
106
+ code-review-report.json
107
+ ```
108
+
109
+ > ⚠️ Make sure to add `LLM_API_KEY` to your repository’s GitHub secrets.
110
+
111
+ 💪 Done!
112
+ PRs to your repository will now receive AI code reviews automatically. ✨
113
+ See [GitHub Setup Guide](https://github.com/Nayjest/Gito/blob/main/documentation/github_setup.md) for more details.
114
+
115
+ ### 2. Running Code Analysis Locally
116
+
117
+ #### Initial Local Setup
118
+
119
+ **Prerequisites:** [Python](https://www.python.org/downloads/) 3.11 / 3.12 / 3.13
120
+
121
+ **Step1:** Install [gito.bot](https://github.com/Nayjest/Gito) using [pip](https://en.wikipedia.org/wiki/Pip_(package_manager)).
122
+ ```bash
123
+ pip install gito.bot
124
+ ```
125
+
126
+ > **Troubleshooting:**
127
+ > pip may be also available via cli as `pip3` depending on your Python installation.
128
+
129
+ **Step2:** Perform initial setup
130
+
131
+ The following command will perform one-time setup using an interactive wizard.
132
+ You will be prompted to enter LLM configuration details (API type, API key, etc).
133
+ Configuration will be saved to `~/.gito/.env`.
134
+
135
+ ```bash
136
+ gito setup
137
+ ```
138
+
139
+ > **Troubleshooting:**
140
+ > On some systems, `gito` command may not became available immediately after installation.
141
+ > Try restarting your terminal or running `python -m gito` instead.
142
+
143
+
144
+ #### Perform your first AI code review locally
145
+
146
+ **Step1:** Navigate to your repository root directory.
147
+ **Step2:** Switch to the branch you want to review.
148
+ **Step3:** Run following command
149
+ ```bash
150
+ gito review
151
+ ```
152
+
153
+ > **Note:** This will analyze the current branch against the repository main branch by default.
154
+ > Files that are not staged for commit will be ignored.
155
+ > See `gito --help` for more options.
156
+
157
+ **Reviewing remote repository**
158
+
159
+ ```bash
160
+ gito remote git@github.com:owner/repo.git <FEATURE_BRANCH>..<MAIN_BRANCH>
161
+ ```
162
+ Use interactive help for details:
163
+ ```bash
164
+ gito remote --help
165
+ ```
166
+
167
+ ## 🔧 Configuration
168
+
169
+ Change behavior via `.gito/config.toml`:
170
+
171
+ - Prompt templates, filtering and post-processing using Python code snippets
172
+ - Tagging, severity, and confidence settings
173
+ - Custom AI awards for developer brilliance
174
+ - Output customization
175
+
176
+ You can override the default config by placing `.gito/config.toml` in your repo root.
177
+
178
+
179
+ See default configuration [here](https://github.com/Nayjest/Gito/blob/main/gito/config.toml).
180
+
181
+ More details can be found in [📖 Configuration Cookbook](https://github.com/Nayjest/Gito/blob/main/documentation/config_cookbook.md)
182
+
183
+ ## 💻 Development Setup
184
+
185
+ Install dependencies:
186
+
187
+ ```bash
188
+ make install
189
+ ```
190
+
191
+ Format code and check style:
192
+
193
+ ```bash
194
+ make black
195
+ make cs
196
+ ```
197
+
198
+ Run tests:
199
+
200
+ ```bash
201
+ pytest
202
+ ```
203
+
204
+ ## 🤝 Contributing
205
+
206
+ **Looking for a specific feature or having trouble?**
207
+ Contributions are welcome! ❤️
208
+ See [CONTRIBUTING.md](https://github.com/Nayjest/Gito/blob/main/CONTRIBUTING.md) for details.
209
+
210
+ ## 📝 License
211
+
212
+ Licensed under the [MIT License](https://github.com/Nayjest/Gito/blob/main/LICENSE).
213
+
214
+ © 2025 [Vitalii Stepanenko](mailto:mail@vitaliy.in)
215
+
@@ -0,0 +1,26 @@
1
+ gito/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ gito/__main__.py,sha256=MSmt_5Xg84uHqzTN38JwgseJK8rsJn_11A8WD99VtEo,61
3
+ gito/bootstrap.py,sha256=ceeoSCD8RX4xKxWri_n0xx00aTFS6xPUHhAs3rKVP5o,2337
4
+ gito/cli.py,sha256=qFY1ObA0-Ep19bNSEcwjn6KIu2OOSWDj6QGe_o7Ujoc,6555
5
+ gito/commands/__init__.py,sha256=B2uUQsLMEsHfNT1N3lWYm38WSuQIHFmjiGs2tdBuDBA,55
6
+ gito/commands/fix.py,sha256=OS829xVrLMLQqlol9AoxJMZ9qaAWRCSbUkVNszK96ws,5305
7
+ gito/commands/gh_post_review_comment.py,sha256=oZh3kSRBx3cSMozI2llDEOVZ2WeT_5msXMLLCiLina4,1984
8
+ gito/commands/gh_react_to_comment.py,sha256=4uUb39FnM45DO-wESQq6pUlO5AFvh0FSluCCTxkl8_g,6442
9
+ gito/commands/repl.py,sha256=wDHWl2VyRK32hLZHImrhqpQNkWV3u3358fwDiA6D3iA,521
10
+ gito/config.toml,sha256=iK0CeP3mynTnWIEsCi_jA9Gtb_UdAqwLC5nWHSTc-zc,17367
11
+ gito/constants.py,sha256=9G4sZbqLBg13FYieJqkq_hzek4-smmL4KKYF64tovQQ,698
12
+ gito/core.py,sha256=tp-eB_FIsZ2wffTiMrRLc_9MaFaGIky_ExWHWTf1DTk,9341
13
+ gito/gh_api.py,sha256=syhM8sbs_lLNG53bfRHQpusO818nwXCl4jDxVY__IK0,1204
14
+ gito/issue_trackers.py,sha256=nfib6zhvmL_zjRDCdZ0d6rMT4ZFJ3PxO5UORaJzb6gk,1495
15
+ gito/pipeline.py,sha256=Nq5VUVrXVDXVVYX6nVSMX1CyhoWsNtSeTOQyNgQAsdE,2672
16
+ gito/pipeline_steps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ gito/pipeline_steps/jira.py,sha256=cgRSHoU6j0lcK6hQfhg950PEmIu3uWLGMKZbW3-H3mg,1683
18
+ gito/pipeline_steps/linear.py,sha256=stCuTWgVF3SG1XNmIdNwelTDQzKE9PnJLIOS27wKavw,2376
19
+ gito/project_config.py,sha256=XdpXsRDFWBNNpktbZDp9p-nbijyKjG_oD6UWzGZSLjM,2580
20
+ gito/report_struct.py,sha256=tLhdmCPse3Jbo56y752vuGlndWY2f2g_mNFQ-BmJZGw,4160
21
+ gito/utils.py,sha256=HpterYtjceVhklJe0w1n7PIQJk8MJFUYi4FiG-CzMqg,6418
22
+ ai_cr-2.0.0.dist-info/LICENSE,sha256=VbdF_GbbDK24JvdTfnsxa2M6jmhsxmRSFeHCx-lICGE,1075
23
+ ai_cr-2.0.0.dist-info/METADATA,sha256=GNna_ERoyIWezF_SD-1eSG5EALMe1b5HeDOyiaGbIEE,7951
24
+ ai_cr-2.0.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
25
+ ai_cr-2.0.0.dist-info/entry_points.txt,sha256=Ua1DxkhJJ8TZuLgnH-IlWCkrre_0S0dq_GtYRaYupWk,38
26
+ ai_cr-2.0.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.2
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ gito=gito.cli:main
3
+
@@ -1,4 +1,4 @@
1
- from .cli import main
2
-
3
- if __name__ == "__main__":
4
- main()
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
@@ -1,62 +1,66 @@
1
- import logging
2
- import os
3
- from datetime import datetime
4
-
5
- import microcore as mc
6
- from ai_code_review.utils import is_running_in_github_action
7
-
8
- from .constants import ENV_CONFIG_FILE
9
-
10
-
11
- def setup_logging():
12
- class CustomFormatter(logging.Formatter):
13
- def format(self, record):
14
- dt = datetime.fromtimestamp(record.created).strftime("%Y-%m-%d %H:%M:%S")
15
- message, level_name = record.getMessage(), record.levelname
16
- if record.levelno == logging.WARNING:
17
- message = mc.ui.yellow(message)
18
- level_name = mc.ui.yellow(level_name)
19
- if record.levelno >= logging.ERROR:
20
- message = mc.ui.red(message)
21
- level_name = mc.ui.red(level_name)
22
- return f"{dt} {level_name}: {message}"
23
-
24
- handler = logging.StreamHandler()
25
- handler.setFormatter(CustomFormatter())
26
- logging.basicConfig(level=logging.INFO, handlers=[handler])
27
-
28
-
29
- def bootstrap():
30
- """Bootstrap the application with the environment configuration."""
31
- setup_logging()
32
- logging.info("Bootstrapping...")
33
- try:
34
- mc.configure(
35
- DOT_ENV_FILE=ENV_CONFIG_FILE,
36
- USE_LOGGING=True,
37
- EMBEDDING_DB_TYPE=mc.EmbeddingDbType.NONE,
38
- )
39
- except mc.LLMConfigError as e:
40
- msg = str(e)
41
- if is_running_in_github_action():
42
- ref = os.getenv("GITHUB_WORKFLOW_REF", "")
43
- if ref:
44
- # example value: 'owner/repo/.github/workflows/ai-code-review.yml@refs/pull/1/merge'
45
- ref = ref.split("@")[0]
46
- ref = ref.split(".github/workflows/")[-1]
47
- ref = f" (.github/workflows/{ref})"
48
- msg += (
49
- f"\nPlease check your GitHub Action Secrets "
50
- f"and `env` configuration section of the corresponding workflow step{ref}."
51
- )
52
- else:
53
- msg += (
54
- "\nPlease run 'ai-code-review setup' "
55
- "to configure LLM API access (API keys, model, etc)."
56
- )
57
- print(mc.ui.red(msg))
58
- raise SystemExit(2)
59
- except Exception as e:
60
- logging.error(f"Unexpected configuration error: {e}")
61
- raise SystemExit(3)
62
- mc.logging.LoggingConfig.STRIP_REQUEST_LINES = [300, 15]
1
+ import logging
2
+ import os
3
+ from datetime import datetime
4
+
5
+ import microcore as mc
6
+ import typer
7
+
8
+ from .utils import is_running_in_github_action
9
+ from .constants import HOME_ENV_PATH, EXECUTABLE
10
+
11
+
12
+ def setup_logging():
13
+ class CustomFormatter(logging.Formatter):
14
+ def format(self, record):
15
+ dt = datetime.fromtimestamp(record.created).strftime("%Y-%m-%d %H:%M:%S")
16
+ message, level_name = record.getMessage(), record.levelname
17
+ if record.levelno == logging.WARNING:
18
+ message = mc.ui.yellow(message)
19
+ level_name = mc.ui.yellow(level_name)
20
+ if record.levelno >= logging.ERROR:
21
+ message = mc.ui.red(message)
22
+ level_name = mc.ui.red(level_name)
23
+ return f"{dt} {level_name}: {message}"
24
+
25
+ handler = logging.StreamHandler()
26
+ handler.setFormatter(CustomFormatter())
27
+ logging.basicConfig(level=logging.INFO, handlers=[handler])
28
+
29
+
30
+ def bootstrap():
31
+ """Bootstrap the application with the environment configuration."""
32
+ setup_logging()
33
+ logging.info("Bootstrapping...")
34
+ try:
35
+ mc.configure(
36
+ DOT_ENV_FILE=HOME_ENV_PATH,
37
+ USE_LOGGING=True,
38
+ EMBEDDING_DB_TYPE=mc.EmbeddingDbType.NONE,
39
+ )
40
+ except mc.LLMConfigError as e:
41
+ msg = str(e)
42
+ if is_running_in_github_action():
43
+ ref = os.getenv("GITHUB_WORKFLOW_REF", "")
44
+ if ref:
45
+ # example value: 'owner/repo/.github/workflows/ai-code-review.yml@refs/pull/1/merge'
46
+ ref = ref.split("@")[0]
47
+ ref = ref.split(".github/workflows/")[-1]
48
+ ref = f" (.github/workflows/{ref})"
49
+ msg += (
50
+ f"\nPlease check your GitHub Action Secrets "
51
+ f"and `env` configuration section of the corresponding workflow step{ref}."
52
+ )
53
+ else:
54
+ msg += (
55
+ f"\nPlease run '{EXECUTABLE} setup' "
56
+ "to configure LLM API access (API keys, model, etc)."
57
+ )
58
+ print(mc.ui.red(msg))
59
+ raise SystemExit(2)
60
+ except Exception as e:
61
+ logging.error(f"Unexpected configuration error: {e}")
62
+ raise SystemExit(3)
63
+ mc.logging.LoggingConfig.STRIP_REQUEST_LINES = [300, 15]
64
+
65
+
66
+ app = typer.Typer(pretty_exceptions_show_locals=False)