gac 1.6.0__py3-none-any.whl → 1.7.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.
Potentially problematic release.
This version of gac might be problematic. Click here for more details.
- gac/__version__.py +1 -1
- gac/cli.py +1 -1
- gac/git.py +50 -0
- gac/main.py +10 -2
- gac/providers/synthetic.py +4 -0
- {gac-1.6.0.dist-info → gac-1.7.0.dist-info}/METADATA +3 -2
- {gac-1.6.0.dist-info → gac-1.7.0.dist-info}/RECORD +10 -10
- {gac-1.6.0.dist-info → gac-1.7.0.dist-info}/WHEEL +0 -0
- {gac-1.6.0.dist-info → gac-1.7.0.dist-info}/entry_points.txt +0 -0
- {gac-1.6.0.dist-info → gac-1.7.0.dist-info}/licenses/LICENSE +0 -0
gac/__version__.py
CHANGED
gac/cli.py
CHANGED
|
@@ -53,7 +53,7 @@ logger = logging.getLogger(__name__)
|
|
|
53
53
|
help=f"Set log level (default: {config['log_level']})",
|
|
54
54
|
)
|
|
55
55
|
# Advanced options
|
|
56
|
-
@click.option("--no-verify", is_flag=True, help="Skip pre-commit hooks when committing")
|
|
56
|
+
@click.option("--no-verify", is_flag=True, help="Skip pre-commit and lefthook hooks when committing")
|
|
57
57
|
@click.option("--skip-secret-scan", is_flag=True, help="Skip security scan for secrets in staged changes")
|
|
58
58
|
# Other options
|
|
59
59
|
@click.option("--version", is_flag=True, help="Show the version of the Git Auto Commit (gac) tool")
|
gac/git.py
CHANGED
|
@@ -153,6 +153,56 @@ def run_pre_commit_hooks() -> bool:
|
|
|
153
153
|
return True
|
|
154
154
|
|
|
155
155
|
|
|
156
|
+
def run_lefthook_hooks() -> bool:
|
|
157
|
+
"""Run Lefthook hooks if they exist.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
True if Lefthook hooks passed or don't exist, False if they failed.
|
|
161
|
+
"""
|
|
162
|
+
# Check for common Lefthook configuration files
|
|
163
|
+
lefthook_configs = [".lefthook.yml", "lefthook.yml", ".lefthook.yaml", "lefthook.yaml"]
|
|
164
|
+
config_exists = any(os.path.exists(config) for config in lefthook_configs)
|
|
165
|
+
|
|
166
|
+
if not config_exists:
|
|
167
|
+
logger.debug("No Lefthook configuration found, skipping Lefthook hooks")
|
|
168
|
+
return True
|
|
169
|
+
|
|
170
|
+
# Check if lefthook is installed and configured
|
|
171
|
+
try:
|
|
172
|
+
# First check if lefthook is installed
|
|
173
|
+
result = run_subprocess(["lefthook", "--version"], silent=True, raise_on_error=False)
|
|
174
|
+
if not result:
|
|
175
|
+
logger.debug("Lefthook not installed, skipping hooks")
|
|
176
|
+
return True
|
|
177
|
+
|
|
178
|
+
# Run lefthook hooks on staged files
|
|
179
|
+
logger.info("Running Lefthook hooks...")
|
|
180
|
+
# Run lefthook and capture both stdout and stderr
|
|
181
|
+
result = subprocess.run(["lefthook", "run", "pre-commit"], capture_output=True, text=True, check=False)
|
|
182
|
+
|
|
183
|
+
if result.returncode == 0:
|
|
184
|
+
# All hooks passed
|
|
185
|
+
return True
|
|
186
|
+
else:
|
|
187
|
+
# Lefthook hooks failed - show the output
|
|
188
|
+
output = result.stdout if result.stdout else ""
|
|
189
|
+
error = result.stderr if result.stderr else ""
|
|
190
|
+
|
|
191
|
+
# Combine outputs (lefthook usually outputs to stdout)
|
|
192
|
+
full_output = output + ("\n" + error if error else "")
|
|
193
|
+
|
|
194
|
+
if full_output.strip():
|
|
195
|
+
# Show which hooks failed and why
|
|
196
|
+
logger.error(f"Lefthook hooks failed:\n{full_output}")
|
|
197
|
+
else:
|
|
198
|
+
logger.error(f"Lefthook hooks failed with exit code {result.returncode}")
|
|
199
|
+
return False
|
|
200
|
+
except Exception as e:
|
|
201
|
+
logger.debug(f"Error running Lefthook: {e}")
|
|
202
|
+
# If lefthook isn't available, don't block the commit
|
|
203
|
+
return True
|
|
204
|
+
|
|
205
|
+
|
|
156
206
|
def push_changes() -> bool:
|
|
157
207
|
"""Push committed changes to the remote repository."""
|
|
158
208
|
remote_exists = run_git_command(["remote"])
|
gac/main.py
CHANGED
|
@@ -19,6 +19,7 @@ from gac.git import (
|
|
|
19
19
|
get_staged_files,
|
|
20
20
|
push_changes,
|
|
21
21
|
run_git_command,
|
|
22
|
+
run_lefthook_hooks,
|
|
22
23
|
run_pre_commit_hooks,
|
|
23
24
|
)
|
|
24
25
|
from gac.preprocess import preprocess_diff
|
|
@@ -80,11 +81,18 @@ def main(
|
|
|
80
81
|
)
|
|
81
82
|
sys.exit(0)
|
|
82
83
|
|
|
83
|
-
# Run pre-commit hooks before doing expensive operations
|
|
84
|
+
# Run pre-commit and lefthook hooks before doing expensive operations
|
|
84
85
|
if not no_verify and not dry_run:
|
|
86
|
+
# Run lefthook hooks
|
|
87
|
+
if not run_lefthook_hooks():
|
|
88
|
+
console.print("[red]Lefthook hooks failed. Please fix the issues and try again.[/red]")
|
|
89
|
+
console.print("[yellow]You can use --no-verify to skip pre-commit and lefthook hooks.[/yellow]")
|
|
90
|
+
sys.exit(1)
|
|
91
|
+
|
|
92
|
+
# Run pre-commit hooks
|
|
85
93
|
if not run_pre_commit_hooks():
|
|
86
94
|
console.print("[red]Pre-commit hooks failed. Please fix the issues and try again.[/red]")
|
|
87
|
-
console.print("[yellow]You can use --no-verify to skip pre-commit hooks.[/yellow]")
|
|
95
|
+
console.print("[yellow]You can use --no-verify to skip pre-commit and lefthook hooks.[/yellow]")
|
|
88
96
|
sys.exit(1)
|
|
89
97
|
|
|
90
98
|
status = run_git_command(["status"])
|
gac/providers/synthetic.py
CHANGED
|
@@ -9,6 +9,10 @@ from gac.errors import AIError
|
|
|
9
9
|
|
|
10
10
|
def call_synthetic_api(model: str, messages: list[dict], temperature: float, max_tokens: int) -> str:
|
|
11
11
|
"""Call Synthetic API directly."""
|
|
12
|
+
# Handle model names without hf: prefix
|
|
13
|
+
if not model.startswith("hf:"):
|
|
14
|
+
model = f"hf:{model}"
|
|
15
|
+
|
|
12
16
|
api_key = os.getenv("SYNTHETIC_API_KEY") or os.getenv("SYN_API_KEY")
|
|
13
17
|
if not api_key:
|
|
14
18
|
raise AIError.authentication_error("SYNTHETIC_API_KEY or SYN_API_KEY not found in environment variables")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gac
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: AI-powered Git commit message generator with multi-provider support
|
|
5
5
|
Project-URL: Homepage, https://github.com/cellwebb/gac
|
|
6
6
|
Project-URL: Documentation, https://github.com/cellwebb/gac#readme
|
|
@@ -24,6 +24,7 @@ Requires-Python: >=3.10
|
|
|
24
24
|
Requires-Dist: anthropic>=0.68.0
|
|
25
25
|
Requires-Dist: click>=8.3.0
|
|
26
26
|
Requires-Dist: halo
|
|
27
|
+
Requires-Dist: httpcore>=1.0.9
|
|
27
28
|
Requires-Dist: httpx>=0.28.0
|
|
28
29
|
Requires-Dist: pydantic>=2.12.0
|
|
29
30
|
Requires-Dist: python-dotenv>=1.1.1
|
|
@@ -33,8 +34,8 @@ Requires-Dist: sumy
|
|
|
33
34
|
Requires-Dist: tiktoken>=0.12.0
|
|
34
35
|
Provides-Extra: dev
|
|
35
36
|
Requires-Dist: build; extra == 'dev'
|
|
36
|
-
Requires-Dist: bump-my-version; extra == 'dev'
|
|
37
37
|
Requires-Dist: codecov; extra == 'dev'
|
|
38
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
38
39
|
Requires-Dist: pytest; extra == 'dev'
|
|
39
40
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
40
41
|
Requires-Dist: ruff; extra == 'dev'
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
gac/__init__.py,sha256=z9yGInqtycFIT3g1ca24r-A3699hKVaRqGUI79wsmMc,415
|
|
2
|
-
gac/__version__.py,sha256=
|
|
2
|
+
gac/__version__.py,sha256=L6MpQn4MvY1iBqe5JKHqziZ_4QZ8oM9bg0eQA4ifKS0,66
|
|
3
3
|
gac/ai.py,sha256=zl9-rmESKTHP2KNstS4sBqMGvGNC-KYcEsPPCpshaUE,3456
|
|
4
4
|
gac/ai_utils.py,sha256=6iSz2q8MohNf2M3CNmF_9eNRDuACLB2kuh_Q9bRrvdE,7252
|
|
5
|
-
gac/cli.py,sha256=
|
|
5
|
+
gac/cli.py,sha256=nvJW_FmS0xA8Vs7x-JdIu4mW9Ze7IelYP8bnZYVFB4E,4885
|
|
6
6
|
gac/config.py,sha256=N62phuLUyVj54eLDiDL6VN8-2_Zt6yB5zsnimFavU3I,1630
|
|
7
7
|
gac/config_cli.py,sha256=v9nFHZO1RvK9fzHyuUS6SG-BCLHMsdOMDwWamBhVVh4,1608
|
|
8
8
|
gac/constants.py,sha256=hGzmLGhVDB2KPIqwtl6tHMNuSwHj-2P1RK0cGm4pyNA,4962
|
|
9
9
|
gac/diff_cli.py,sha256=wnVQ9OFGnM0d2Pj9WVjWbo0jxqIuRHVAwmb8wU9Pa3E,5676
|
|
10
10
|
gac/errors.py,sha256=ysDIVRCd0YQVTOW3Q6YzdolxCdtkoQCAFf3_jrqbjUY,7916
|
|
11
|
-
gac/git.py,sha256=
|
|
11
|
+
gac/git.py,sha256=_Co25XA1Nku03h50C_HiEf4ugEz6rK5j_IYi-rr5gco,8005
|
|
12
12
|
gac/init_cli.py,sha256=_0FAdJCgrdV61bUVmQm5ykX5TlCsOUcyKKlRY6zav5A,4638
|
|
13
|
-
gac/main.py,sha256=
|
|
13
|
+
gac/main.py,sha256=ot1DEbJHsZ0SzdZUuRXIm9pz1xbm4hxARzUjwytGdfc,15670
|
|
14
14
|
gac/preprocess.py,sha256=krrLPHsccYMdn_YAtUrppBJIoRgevxGWusDwhE40LEo,15366
|
|
15
15
|
gac/prompt.py,sha256=K6r9q2cAlyPu1fud6-jJsZ4zeweEo3yt6_WeYv8a_SQ,17087
|
|
16
16
|
gac/security.py,sha256=M1MZm6BLOeKl6rH_-UdXsSKol39FnA5fIP3YP394yZE,9898
|
|
@@ -25,10 +25,10 @@ gac/providers/ollama.py,sha256=hPkagbhEiAoH9RTET4EQe9-lTL0YmMRCbQ5dVbRQw6Q,2095
|
|
|
25
25
|
gac/providers/openai.py,sha256=iHVD6bHf57W-QmW7u1Ee5vOpev7XZ-K75NcolLfebOk,1630
|
|
26
26
|
gac/providers/openrouter.py,sha256=H3ce8JcRUYq1I30lOjGESdX7jfoPkW3mKAYnc2aYfBw,2204
|
|
27
27
|
gac/providers/streamlake.py,sha256=KAA2ZnpuEI5imzvdWVWUhEBHSP0BMnprKXte6CbwBWY,2047
|
|
28
|
-
gac/providers/synthetic.py,sha256=
|
|
28
|
+
gac/providers/synthetic.py,sha256=sRMIJTS9LpcXd9A7qp_ZjZxdqtTKRn9fl1W4YwJZP4c,1855
|
|
29
29
|
gac/providers/zai.py,sha256=kywhhrCfPBu0rElZyb-iENxQxxpVGykvePuL4xrXlaU,2739
|
|
30
|
-
gac-1.
|
|
31
|
-
gac-1.
|
|
32
|
-
gac-1.
|
|
33
|
-
gac-1.
|
|
34
|
-
gac-1.
|
|
30
|
+
gac-1.7.0.dist-info/METADATA,sha256=XOzizYkY74pU6HBlPUTWTmyE6ZMhRVTkTwqBsVugTNg,9847
|
|
31
|
+
gac-1.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
32
|
+
gac-1.7.0.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
|
|
33
|
+
gac-1.7.0.dist-info/licenses/LICENSE,sha256=vOab37NouL1PNs5BswnPayrMCqaN2sqLfMQfqPDrpZg,1103
|
|
34
|
+
gac-1.7.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|