github-code-review 4.0.2__py3-none-any.whl → 4.0.4__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.
- {github_code_review-4.0.2.dist-info → github_code_review-4.0.4.dist-info}/METADATA +17 -11
- github_code_review-4.0.4.dist-info/RECORD +63 -0
- {github_code_review-4.0.2.dist-info → github_code_review-4.0.4.dist-info}/WHEEL +1 -1
- {github_code_review-4.0.2.dist-info → github_code_review-4.0.4.dist-info}/entry_points.txt +1 -0
- gito/__main__.py +1 -0
- gito/bootstrap.py +5 -7
- gito/cli.py +37 -48
- gito/cli_base.py +8 -13
- gito/commands/deploy.py +127 -112
- gito/commands/fix.py +114 -84
- gito/commands/gh_post_review_comment.py +3 -6
- gito/commands/gh_react_to_comment.py +28 -23
- gito/commands/gitlab_post_review_comment.py +4 -9
- gito/commands/linear_comment.py +8 -8
- gito/commands/repl.py +1 -0
- gito/commands/version.py +2 -1
- gito/config.toml +2 -2
- gito/constants.py +4 -3
- gito/core.py +45 -74
- gito/gh_api.py +4 -9
- gito/git_installation_check.py +1 -0
- gito/gitlab.py +3 -3
- gito/issue_trackers.py +3 -3
- gito/pipeline.py +4 -12
- gito/pipeline_steps/jira.py +9 -16
- gito/pipeline_steps/linear.py +6 -17
- gito/project_config.py +6 -5
- gito/report_struct.py +75 -18
- gito/utils/cli.py +18 -17
- gito/utils/git.py +1 -0
- gito/utils/git_platform/__init__.py +2 -1
- gito/utils/git_platform/adapters/base.py +1 -0
- gito/utils/git_platform/adapters/gitlab.py +1 -1
- gito/utils/git_platform/github.py +6 -5
- gito/utils/git_platform/gitlab.py +8 -7
- gito/utils/git_platform/platform_types.py +7 -3
- gito/utils/git_platform/shared.py +7 -10
- gito/utils/html.py +2 -1
- gito/utils/markdown.py +1 -0
- gito/utils/package_metadata.py +1 -0
- gito/utils/python.py +2 -3
- gito/utils/string.py +2 -2
- github_code_review-4.0.2.dist-info/RECORD +0 -63
- {github_code_review-4.0.2.dist-info → github_code_review-4.0.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: github-code-review
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.4
|
|
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
|
|
@@ -104,11 +104,12 @@ Get consistent, thorough code reviews in seconds—no waiting for human availabi
|
|
|
104
104
|
## 🌐 Supported Platforms & Integrations<a id="-supported-platforms--integrations"></a>
|
|
105
105
|
|
|
106
106
|
### 🧩 Git Platforms
|
|
107
|
-
| Platform
|
|
108
|
-
|
|
109
|
-
| GitHub
|
|
110
|
-
| GitLab
|
|
111
|
-
| Bitbucket
|
|
107
|
+
| Platform | Status |
|
|
108
|
+
|-------------|----------------------|
|
|
109
|
+
| GitHub | ✅ Supported |
|
|
110
|
+
| GitLab | 🧪 Supported (Beta) |
|
|
111
|
+
| Bitbucket | 🛠️ Planned |
|
|
112
|
+
| Local / CLI | ✅ Supported |
|
|
112
113
|
|
|
113
114
|
> ℹ️ Gito ships ready-to-use CI/CD workflows for these platforms,
|
|
114
115
|
> with full support for triggering actions via PR comments, automatic review posting, and PR lifecycle integration.
|
|
@@ -211,7 +212,7 @@ pip install gito.bot
|
|
|
211
212
|
```
|
|
212
213
|
|
|
213
214
|
> **Troubleshooting:**
|
|
214
|
-
> pip may also be available via
|
|
215
|
+
> pip may also be available via CLI as `pip3` depending on your Python installation.
|
|
215
216
|
|
|
216
217
|
To install from repository source / specific branch:
|
|
217
218
|
```bash
|
|
@@ -376,32 +377,37 @@ PATs have broader permissions, longer lifespans, and are tied to individual user
|
|
|
376
377
|
## 💻 Development Setup<a id="-development-setup"></a>
|
|
377
378
|
|
|
378
379
|
Clone the repository and navigate to it:
|
|
380
|
+
|
|
379
381
|
```bash
|
|
380
382
|
git clone https://github.com/Nayjest/Gito.git
|
|
381
383
|
cd Gito
|
|
382
384
|
```
|
|
385
|
+
|
|
383
386
|
<div><img align="right" width="460" src="https://raw.githubusercontent.com/Nayjest/Gito/4_0_1/press-kit/character/gito_fullbody_1.jpg">
|
|
384
387
|
|
|
385
388
|
Install dependencies:
|
|
389
|
+
|
|
386
390
|
```bash
|
|
387
391
|
make install
|
|
388
392
|
```
|
|
389
|
-
|
|
390
|
-
>
|
|
391
|
-
> pip install -e ".[dev]"
|
|
392
|
-
> ```
|
|
393
|
+
|
|
394
|
+
> **Note:** If `make` is not available on your system, you can run the underlying command directly:
|
|
395
|
+
> `pip install -e ".[dev]"`
|
|
393
396
|
> See the [Makefile](https://github.com/Nayjest/Gito/blob/main/Makefile) for all available commands.
|
|
394
397
|
|
|
395
398
|
Format code and check style:
|
|
399
|
+
|
|
396
400
|
```bash
|
|
397
401
|
make black
|
|
398
402
|
make cs
|
|
399
403
|
```
|
|
400
404
|
|
|
401
405
|
Run tests:
|
|
406
|
+
|
|
402
407
|
```bash
|
|
403
408
|
pytest
|
|
404
409
|
```
|
|
410
|
+
|
|
405
411
|
</div>
|
|
406
412
|
|
|
407
413
|
## 🤝 Contributing<a id="-contributing"></a>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
gito/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
gito/__main__.py,sha256=do-U8t1PSVZmKl8sapFWIX1FSQzloHCNI4dgaAk_8A0,241
|
|
3
|
+
gito/bootstrap.py,sha256=lVvC2mS3uMWq0acXYyP_YHVrmW9KvgotQmDZoiaHnqc,4188
|
|
4
|
+
gito/cli.py,sha256=EaYjBBB-cf3GGJMIsq7j1_vOHhP9xbWztiAN6pW3fK0,11235
|
|
5
|
+
gito/cli_base.py,sha256=yTDu6wDMMD_JHAAzXLnHA0pbDG2tZmtroA1y5Ead6Fc,3583
|
|
6
|
+
gito/commands/__init__.py,sha256=B2uUQsLMEsHfNT1N3lWYm38WSuQIHFmjiGs2tdBuDBA,55
|
|
7
|
+
gito/commands/deploy.py,sha256=AMgK5cbB_m05MZqL3VAUq3RY8yTa2QK_20AM0F8NqX4,18341
|
|
8
|
+
gito/commands/fix.py,sha256=IMbbsxzpsrb0Jt_EysIldS4cIMDw7_D4wbFJ5yUw3r8,7974
|
|
9
|
+
gito/commands/gh_post_review_comment.py,sha256=fp813F9odovvNrIWT7gi2sibrrCndzy3y3IX3L88zlA,4514
|
|
10
|
+
gito/commands/gh_react_to_comment.py,sha256=ZeAo_gObhL23Wz39zycC9etyoBVgzj29SBb_ATUuHQM,7591
|
|
11
|
+
gito/commands/gitlab_post_review_comment.py,sha256=vq4bIuBy6RUdFyvhu2CwYQb2FwRPo7lrjqgTLuoSFKU,8018
|
|
12
|
+
gito/commands/linear_comment.py,sha256=dSF6ZVf10UIMjUYvUDhegqJiMYE55qFi9R_thnCDZUk,3316
|
|
13
|
+
gito/commands/repl.py,sha256=0Maod0duT3fOkZc3GPPX2I2wIRMoQvLt3Gp30sb-oYM,1110
|
|
14
|
+
gito/commands/version.py,sha256=I8nmEJXFB7hGJ6H_EX3_2YpFadxHfQpGCMOnjvvbDdM,212
|
|
15
|
+
gito/config.toml,sha256=v_0zuuPazqSkiazTgEAc8ZffnWziAA8bghbFLC3p-FU,19271
|
|
16
|
+
gito/constants.py,sha256=uXAyz796aPHHHLDEyneCDyASIIrSq_ADV3Ze3fycJXI,1003
|
|
17
|
+
gito/context.py,sha256=aQXQIntVMrLv5KB6hqmnqOaU1xmRW52al2tprGgdMUE,440
|
|
18
|
+
gito/core.py,sha256=gq6MIyLGvWc1EIn5te5VyBgTsDDr-qaDGi_nnT_afFw,22861
|
|
19
|
+
gito/entrypoint.py,sha256=VbuRBLtM7Zbk-Nu9dMq6EDC-6h78ORUCKCPLes7alO4,283
|
|
20
|
+
gito/env.py,sha256=IQBLMF33yRYKsU7HNvx4qOXLz7evAfy3KIewUV0bskA,561
|
|
21
|
+
gito/gh_api.py,sha256=PjI9KaTIiQIKb_UEhbHZoujJmSIPiPWDDRiZ8Nz2PJ0,4031
|
|
22
|
+
gito/git_installation_check.py,sha256=nKpq7nm_YWITLZrkJTlwwEsowCh1a8kZo5HsCHxhtGA,1752
|
|
23
|
+
gito/gitlab.py,sha256=VyLGeLm2wlk1rUjrjYkDpAZl_lUQ9SRgQq2hIMXiaPs,2413
|
|
24
|
+
gito/issue_trackers.py,sha256=asAFzU7R-74l0v9k5mjQe1ZBnngeYt_5Hh8m_0SWRRc,2343
|
|
25
|
+
gito/pipeline.py,sha256=vkEseII-4S9E8mN4-oTxw8SI-WOZxamJU0Y7sqHgdwE,2916
|
|
26
|
+
gito/pipeline_steps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
+
gito/pipeline_steps/jira.py,sha256=3H5TjV1uY7GHI3YX0JyZdrx460hmL4HtZ3XGpE0bnmM,2269
|
|
28
|
+
gito/pipeline_steps/linear.py,sha256=yT6tkGZdrg_-gPTnmrUIFGpFZAa1DBjTa__BbvKUcWI,2361
|
|
29
|
+
gito/project_config.py,sha256=H3gBGfM9U1fO0rgfkyubpu6yd2olHj8Ob0mM5y5SfAA,4437
|
|
30
|
+
gito/report_struct.py,sha256=nvB0RLqYz1UanN1WWoz1F7NGeuWsMTWTZoVJMc3lUyc,9888
|
|
31
|
+
gito/tpl/answer.j2,sha256=_XvGLyGGVOVnxNEsyOP8JkmcG23gGlTvKt8nwzzrJQ8,708
|
|
32
|
+
gito/tpl/partial/aux_files.j2,sha256=lJhqnCsHBbEEocpyyOmQX27jzuLvEIuEVXY0RGqxWnY,191
|
|
33
|
+
gito/tpl/questions/changes_summary.j2,sha256=YsnxOYAK7vQhi49tAruiAO9fg7x6tq-ncn5zaCJLaMo,2221
|
|
34
|
+
gito/tpl/questions/release_notes.j2,sha256=Z_zhvNiizrsCFhn87eSEmXv_tU4Yk18uE5GsSjtUbIE,987
|
|
35
|
+
gito/tpl/questions/test_cases.j2,sha256=xA53sfKoVCNjXRhKH1frIJnsUcwM-8PcrpMwxrqBLLk,1418
|
|
36
|
+
gito/tpl/workflows/github/components/env-vars.j2,sha256=ypmf938h5PA38mXTZnP1eI4Un3AIhhmnl6wXg2X4kqI,406
|
|
37
|
+
gito/tpl/workflows/github/components/installs.j2,sha256=buvo5DTeG0V5vGXOumnm6ZVfzgudIOxWPuj0RDpqSbM,693
|
|
38
|
+
gito/tpl/workflows/github/gito-code-review.yml.j2,sha256=uwVh9n5-pxqPdImXbZixUOtfGBPBzJxbnU2JjeYtd7w,963
|
|
39
|
+
gito/tpl/workflows/github/gito-react-to-comments.yml.j2,sha256=ccrNsS9wATCMZEOgXrZR9P_kHOlrT_a_Ie_d_g8rKow,2129
|
|
40
|
+
gito/tpl/workflows/gitlab/.gitlab-ci.yml.j2,sha256=_rWNXY5mxSkRM5dWkpVK0GOf6kxZrt8jcCoqXkwo9yk,69
|
|
41
|
+
gito/tpl/workflows/gitlab/gito-code-review.yml.j2,sha256=99_AwCS7rOsFqwxcJ52RY7pkm3Grzyw43rVegT_p0xM,1250
|
|
42
|
+
gito/utils/__init__.py,sha256=G_zvAZ9EwGMggT8wR7DdZOVVcOfFwV9wk_G1nZxRZ20,51
|
|
43
|
+
gito/utils/cli.py,sha256=4En2fLKybmeNodZw13G9GeCJemGKCrfNQ5_bYJoZ7fg,5323
|
|
44
|
+
gito/utils/git.py,sha256=PhwWqOB7yo5_TjCHQR51cRKeAtTIQpX75irQiIFAi4Q,722
|
|
45
|
+
gito/utils/git_platform/__init__.py,sha256=7hxvsvmtls_ke6ErFgcc6juwl2ajOjH91nRe_ihWP6M,717
|
|
46
|
+
gito/utils/git_platform/adapters/__init__.py,sha256=OEWQ1HTr-vADZZfrftVBSLs7dImXhiEJHMWXIkBOrsY,1407
|
|
47
|
+
gito/utils/git_platform/adapters/base.py,sha256=GTol7zF5EQr_i-6aBqZqvsRbrQ_--9U2FbrcY2Hh0Oo,2832
|
|
48
|
+
gito/utils/git_platform/adapters/github.py,sha256=0wJK-0CBELImSjz2jvAfkeDpotJrvQyUfrU1EqqYpZ8,1137
|
|
49
|
+
gito/utils/git_platform/adapters/gitlab.py,sha256=GeoA_AiXk2DmoE9EaYQCLuhokVJXUF7cfIp1ys8vdO8,1161
|
|
50
|
+
gito/utils/git_platform/github.py,sha256=Aiv9bPZyhDw0WZiNS5UaN6kZnRdPNgBxFJO_TsWDL9k,4369
|
|
51
|
+
gito/utils/git_platform/gitlab.py,sha256=vCjTL66G61iesEkLRLfdfae41aFqZqA6qgq8He8gxvY,3687
|
|
52
|
+
gito/utils/git_platform/platform_types.py,sha256=HHPobX_-GRzKCTroI_4VgpW68JsP_uWlx5n2ensE9Xo,3696
|
|
53
|
+
gito/utils/git_platform/shared.py,sha256=5ommothL8q1I07FINZoz_gBWAVq6LaHZotfLuMKTcOk,2526
|
|
54
|
+
gito/utils/html.py,sha256=mZW4ViTU3hrevw7TdfxpcNtGBpLZFaO6aVDboxqb8Hg,229
|
|
55
|
+
gito/utils/markdown.py,sha256=0Fb_LrOXdmHtU2aSw4gB7z_ibwqXSWl2l_IwDhmj31Y,2113
|
|
56
|
+
gito/utils/package_metadata.py,sha256=nae3z2WZsCTYlq9LspFFQxR8Pn2PpWG5qGO-ZpGa1LY,229
|
|
57
|
+
gito/utils/python.py,sha256=PepiLFcYzfyo9H7NVcJtykfPmmM66etbdUgtdLWvJ34,993
|
|
58
|
+
gito/utils/string.py,sha256=_2gtrUtvN5Z8zNZHNQ_lFPI5rFd0W3lfiohbXw1sSOA,1687
|
|
59
|
+
github_code_review-4.0.4.dist-info/METADATA,sha256=OF-lYAh7HNQbX2o-mVQ_jTZwY-_KnheuNASZHbUU18g,19052
|
|
60
|
+
github_code_review-4.0.4.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
61
|
+
github_code_review-4.0.4.dist-info/entry_points.txt,sha256=hw57yb8_2hrUJr7AbRLkAvGUaqoTF8E98pmSl2ISpfg,85
|
|
62
|
+
github_code_review-4.0.4.dist-info/licenses/LICENSE,sha256=avg6TUQou2p-c-awRDs_BRLvNtxa3l95jP0-i0OfzE8,1082
|
|
63
|
+
github_code_review-4.0.4.dist-info/RECORD,,
|
gito/__main__.py
CHANGED
gito/bootstrap.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Bootstrap module for initializing the Gito application environment."""
|
|
2
|
+
|
|
2
3
|
import os
|
|
3
4
|
import sys
|
|
4
5
|
import io
|
|
@@ -16,6 +17,7 @@ from .env import Env
|
|
|
16
17
|
|
|
17
18
|
def setup_logging(log_level: int = logging.INFO):
|
|
18
19
|
"""Setup custom CLI logging format with colored output."""
|
|
20
|
+
|
|
19
21
|
class CustomFormatter(logging.Formatter):
|
|
20
22
|
def format(self, record):
|
|
21
23
|
dt = datetime.fromtimestamp(record.created).strftime("%Y-%m-%d %H:%M:%S")
|
|
@@ -49,23 +51,19 @@ def bootstrap(verbosity: int = 1):
|
|
|
49
51
|
Env.logging_level = log_levels_by_verbosity.get(verbosity, logging.INFO)
|
|
50
52
|
setup_logging(Env.logging_level)
|
|
51
53
|
logging.info(
|
|
52
|
-
f"Bootstrapping Gito v{Env.gito_version}... "
|
|
53
|
-
+ mc.ui.gray(f"[verbosity={verbosity}]")
|
|
54
|
+
f"Bootstrapping Gito v{Env.gito_version}... " + mc.ui.gray(f"[verbosity={verbosity}]")
|
|
54
55
|
)
|
|
55
56
|
|
|
56
57
|
# cp1251 is used on Windows when redirecting output
|
|
57
58
|
if sys.stdout.encoding and sys.stdout.encoding.lower() != "utf-8":
|
|
58
|
-
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding=
|
|
59
|
+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
|
|
59
60
|
|
|
60
61
|
try:
|
|
61
62
|
mc.configure(
|
|
62
63
|
DOT_ENV_FILE=HOME_ENV_PATH,
|
|
63
64
|
USE_LOGGING=verbosity >= 1,
|
|
64
65
|
EMBEDDING_DB_TYPE=mc.EmbeddingDbType.NONE,
|
|
65
|
-
PROMPT_TEMPLATES_PATH=[
|
|
66
|
-
PROJECT_GITO_FOLDER,
|
|
67
|
-
Path(__file__).parent / "tpl"
|
|
68
|
-
],
|
|
66
|
+
PROMPT_TEMPLATES_PATH=[PROJECT_GITO_FOLDER, Path(__file__).parent / "tpl"],
|
|
69
67
|
)
|
|
70
68
|
if mc.config().MAX_CONCURRENT_TASKS is None:
|
|
71
69
|
mc.config().MAX_CONCURRENT_TASKS = DEFAULT_MAX_CONCURRENT_TASKS
|
gito/cli.py
CHANGED
|
@@ -38,6 +38,7 @@ from .project_config import ProjectConfig
|
|
|
38
38
|
from .commands.gh_post_review_comment import post_github_cr_comment
|
|
39
39
|
from .commands.gitlab_post_review_comment import post_gitlab_cr_comment
|
|
40
40
|
from .commands.linear_comment import linear_comment
|
|
41
|
+
|
|
41
42
|
# Imported for registering commands
|
|
42
43
|
from .commands import fix, gh_react_to_comment, repl, deploy, version # noqa
|
|
43
44
|
|
|
@@ -61,34 +62,33 @@ def main():
|
|
|
61
62
|
@app.callback(
|
|
62
63
|
invoke_without_command=True,
|
|
63
64
|
help="\bGito is an open-source AI code reviewer that works with any language model provider."
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
"\nIt detects issues in GitHub pull requests or local codebase changes"
|
|
66
|
+
"—instantly, reliably, and without vendor lock-in.",
|
|
66
67
|
)
|
|
67
68
|
def cli(
|
|
68
69
|
ctx: typer.Context,
|
|
69
70
|
verbosity: int = typer.Option(
|
|
70
71
|
None,
|
|
71
|
-
|
|
72
|
+
"--verbosity",
|
|
73
|
+
"-v",
|
|
72
74
|
show_default=False,
|
|
73
75
|
help="\b"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
"Set verbosity level. Supported values: 0-3. Default: 1."
|
|
77
|
+
"\n [ 0 ]: no additional output, "
|
|
78
|
+
"\n [ 1 ]: normal mode, shows warnings, shortened LLM requests and logging.INFO"
|
|
79
|
+
"\n [ 2 ]: verbose mode, show full LLM requests"
|
|
80
|
+
"\n [ 3 ]: very verbose mode, also debug information",
|
|
79
81
|
),
|
|
80
82
|
verbose: bool = typer.Option(
|
|
81
83
|
default=None,
|
|
82
84
|
help="\b"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
"--verbose is equivalent to -v2, "
|
|
86
|
+
"\n--no-verbose is equivalent to -v0. "
|
|
87
|
+
"\n(!) Can't be used together with -v or --verbosity.",
|
|
86
88
|
),
|
|
87
89
|
):
|
|
88
90
|
if verbose is not None and verbosity is not None:
|
|
89
|
-
raise typer.BadParameter(
|
|
90
|
-
"Please specify either --verbose or --verbosity, not both."
|
|
91
|
-
)
|
|
91
|
+
raise typer.BadParameter("Please specify either --verbose or --verbosity, not both.")
|
|
92
92
|
if verbose is not None:
|
|
93
93
|
verbosity = 2 if verbose else 0
|
|
94
94
|
if verbosity is None:
|
|
@@ -127,16 +127,17 @@ def cmd_review(
|
|
|
127
127
|
url: str = typer.Option("", "--url", help="Git repository URL"),
|
|
128
128
|
path: str = typer.Option("", "--path", help="Git repository path"), # @todo: implement
|
|
129
129
|
post_comment: bool = typer.Option(
|
|
130
|
-
default=False,
|
|
131
|
-
help="Post review comment to git platform (GitHub, GitLab, etc.)"
|
|
130
|
+
default=False, help="Post review comment to git platform (GitHub, GitLab, etc.)"
|
|
132
131
|
),
|
|
133
132
|
pr: int = typer.Option(
|
|
134
133
|
default=None,
|
|
135
|
-
help=textwrap.dedent(
|
|
134
|
+
help=textwrap.dedent(
|
|
135
|
+
"""\n
|
|
136
136
|
GitHub Pull Request number or GitLab Merge Request ID to post the comment to
|
|
137
137
|
(for local usage together with --post-comment,
|
|
138
138
|
in the GitHub/GitLab actions PR/MR is resolved from the environment)
|
|
139
|
-
"""
|
|
139
|
+
"""
|
|
140
|
+
),
|
|
140
141
|
),
|
|
141
142
|
out: str = arg_out(),
|
|
142
143
|
all: bool = arg_all(),
|
|
@@ -144,7 +145,7 @@ def cmd_review(
|
|
|
144
145
|
refs, merge_base = _consider_arg_all(all, refs, merge_base)
|
|
145
146
|
_what, _against = args_to_target(refs, what, against)
|
|
146
147
|
pr = pr or os.getenv("PR_NUMBER_FROM_WORKFLOW_DISPATCH")
|
|
147
|
-
with
|
|
148
|
+
with get_repo_context(url, _what) as (repo, out_folder):
|
|
148
149
|
commit_sha = repo.head.commit.hexsha
|
|
149
150
|
try:
|
|
150
151
|
active_branch = repo.active_branch.name
|
|
@@ -161,11 +162,13 @@ def cmd_review(
|
|
|
161
162
|
commit_sha=commit_sha,
|
|
162
163
|
active_branch=active_branch,
|
|
163
164
|
)
|
|
164
|
-
asyncio.run(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
asyncio.run(
|
|
166
|
+
review(
|
|
167
|
+
repo=repo,
|
|
168
|
+
target=review_target,
|
|
169
|
+
out_folder=out or out_folder,
|
|
170
|
+
)
|
|
171
|
+
)
|
|
169
172
|
if post_comment:
|
|
170
173
|
|
|
171
174
|
md_report_file = os.path.join(out or out_folder, GITHUB_MD_REPORT_FILE_NAME)
|
|
@@ -205,22 +208,12 @@ def cmd_answer(
|
|
|
205
208
|
merge_base: bool = typer.Option(default=True, help="Use merge base for comparison"),
|
|
206
209
|
use_pipeline: bool = typer.Option(default=True),
|
|
207
210
|
post_to: str = typer.Option(
|
|
208
|
-
help="Post answer to ... Supported values: linear",
|
|
209
|
-
default=None,
|
|
210
|
-
show_default=False
|
|
211
|
-
),
|
|
212
|
-
pr: int = typer.Option(
|
|
213
|
-
default=None,
|
|
214
|
-
help="GitHub Pull Request number"
|
|
215
|
-
),
|
|
216
|
-
aux_files: list[str] = typer.Option(
|
|
217
|
-
default=None,
|
|
218
|
-
help="Auxiliary files that might be helpful"
|
|
211
|
+
help="Post answer to ... Supported values: linear", default=None, show_default=False
|
|
219
212
|
),
|
|
213
|
+
pr: int = typer.Option(default=None, help="GitHub Pull Request number"),
|
|
214
|
+
aux_files: list[str] = typer.Option(default=None, help="Auxiliary files that might be helpful"),
|
|
220
215
|
save_to: str = typer.Option(
|
|
221
|
-
help="Write the answer to the target file",
|
|
222
|
-
default=None,
|
|
223
|
-
show_default=False
|
|
216
|
+
help="Write the answer to the target file", default=None, show_default=False
|
|
224
217
|
),
|
|
225
218
|
all: bool = arg_all(),
|
|
226
219
|
):
|
|
@@ -243,7 +236,7 @@ def cmd_answer(
|
|
|
243
236
|
pr=pr,
|
|
244
237
|
aux_files=aux_files,
|
|
245
238
|
)
|
|
246
|
-
if post_to ==
|
|
239
|
+
if post_to == "linear":
|
|
247
240
|
logging.info("Posting answer to Linear...")
|
|
248
241
|
linear_comment(remove_html_comments(out))
|
|
249
242
|
if save_to:
|
|
@@ -264,23 +257,19 @@ def setup():
|
|
|
264
257
|
@app.command(name="render", hidden=True)
|
|
265
258
|
def render(
|
|
266
259
|
format: str = typer.Argument(
|
|
267
|
-
default=Report.Format.CLI,
|
|
268
|
-
help="Report format: md (Markdown), cli (terminal)"
|
|
260
|
+
default=Report.Format.CLI, help="Report format: md (Markdown), cli (terminal)"
|
|
269
261
|
),
|
|
270
262
|
source: str = typer.Option(
|
|
271
|
-
"",
|
|
272
|
-
|
|
273
|
-
"--source",
|
|
274
|
-
help="Source file (json) to load the report from"
|
|
275
|
-
)
|
|
263
|
+
"", "--src", "--source", help="Source file (json) to load the report from"
|
|
264
|
+
),
|
|
276
265
|
):
|
|
277
266
|
Report.load(file_name=source).to_cli(report_format=format)
|
|
278
267
|
|
|
279
268
|
|
|
280
269
|
@app.command(
|
|
281
270
|
help="\bList files in the changeset. "
|
|
282
|
-
|
|
283
|
-
|
|
271
|
+
"\nMight be useful to check what will be reviewed if run `gito review` "
|
|
272
|
+
"with current CLI arguments and options."
|
|
284
273
|
)
|
|
285
274
|
def files(
|
|
286
275
|
refs: str = arg_refs(),
|
gito/cli_base.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Common CLI arguments and utilities for Gito commands.
|
|
3
3
|
"""
|
|
4
|
+
|
|
4
5
|
import contextlib
|
|
5
6
|
import logging
|
|
6
7
|
import tempfile
|
|
@@ -57,7 +58,10 @@ def arg_what() -> typer.Option:
|
|
|
57
58
|
|
|
58
59
|
def arg_filters() -> typer.Option:
|
|
59
60
|
return typer.Option(
|
|
60
|
-
"",
|
|
61
|
+
"",
|
|
62
|
+
"--filter",
|
|
63
|
+
"-f",
|
|
64
|
+
"--filters",
|
|
61
65
|
help="""
|
|
62
66
|
filter reviewed files by glob / fnmatch pattern(s),
|
|
63
67
|
e.g. 'src/**/*.py', may be comma-separated
|
|
@@ -67,18 +71,12 @@ def arg_filters() -> typer.Option:
|
|
|
67
71
|
|
|
68
72
|
def arg_out() -> typer.Option:
|
|
69
73
|
return typer.Option(
|
|
70
|
-
None,
|
|
71
|
-
"--out", "-o", "--output",
|
|
72
|
-
help="Output folder for the code review report"
|
|
74
|
+
None, "--out", "-o", "--output", help="Output folder for the code review report"
|
|
73
75
|
)
|
|
74
76
|
|
|
75
77
|
|
|
76
78
|
def arg_against() -> typer.Option:
|
|
77
|
-
return typer.Option(
|
|
78
|
-
None,
|
|
79
|
-
"--against", "-vs", "--vs",
|
|
80
|
-
help="Git ref to compare against"
|
|
81
|
-
)
|
|
79
|
+
return typer.Option(None, "--against", "-vs", "--vs", help="Git ref to compare against")
|
|
82
80
|
|
|
83
81
|
|
|
84
82
|
def arg_all() -> typer.Option:
|
|
@@ -86,10 +84,7 @@ def arg_all() -> typer.Option:
|
|
|
86
84
|
|
|
87
85
|
|
|
88
86
|
@contextlib.contextmanager
|
|
89
|
-
def get_repo_context(
|
|
90
|
-
url: str | None,
|
|
91
|
-
branch: str | None
|
|
92
|
-
) -> Iterator[tuple[Repo, str]]:
|
|
87
|
+
def get_repo_context(url: str | None, branch: str | None) -> Iterator[tuple[Repo, str]]:
|
|
93
88
|
"""
|
|
94
89
|
Context manager for handling both local and remote repositories.
|
|
95
90
|
Yields a tuple of (Repo object, path to the repository)
|