ai-cr 3.1.1__tar.gz → 3.1.2__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.
- {ai_cr-3.1.1 → ai_cr-3.1.2}/PKG-INFO +1 -1
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/commands/deploy.py +46 -12
- {ai_cr-3.1.1 → ai_cr-3.1.2}/pyproject.toml +1 -1
- {ai_cr-3.1.1 → ai_cr-3.1.2}/LICENSE +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/README.md +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/__init__.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/__main__.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/bootstrap.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/cli.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/cli_base.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/commands/__init__.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/commands/fix.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/commands/gh_post_review_comment.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/commands/gh_react_to_comment.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/commands/linear_comment.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/commands/repl.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/commands/version.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/config.toml +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/constants.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/context.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/core.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/env.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/gh_api.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/issue_trackers.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/pipeline.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/pipeline_steps/__init__.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/pipeline_steps/jira.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/pipeline_steps/linear.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/project_config.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/report_struct.py +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/tpl/github_workflows/components/env-vars.j2 +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/tpl/github_workflows/components/installs.j2 +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/tpl/github_workflows/gito-code-review.yml.j2 +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/tpl/github_workflows/gito-react-to-comments.yml.j2 +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/tpl/questions/changes_summary.j2 +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/tpl/questions/release_notes.j2 +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/tpl/questions/testing_guide.j2 +0 -0
- {ai_cr-3.1.1 → ai_cr-3.1.2}/gito/utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: ai-cr
|
3
|
-
Version: 3.1.
|
3
|
+
Version: 3.1.2
|
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
|
@@ -1,16 +1,31 @@
|
|
1
|
+
import logging
|
1
2
|
from pathlib import Path
|
2
3
|
|
3
4
|
import microcore as mc
|
4
5
|
from microcore import ApiType, ui, utils
|
5
|
-
from git import Repo
|
6
|
+
from git import Repo, GitCommandError
|
7
|
+
import typer
|
6
8
|
|
9
|
+
from ..core import get_base_branch
|
7
10
|
from ..utils import version, extract_gh_owner_repo
|
8
11
|
from ..cli_base import app
|
12
|
+
from ..gh_api import gh_api
|
9
13
|
|
10
14
|
|
11
15
|
@app.command(name="deploy", help="Deploy Gito workflows to GitHub Actions")
|
12
16
|
@app.command(name="init", hidden=True)
|
13
|
-
def deploy(
|
17
|
+
def deploy(
|
18
|
+
api_type: ApiType = None,
|
19
|
+
commit: bool = None,
|
20
|
+
rewrite: bool = False,
|
21
|
+
to_branch: str = typer.Option(
|
22
|
+
default="gito_deploy",
|
23
|
+
help="Branch name for new PR containing with Gito workflows commit"
|
24
|
+
),
|
25
|
+
token: str = typer.Option(
|
26
|
+
"", help="GitHub token (or set GITHUB_TOKEN env var)"
|
27
|
+
),
|
28
|
+
):
|
14
29
|
repo = Repo(".")
|
15
30
|
workflow_files = dict(
|
16
31
|
code_review=Path(".github/workflows/gito-code-review.yml"),
|
@@ -77,16 +92,35 @@ def deploy(api_type: ApiType = None, commit: bool = None, rewrite: bool = False)
|
|
77
92
|
"Do you want to commit and push created GitHub workflows to a new branch?"
|
78
93
|
):
|
79
94
|
repo.git.add([str(file) for file in workflow_files.values()])
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
95
|
+
if not repo.active_branch.name.startswith(to_branch):
|
96
|
+
repo.git.checkout("-b", to_branch)
|
97
|
+
try:
|
98
|
+
repo.git.commit("-m", "Deploy Gito workflows")
|
99
|
+
except GitCommandError as e:
|
100
|
+
if "nothing added" in str(e):
|
101
|
+
ui.warning("Failed to commit changes: nothing was added")
|
102
|
+
else:
|
103
|
+
ui.error(f"Failed to commit changes: {e}")
|
104
|
+
return False
|
105
|
+
|
106
|
+
repo.git.push("origin", to_branch)
|
107
|
+
print(f"Changes pushed to {to_branch} branch.")
|
108
|
+
try:
|
109
|
+
api = gh_api(repo=repo)
|
110
|
+
base = get_base_branch(repo).split('/')[-1]
|
111
|
+
logging.info(f"Creating PR {ui.green(to_branch)} -> {ui.yellow(base)}...")
|
112
|
+
res = api.pulls.create(
|
113
|
+
head=to_branch,
|
114
|
+
base=base,
|
115
|
+
title="Deploy Gito workflows",
|
116
|
+
)
|
117
|
+
print(f"Pull request #{res.number} created successfully:\n{res.html_url}")
|
118
|
+
except Exception as e:
|
119
|
+
mc.ui.error(f"Failed to create pull request automatically: {e}")
|
120
|
+
print(
|
121
|
+
f"Please create a PR from '{to_branch}' to your main branch and merge it:\n"
|
122
|
+
f"https://github.com/{owner}/{repo_name}/compare/{to_branch}?expand=1"
|
123
|
+
)
|
90
124
|
else:
|
91
125
|
print(
|
92
126
|
"Now you can commit and push created GitHub workflows to your main repository branch.\n"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "ai-cr"
|
3
|
-
version = "3.1.
|
3
|
+
version = "3.1.2"
|
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"
|
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
|
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
|