github-code-review 3.2.2__tar.gz → 3.3.1__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.2.2 → github_code_review-3.3.1}/PKG-INFO +2 -2
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/cli.py +12 -1
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/cli_base.py +11 -1
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/config.toml +2 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/constants.py +1 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/core.py +16 -4
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/env.py +1 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/utils.py +3 -3
- {github_code_review-3.2.2 → github_code_review-3.3.1}/pyproject.toml +2 -2
- {github_code_review-3.2.2 → github_code_review-3.3.1}/LICENSE +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/README.md +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/__init__.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/__main__.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/bootstrap.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/commands/__init__.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/commands/deploy.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/commands/fix.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/commands/gh_post_review_comment.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/commands/gh_react_to_comment.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/commands/linear_comment.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/commands/repl.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/commands/version.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/context.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/gh_api.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/issue_trackers.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/pipeline.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/pipeline_steps/__init__.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/pipeline_steps/jira.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/pipeline_steps/linear.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/project_config.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/report_struct.py +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/answer.j2 +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/github_workflows/components/env-vars.j2 +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/github_workflows/components/installs.j2 +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/github_workflows/gito-code-review.yml.j2 +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/github_workflows/gito-react-to-comments.yml.j2 +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/partial/aux_files.j2 +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/questions/changes_summary.j2 +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/questions/release_notes.j2 +0 -0
- {github_code_review-3.2.2 → github_code_review-3.3.1}/gito/tpl/questions/test_cases.j2 +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: github-code-review
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.1
|
|
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
|
Keywords: static code analysis,code review,code quality,ai,coding,assistant,llm,github,automation,devops,developer tools,github actions,workflows,git
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Topic :: Software Development
|
|
18
18
|
Requires-Dist: GitPython (>=3.1.44,<4.0.0)
|
|
19
|
-
Requires-Dist: ai-microcore (==4.
|
|
19
|
+
Requires-Dist: ai-microcore (==4.4.2)
|
|
20
20
|
Requires-Dist: anthropic (>=0.57.1,<0.58.0)
|
|
21
21
|
Requires-Dist: ghapi (>=1.0.6,<1.1.0)
|
|
22
22
|
Requires-Dist: google-generativeai (>=0.8.5,<0.9.0)
|
|
@@ -7,6 +7,7 @@ import textwrap
|
|
|
7
7
|
import microcore as mc
|
|
8
8
|
import typer
|
|
9
9
|
from git import Repo
|
|
10
|
+
from gito.constants import REFS_VALUE_ALL
|
|
10
11
|
|
|
11
12
|
from .core import review, get_diff, filter_diff, answer
|
|
12
13
|
from .cli_base import (
|
|
@@ -97,6 +98,7 @@ def cmd_review(
|
|
|
97
98
|
filters: str = arg_filters(),
|
|
98
99
|
merge_base: bool = typer.Option(default=True, help="Use merge base for comparison"),
|
|
99
100
|
url: str = typer.Option("", "--url", help="Git repository URL"),
|
|
101
|
+
path: str = typer.Option("", "--path", help="Git repository path"),
|
|
100
102
|
post_comment: bool = typer.Option(default=False, help="Post review comment to GitHub"),
|
|
101
103
|
pr: int = typer.Option(
|
|
102
104
|
default=None,
|
|
@@ -106,8 +108,17 @@ def cmd_review(
|
|
|
106
108
|
in the github actions PR is resolved from the environment)
|
|
107
109
|
""")
|
|
108
110
|
),
|
|
109
|
-
out: str = arg_out()
|
|
111
|
+
out: str = arg_out(),
|
|
112
|
+
all: bool = typer.Option(default=False, help="Review all codebase"),
|
|
110
113
|
):
|
|
114
|
+
if all:
|
|
115
|
+
if refs and refs != REFS_VALUE_ALL:
|
|
116
|
+
raise typer.BadParameter(
|
|
117
|
+
"The --all option overrides the refs argument. "
|
|
118
|
+
"Please remove the refs argument if you want to review all codebase."
|
|
119
|
+
)
|
|
120
|
+
refs = REFS_VALUE_ALL
|
|
121
|
+
merge_base = False
|
|
111
122
|
_what, _against = args_to_target(refs, what, against)
|
|
112
123
|
pr = pr or os.getenv("PR_NUMBER_FROM_WORKFLOW_DISPATCH")
|
|
113
124
|
with get_repo_context(url, _what) as (repo, out_folder):
|
|
@@ -5,10 +5,15 @@ import tempfile
|
|
|
5
5
|
import microcore as mc
|
|
6
6
|
import typer
|
|
7
7
|
from git import Repo
|
|
8
|
-
from gito.
|
|
8
|
+
from gito.constants import REFS_VALUE_ALL
|
|
9
|
+
|
|
10
|
+
from .utils import parse_refs_pair
|
|
11
|
+
from .env import Env
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
def args_to_target(refs, what, against) -> tuple[str | None, str | None]:
|
|
15
|
+
if refs == REFS_VALUE_ALL:
|
|
16
|
+
return REFS_VALUE_ALL, None
|
|
12
17
|
_what, _against = parse_refs_pair(refs)
|
|
13
18
|
if _what:
|
|
14
19
|
if what:
|
|
@@ -73,6 +78,8 @@ app = typer.Typer(pretty_exceptions_show_locals=False)
|
|
|
73
78
|
|
|
74
79
|
@contextlib.contextmanager
|
|
75
80
|
def get_repo_context(url: str, branch: str):
|
|
81
|
+
if branch == REFS_VALUE_ALL:
|
|
82
|
+
branch = None
|
|
76
83
|
"""Context manager for handling both local and remote repositories."""
|
|
77
84
|
if url:
|
|
78
85
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
@@ -81,10 +88,13 @@ def get_repo_context(url: str, branch: str):
|
|
|
81
88
|
f"Cloning [{mc.ui.green(url)}] to {mc.utils.file_link(temp_dir)} ..."
|
|
82
89
|
)
|
|
83
90
|
repo = Repo.clone_from(url, branch=branch, to_path=temp_dir)
|
|
91
|
+
prev_folder = Env.working_folder
|
|
92
|
+
Env.working_folder = temp_dir
|
|
84
93
|
try:
|
|
85
94
|
yield repo, temp_dir
|
|
86
95
|
finally:
|
|
87
96
|
repo.close()
|
|
97
|
+
Env.working_folder = prev_folder
|
|
88
98
|
else:
|
|
89
99
|
logging.info("get_repo_context: Using local repo...")
|
|
90
100
|
repo = Repo(".")
|
|
@@ -204,12 +204,14 @@ Summarize the code review in one sentence.
|
|
|
204
204
|
--Issues Detected by You--
|
|
205
205
|
{{ issues | tojson(indent=2) }}
|
|
206
206
|
---
|
|
207
|
+
{% if awards -%}
|
|
207
208
|
If the code changes include exceptional achievements, you may also present an award to the author in the summary text.
|
|
208
209
|
- (!) Only give awards to initial codebase authors, NOT to reviewers.
|
|
209
210
|
- (!) If you give an award, place the hidden <!-- award --> HTML comment on its own line immediately before the award text.
|
|
210
211
|
--Available Awards--
|
|
211
212
|
{{ awards }}
|
|
212
213
|
---
|
|
214
|
+
{%- endif %}
|
|
213
215
|
{% if pipeline_out.associated_issue and pipeline_out.associated_issue.title %}
|
|
214
216
|
----SUBTASK----
|
|
215
217
|
Include one sentence about how the code changes address the requirements of the associated issue listed below.
|
|
@@ -12,3 +12,4 @@ EXECUTABLE = "gito"
|
|
|
12
12
|
TEXT_ICON_URL = 'https://raw.githubusercontent.com/Nayjest/Gito/main/press-kit/logo/gito-bot-1_64top.png' # noqa: E501
|
|
13
13
|
HTML_TEXT_ICON = f'<a href="https://github.com/Nayjest/Gito"><img src="{TEXT_ICON_URL}" align="left" width=64 height=50 title="Gito v{Env.gito_version}"/></a>' # noqa: E501
|
|
14
14
|
HTML_CR_COMMENT_MARKER = '<!-- GITO_COMMENT:CODE_REVIEW_REPORT -->'
|
|
15
|
+
REFS_VALUE_ALL = '!all'
|
|
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
from functools import partial
|
|
7
7
|
|
|
8
8
|
import microcore as mc
|
|
9
|
+
from gito.constants import REFS_VALUE_ALL
|
|
9
10
|
from gito.gh_api import gh_api
|
|
10
11
|
from microcore import ui
|
|
11
12
|
from git import Repo, Commit
|
|
@@ -115,6 +116,11 @@ def get_diff(
|
|
|
115
116
|
pr: str | int = None
|
|
116
117
|
) -> PatchSet | list[PatchedFile]:
|
|
117
118
|
repo = repo or Repo(".")
|
|
119
|
+
if what == REFS_VALUE_ALL:
|
|
120
|
+
what = get_base_branch(repo, pr=pr)
|
|
121
|
+
# Git's canonical empty tree hash
|
|
122
|
+
against = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
|
|
123
|
+
use_merge_base = False
|
|
118
124
|
if not against:
|
|
119
125
|
# 'origin/main', 'origin/master', etc
|
|
120
126
|
against = get_base_branch(repo, pr=pr)
|
|
@@ -331,9 +337,11 @@ def _prepare(
|
|
|
331
337
|
file_diff.path,
|
|
332
338
|
cfg.max_code_tokens
|
|
333
339
|
- mc.tokenizing.num_tokens_from_string(str(file_diff)),
|
|
334
|
-
use_local_files=review_subject_is_index(what)
|
|
340
|
+
use_local_files=review_subject_is_index(what) or what == REFS_VALUE_ALL
|
|
335
341
|
)
|
|
336
|
-
if
|
|
342
|
+
if (
|
|
343
|
+
file_diff.target_file != DEV_NULL and not file_diff.is_added_file
|
|
344
|
+
) or what == REFS_VALUE_ALL
|
|
337
345
|
else ""
|
|
338
346
|
)
|
|
339
347
|
for file_diff in diff
|
|
@@ -385,6 +393,7 @@ async def review(
|
|
|
385
393
|
out_folder: str | os.PathLike | None = None,
|
|
386
394
|
pr: str | int = None
|
|
387
395
|
):
|
|
396
|
+
reviewing_all = what == REFS_VALUE_ALL
|
|
388
397
|
try:
|
|
389
398
|
repo, cfg, diff, lines = _prepare(
|
|
390
399
|
repo=repo,
|
|
@@ -401,8 +410,11 @@ async def review(
|
|
|
401
410
|
[
|
|
402
411
|
mc.prompt(
|
|
403
412
|
cfg.prompt,
|
|
404
|
-
input=
|
|
405
|
-
|
|
413
|
+
input=(
|
|
414
|
+
file_diff if not reviewing_all
|
|
415
|
+
else str(file_diff.path) + ":\n" + lines[file_diff.path]
|
|
416
|
+
),
|
|
417
|
+
file_lines=lines[file_diff.path] if not reviewing_all else None,
|
|
406
418
|
**cfg.prompt_vars,
|
|
407
419
|
)
|
|
408
420
|
for file_diff in diff
|
|
@@ -10,7 +10,7 @@ from typing import Optional
|
|
|
10
10
|
import typer
|
|
11
11
|
import git
|
|
12
12
|
from git import Repo
|
|
13
|
-
|
|
13
|
+
from .env import Env
|
|
14
14
|
|
|
15
15
|
_EXT_TO_HINT: dict[str, str] = {
|
|
16
16
|
# scripting & languages
|
|
@@ -194,10 +194,10 @@ def detect_github_env() -> dict:
|
|
|
194
194
|
"github_ref": ref,
|
|
195
195
|
}
|
|
196
196
|
# Fallback for local usage: try to get from git
|
|
197
|
-
if not repo:
|
|
197
|
+
if not repo or repo == "octocat/Hello-World":
|
|
198
198
|
git_repo = None
|
|
199
199
|
try:
|
|
200
|
-
git_repo = Repo(
|
|
200
|
+
git_repo = Repo(Env.working_folder, search_parent_directories=True)
|
|
201
201
|
origin = git_repo.remotes.origin.url
|
|
202
202
|
# e.g. git@github.com:Nayjest/ai-code-review.git -> Nayjest/ai-code-review
|
|
203
203
|
match = re.search(r"[:/]([\w\-]+)/([\w\-\.]+?)(\.git)?$", origin)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "github-code-review"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.3.1"
|
|
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.4.2"
|
|
25
25
|
GitPython = "^3.1.44"
|
|
26
26
|
unidiff = "^0.7.5"
|
|
27
27
|
google-generativeai = "^0.8.5"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_code_review-3.2.2 → github_code_review-3.3.1}/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
|