gac 2.4.0__py3-none-any.whl → 2.5.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 +9 -0
- gac/config.py +1 -0
- gac/constants.py +1 -0
- gac/git.py +7 -7
- gac/main.py +7 -2
- {gac-2.4.0.dist-info → gac-2.5.0.dist-info}/METADATA +2 -2
- {gac-2.4.0.dist-info → gac-2.5.0.dist-info}/RECORD +11 -11
- {gac-2.4.0.dist-info → gac-2.5.0.dist-info}/WHEEL +0 -0
- {gac-2.4.0.dist-info → gac-2.5.0.dist-info}/entry_points.txt +0 -0
- {gac-2.4.0.dist-info → gac-2.5.0.dist-info}/licenses/LICENSE +0 -0
gac/__version__.py
CHANGED
gac/cli.py
CHANGED
|
@@ -66,6 +66,12 @@ logger = logging.getLogger(__name__)
|
|
|
66
66
|
# Advanced options
|
|
67
67
|
@click.option("--no-verify", is_flag=True, help="Skip pre-commit and lefthook hooks when committing")
|
|
68
68
|
@click.option("--skip-secret-scan", is_flag=True, help="Skip security scan for secrets in staged changes")
|
|
69
|
+
@click.option(
|
|
70
|
+
"--hook-timeout",
|
|
71
|
+
type=int,
|
|
72
|
+
default=0,
|
|
73
|
+
help="Timeout for pre-commit and lefthook hooks in seconds (0 to use configuration)",
|
|
74
|
+
)
|
|
69
75
|
# Other options
|
|
70
76
|
@click.option("--version", is_flag=True, help="Show the version of the Git Auto Commit (gac) tool")
|
|
71
77
|
@click.pass_context
|
|
@@ -88,6 +94,7 @@ def cli(
|
|
|
88
94
|
verbose: bool = False,
|
|
89
95
|
no_verify: bool = False,
|
|
90
96
|
skip_secret_scan: bool = False,
|
|
97
|
+
hook_timeout: int = 0,
|
|
91
98
|
) -> None:
|
|
92
99
|
"""Git Auto Commit - Generate commit messages with AI."""
|
|
93
100
|
if ctx.invoked_subcommand is None:
|
|
@@ -126,6 +133,7 @@ def cli(
|
|
|
126
133
|
no_verify=no_verify,
|
|
127
134
|
skip_secret_scan=skip_secret_scan or bool(config.get("skip_secret_scan", False)),
|
|
128
135
|
language=resolved_language,
|
|
136
|
+
hook_timeout=hook_timeout if hook_timeout > 0 else int(config.get("hook_timeout", 120)),
|
|
129
137
|
)
|
|
130
138
|
except Exception as e:
|
|
131
139
|
handle_error(e, exit_program=True)
|
|
@@ -151,6 +159,7 @@ def cli(
|
|
|
151
159
|
"verbose": verbose,
|
|
152
160
|
"no_verify": no_verify,
|
|
153
161
|
"skip_secret_scan": skip_secret_scan,
|
|
162
|
+
"hook_timeout": hook_timeout,
|
|
154
163
|
}
|
|
155
164
|
|
|
156
165
|
|
gac/config.py
CHANGED
|
@@ -42,6 +42,7 @@ def load_config() -> dict[str, str | int | float | bool | None]:
|
|
|
42
42
|
"language": os.getenv("GAC_LANGUAGE"),
|
|
43
43
|
"translate_prefixes": os.getenv("GAC_TRANSLATE_PREFIXES", "false").lower() in ("true", "1", "yes", "on"),
|
|
44
44
|
"rtl_confirmed": os.getenv("GAC_RTL_CONFIRMED", "false").lower() in ("true", "1", "yes", "on"),
|
|
45
|
+
"hook_timeout": int(os.getenv("GAC_HOOK_TIMEOUT", EnvDefaults.HOOK_TIMEOUT)),
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
return config
|
gac/constants.py
CHANGED
gac/git.py
CHANGED
|
@@ -33,7 +33,7 @@ def run_subprocess_with_encoding_fallback(
|
|
|
33
33
|
from gac.utils import get_safe_encodings
|
|
34
34
|
|
|
35
35
|
encodings = get_safe_encodings()
|
|
36
|
-
last_exception = None
|
|
36
|
+
last_exception: Exception | None = None
|
|
37
37
|
|
|
38
38
|
for encoding in encodings:
|
|
39
39
|
try:
|
|
@@ -205,7 +205,7 @@ def get_commit_hash() -> str:
|
|
|
205
205
|
return result
|
|
206
206
|
|
|
207
207
|
|
|
208
|
-
def run_pre_commit_hooks() -> bool:
|
|
208
|
+
def run_pre_commit_hooks(hook_timeout: int = 120) -> bool:
|
|
209
209
|
"""Run pre-commit hooks if they exist.
|
|
210
210
|
|
|
211
211
|
Returns:
|
|
@@ -225,9 +225,9 @@ def run_pre_commit_hooks() -> bool:
|
|
|
225
225
|
return True
|
|
226
226
|
|
|
227
227
|
# Run pre-commit hooks on staged files
|
|
228
|
-
logger.info("Running pre-commit hooks...")
|
|
228
|
+
logger.info(f"Running pre-commit hooks with {hook_timeout}s timeout...")
|
|
229
229
|
# Run pre-commit and capture both stdout and stderr
|
|
230
|
-
result = run_subprocess_with_encoding_fallback(["pre-commit", "run"])
|
|
230
|
+
result = run_subprocess_with_encoding_fallback(["pre-commit", "run"], timeout=hook_timeout)
|
|
231
231
|
|
|
232
232
|
if result.returncode == 0:
|
|
233
233
|
# All hooks passed
|
|
@@ -252,7 +252,7 @@ def run_pre_commit_hooks() -> bool:
|
|
|
252
252
|
return True
|
|
253
253
|
|
|
254
254
|
|
|
255
|
-
def run_lefthook_hooks() -> bool:
|
|
255
|
+
def run_lefthook_hooks(hook_timeout: int = 120) -> bool:
|
|
256
256
|
"""Run Lefthook hooks if they exist.
|
|
257
257
|
|
|
258
258
|
Returns:
|
|
@@ -275,9 +275,9 @@ def run_lefthook_hooks() -> bool:
|
|
|
275
275
|
return True
|
|
276
276
|
|
|
277
277
|
# Run lefthook hooks on staged files
|
|
278
|
-
logger.info("Running Lefthook hooks...")
|
|
278
|
+
logger.info(f"Running Lefthook hooks with {hook_timeout}s timeout...")
|
|
279
279
|
# Run lefthook and capture both stdout and stderr
|
|
280
|
-
result = run_subprocess_with_encoding_fallback(["lefthook", "run", "pre-commit"])
|
|
280
|
+
result = run_subprocess_with_encoding_fallback(["lefthook", "run", "pre-commit"], timeout=hook_timeout)
|
|
281
281
|
|
|
282
282
|
if result.returncode == 0:
|
|
283
283
|
# All hooks passed
|
gac/main.py
CHANGED
|
@@ -134,6 +134,7 @@ def execute_grouped_commits_workflow(
|
|
|
134
134
|
dry_run: bool,
|
|
135
135
|
push: bool,
|
|
136
136
|
show_prompt: bool,
|
|
137
|
+
hook_timeout: int = 120,
|
|
137
138
|
) -> None:
|
|
138
139
|
"""Execute the grouped commits workflow."""
|
|
139
140
|
import json
|
|
@@ -389,6 +390,7 @@ def execute_single_commit_workflow(
|
|
|
389
390
|
dry_run: bool,
|
|
390
391
|
push: bool,
|
|
391
392
|
show_prompt: bool,
|
|
393
|
+
hook_timeout: int = 120,
|
|
392
394
|
) -> None:
|
|
393
395
|
if show_prompt:
|
|
394
396
|
full_prompt = f"SYSTEM PROMPT:\n{system_prompt}\n\nUSER PROMPT:\n{user_prompt}"
|
|
@@ -497,6 +499,7 @@ def main(
|
|
|
497
499
|
no_verify: bool = False,
|
|
498
500
|
skip_secret_scan: bool = False,
|
|
499
501
|
language: str | None = None,
|
|
502
|
+
hook_timeout: int = 120,
|
|
500
503
|
) -> None:
|
|
501
504
|
"""Main application logic for gac."""
|
|
502
505
|
try:
|
|
@@ -549,12 +552,12 @@ def main(
|
|
|
549
552
|
sys.exit(0)
|
|
550
553
|
|
|
551
554
|
if not no_verify and not dry_run:
|
|
552
|
-
if not run_lefthook_hooks():
|
|
555
|
+
if not run_lefthook_hooks(hook_timeout):
|
|
553
556
|
console.print("[red]Lefthook hooks failed. Please fix the issues and try again.[/red]")
|
|
554
557
|
console.print("[yellow]You can use --no-verify to skip pre-commit and lefthook hooks.[/yellow]")
|
|
555
558
|
sys.exit(1)
|
|
556
559
|
|
|
557
|
-
if not run_pre_commit_hooks():
|
|
560
|
+
if not run_pre_commit_hooks(hook_timeout):
|
|
558
561
|
console.print("[red]Pre-commit hooks failed. Please fix the issues and try again.[/red]")
|
|
559
562
|
console.print("[yellow]You can use --no-verify to skip pre-commit and lefthook hooks.[/yellow]")
|
|
560
563
|
sys.exit(1)
|
|
@@ -687,6 +690,7 @@ def main(
|
|
|
687
690
|
dry_run=dry_run,
|
|
688
691
|
push=push,
|
|
689
692
|
show_prompt=show_prompt,
|
|
693
|
+
hook_timeout=hook_timeout,
|
|
690
694
|
)
|
|
691
695
|
except AIError as e:
|
|
692
696
|
logger.error(str(e))
|
|
@@ -707,6 +711,7 @@ def main(
|
|
|
707
711
|
dry_run=dry_run,
|
|
708
712
|
push=push,
|
|
709
713
|
show_prompt=show_prompt,
|
|
714
|
+
hook_timeout=hook_timeout,
|
|
710
715
|
)
|
|
711
716
|
except AIError as e:
|
|
712
717
|
logger.error(str(e))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gac
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: LLM-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
|
|
@@ -56,7 +56,7 @@ Description-Content-Type: text/markdown
|
|
|
56
56
|
[](docs/en/CONTRIBUTING.md)
|
|
57
57
|
[](LICENSE)
|
|
58
58
|
|
|
59
|
-
**English** | [简体中文](
|
|
59
|
+
**English** | [简体中文](docs/zh-CN/README.md) | [繁體中文](docs/zh-TW/README.md) | [日本語](docs/ja/README.md) | [한국어](docs/ko/README.md) | [हिन्दी](docs/hi/README.md) | [Français](docs/fr/README.md) | [Русский](docs/ru/README.md) | [Español](docs/es/README.md) | [Português](docs/pt/README.md) | [Deutsch](docs/de/README.md) | [Nederlands](docs/nl/README.md)
|
|
60
60
|
|
|
61
61
|
**LLM-powered commit messages that understand your code!**
|
|
62
62
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
gac/__init__.py,sha256=z9yGInqtycFIT3g1ca24r-A3699hKVaRqGUI79wsmMc,415
|
|
2
|
-
gac/__version__.py,sha256=
|
|
2
|
+
gac/__version__.py,sha256=Xpe4m5SwJ_iZ3HmDV70lEKGTKgJT-Xa6f-saj16phew,66
|
|
3
3
|
gac/ai.py,sha256=6SQK4axBE0uEbF3eKVTvQtGL9X1TbxoBOrY7NuYIfiM,5009
|
|
4
4
|
gac/ai_utils.py,sha256=reJINfsKlX0HAg5HPlH4ImO6FvibzgRZ0ruG9u1cxa8,8312
|
|
5
|
-
gac/cli.py,sha256
|
|
6
|
-
gac/config.py,sha256=
|
|
5
|
+
gac/cli.py,sha256=-2XjRB22lAlSDAUPWwgiOpl6KWdR5nRSvCpLBGAJ9OI,6389
|
|
6
|
+
gac/config.py,sha256=HXYy889wZGlot2kn2jvR1QsiVIVHaZbvhIqMybm3Iso,2164
|
|
7
7
|
gac/config_cli.py,sha256=v9nFHZO1RvK9fzHyuUS6SG-BCLHMsdOMDwWamBhVVh4,1608
|
|
8
|
-
gac/constants.py,sha256=
|
|
8
|
+
gac/constants.py,sha256=f8UdGVzYHcuOxPHO53Isllkrk8G0DEE0qP8f4Oers_M,9670
|
|
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=HJANfY8RFyrtXJUDo8wxrU0e5tx0agakdM8jCru1b3Q,11285
|
|
12
12
|
gac/init_cli.py,sha256=ZfC6oci9xiRVKHuOipH7RQvVI-79O_OymG7_ZZ6CyLM,19606
|
|
13
13
|
gac/language_cli.py,sha256=FEQf-k5KrhIpvx4XJvjqxTeE4qumNO00d-tgOAf83W4,8488
|
|
14
|
-
gac/main.py,sha256=
|
|
14
|
+
gac/main.py,sha256=_hkdtFxgajAqo_hchBd8dl6aPB7-p_osngAHdngl1QU,28981
|
|
15
15
|
gac/preprocess.py,sha256=hk2p2X4-xVDvuy-T1VMzMa9k5fTUbhlWDyw89DCf81Q,15379
|
|
16
16
|
gac/prompt.py,sha256=ofumb6DmxJceqZLUlUyLE9b7Mwx9BpIEHweKEV9eicw,31841
|
|
17
17
|
gac/security.py,sha256=QT91mBEo2Y7la-aXvKuF2zhWuoOSXb6PWKLJ93kSy2k,9926
|
|
@@ -37,8 +37,8 @@ gac/providers/streamlake.py,sha256=KAA2ZnpuEI5imzvdWVWUhEBHSP0BMnprKXte6CbwBWY,2
|
|
|
37
37
|
gac/providers/synthetic.py,sha256=sRMIJTS9LpcXd9A7qp_ZjZxdqtTKRn9fl1W4YwJZP4c,1855
|
|
38
38
|
gac/providers/together.py,sha256=1bUIVHfYzcEDw4hQPE8qV6hjc2JNHPv_khVgpk2IJxI,1667
|
|
39
39
|
gac/providers/zai.py,sha256=kywhhrCfPBu0rElZyb-iENxQxxpVGykvePuL4xrXlaU,2739
|
|
40
|
-
gac-2.
|
|
41
|
-
gac-2.
|
|
42
|
-
gac-2.
|
|
43
|
-
gac-2.
|
|
44
|
-
gac-2.
|
|
40
|
+
gac-2.5.0.dist-info/METADATA,sha256=XLnVxndz-YX61Z6y83fnAVBWB5clSt8k9W4iMR6oJwQ,10839
|
|
41
|
+
gac-2.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
42
|
+
gac-2.5.0.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
|
|
43
|
+
gac-2.5.0.dist-info/licenses/LICENSE,sha256=vOab37NouL1PNs5BswnPayrMCqaN2sqLfMQfqPDrpZg,1103
|
|
44
|
+
gac-2.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|