gac 3.6.0__py3-none-any.whl → 3.10.10__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.
Files changed (79) hide show
  1. gac/__init__.py +4 -6
  2. gac/__version__.py +1 -1
  3. gac/ai_utils.py +59 -43
  4. gac/auth_cli.py +181 -36
  5. gac/cli.py +26 -9
  6. gac/commit_executor.py +59 -0
  7. gac/config.py +81 -2
  8. gac/config_cli.py +19 -7
  9. gac/constants/__init__.py +34 -0
  10. gac/constants/commit.py +63 -0
  11. gac/constants/defaults.py +40 -0
  12. gac/constants/file_patterns.py +110 -0
  13. gac/constants/languages.py +119 -0
  14. gac/diff_cli.py +0 -22
  15. gac/errors.py +8 -2
  16. gac/git.py +6 -6
  17. gac/git_state_validator.py +193 -0
  18. gac/grouped_commit_workflow.py +458 -0
  19. gac/init_cli.py +2 -1
  20. gac/interactive_mode.py +179 -0
  21. gac/language_cli.py +0 -1
  22. gac/main.py +231 -926
  23. gac/model_cli.py +67 -11
  24. gac/model_identifier.py +70 -0
  25. gac/oauth/__init__.py +26 -0
  26. gac/oauth/claude_code.py +89 -22
  27. gac/oauth/qwen_oauth.py +327 -0
  28. gac/oauth/token_store.py +81 -0
  29. gac/oauth_retry.py +161 -0
  30. gac/postprocess.py +155 -0
  31. gac/prompt.py +21 -479
  32. gac/prompt_builder.py +88 -0
  33. gac/providers/README.md +437 -0
  34. gac/providers/__init__.py +70 -78
  35. gac/providers/anthropic.py +12 -46
  36. gac/providers/azure_openai.py +48 -88
  37. gac/providers/base.py +329 -0
  38. gac/providers/cerebras.py +10 -33
  39. gac/providers/chutes.py +16 -62
  40. gac/providers/claude_code.py +64 -87
  41. gac/providers/custom_anthropic.py +51 -81
  42. gac/providers/custom_openai.py +29 -83
  43. gac/providers/deepseek.py +10 -33
  44. gac/providers/error_handler.py +139 -0
  45. gac/providers/fireworks.py +10 -33
  46. gac/providers/gemini.py +66 -63
  47. gac/providers/groq.py +10 -58
  48. gac/providers/kimi_coding.py +19 -55
  49. gac/providers/lmstudio.py +64 -43
  50. gac/providers/minimax.py +10 -33
  51. gac/providers/mistral.py +10 -33
  52. gac/providers/moonshot.py +10 -33
  53. gac/providers/ollama.py +56 -33
  54. gac/providers/openai.py +30 -36
  55. gac/providers/openrouter.py +15 -52
  56. gac/providers/protocol.py +71 -0
  57. gac/providers/qwen.py +64 -0
  58. gac/providers/registry.py +58 -0
  59. gac/providers/replicate.py +140 -82
  60. gac/providers/streamlake.py +26 -46
  61. gac/providers/synthetic.py +35 -37
  62. gac/providers/together.py +10 -33
  63. gac/providers/zai.py +29 -57
  64. gac/py.typed +0 -0
  65. gac/security.py +1 -1
  66. gac/templates/__init__.py +1 -0
  67. gac/templates/question_generation.txt +60 -0
  68. gac/templates/system_prompt.txt +224 -0
  69. gac/templates/user_prompt.txt +28 -0
  70. gac/utils.py +36 -6
  71. gac/workflow_context.py +162 -0
  72. gac/workflow_utils.py +3 -8
  73. {gac-3.6.0.dist-info → gac-3.10.10.dist-info}/METADATA +6 -4
  74. gac-3.10.10.dist-info/RECORD +79 -0
  75. gac/constants.py +0 -321
  76. gac-3.6.0.dist-info/RECORD +0 -53
  77. {gac-3.6.0.dist-info → gac-3.10.10.dist-info}/WHEEL +0 -0
  78. {gac-3.6.0.dist-info → gac-3.10.10.dist-info}/entry_points.txt +0 -0
  79. {gac-3.6.0.dist-info → gac-3.10.10.dist-info}/licenses/LICENSE +0 -0
gac/constants.py DELETED
@@ -1,321 +0,0 @@
1
- """Constants for the Git Auto Commit (gac) project."""
2
-
3
- import os
4
- from enum import Enum
5
-
6
-
7
- class FileStatus(Enum):
8
- """File status for Git operations."""
9
-
10
- MODIFIED = "M"
11
- ADDED = "A"
12
- DELETED = "D"
13
- RENAMED = "R"
14
- COPIED = "C"
15
- UNTRACKED = "?"
16
-
17
-
18
- class EnvDefaults:
19
- """Default values for environment variables."""
20
-
21
- MAX_RETRIES: int = 3
22
- TEMPERATURE: float = 1
23
- MAX_OUTPUT_TOKENS: int = 4096 # includes reasoning tokens
24
- WARNING_LIMIT_TOKENS: int = 32768
25
- ALWAYS_INCLUDE_SCOPE: bool = False
26
- SKIP_SECRET_SCAN: bool = False
27
- VERBOSE: bool = False
28
- NO_TIKTOKEN: bool = False
29
- HOOK_TIMEOUT: int = 120 # Timeout for pre-commit and lefthook hooks in seconds
30
-
31
-
32
- class Logging:
33
- """Logging configuration constants."""
34
-
35
- DEFAULT_LEVEL: str = "WARNING"
36
- LEVELS: list[str] = ["DEBUG", "INFO", "WARNING", "ERROR"]
37
-
38
-
39
- class Utility:
40
- """General utility constants."""
41
-
42
- DEFAULT_ENCODING: str = "cl100k_base" # llm encoding
43
- DEFAULT_DIFF_TOKEN_LIMIT: int = 15000 # Maximum tokens for diff processing
44
- MAX_WORKERS: int = os.cpu_count() or 4 # Maximum number of parallel workers
45
- MAX_DISPLAYED_SECRET_LENGTH: int = 50 # Maximum length for displaying secrets
46
-
47
-
48
- class FilePatterns:
49
- """Patterns for identifying special file types."""
50
-
51
- # Regex patterns to detect binary file changes in git diffs (e.g., images or other non-text files)
52
- BINARY: list[str] = [
53
- r"Binary files .* differ",
54
- r"GIT binary patch",
55
- ]
56
-
57
- # Regex patterns to detect minified files in git diffs (e.g., JavaScript or CSS files)
58
- MINIFIED_EXTENSIONS: list[str] = [
59
- ".min.js",
60
- ".min.css",
61
- ".bundle.js",
62
- ".bundle.css",
63
- ".compressed.js",
64
- ".compressed.css",
65
- ".opt.js",
66
- ".opt.css",
67
- ]
68
-
69
- # Regex patterns to detect build directories in git diffs (e.g., dist, build, vendor, etc.)
70
- BUILD_DIRECTORIES: list[str] = [
71
- "/dist/",
72
- "/build/",
73
- "/vendor/",
74
- "/node_modules/",
75
- "/assets/vendor/",
76
- "/public/build/",
77
- "/static/dist/",
78
- ]
79
-
80
-
81
- class FileTypeImportance:
82
- """Importance multipliers for different file types."""
83
-
84
- EXTENSIONS: dict[str, float] = {
85
- # Programming languages
86
- ".py": 5.0, # Python
87
- ".js": 4.5, # JavaScript
88
- ".ts": 4.5, # TypeScript
89
- ".jsx": 4.8, # React JS
90
- ".tsx": 4.8, # React TS
91
- ".go": 4.5, # Go
92
- ".rs": 4.5, # Rust
93
- ".java": 4.2, # Java
94
- ".c": 4.2, # C
95
- ".h": 4.2, # C/C++ header
96
- ".cpp": 4.2, # C++
97
- ".rb": 4.2, # Ruby
98
- ".php": 4.0, # PHP
99
- ".scala": 4.0, # Scala
100
- ".swift": 4.0, # Swift
101
- ".kt": 4.0, # Kotlin
102
- # Configuration
103
- ".json": 3.5, # JSON config
104
- ".yaml": 3.8, # YAML config
105
- ".yml": 3.8, # YAML config
106
- ".toml": 3.8, # TOML config
107
- ".ini": 3.5, # INI config
108
- ".env": 3.5, # Environment variables
109
- # Documentation
110
- ".md": 2.5, # Markdown (reduced to prioritize code changes)
111
- ".rst": 2.5, # reStructuredText (reduced to prioritize code changes)
112
- # Web
113
- ".html": 3.5, # HTML
114
- ".css": 3.5, # CSS
115
- ".scss": 3.5, # SCSS
116
- ".svg": 2.5, # SVG graphics
117
- # Build & CI
118
- "Dockerfile": 4.0, # Docker
119
- ".github/workflows": 4.0, # GitHub Actions
120
- "CMakeLists.txt": 3.8, # CMake
121
- "Makefile": 3.8, # Make
122
- "package.json": 4.2, # NPM package
123
- "pyproject.toml": 4.2, # Python project
124
- "requirements.txt": 4.0, # Python requirements
125
- }
126
-
127
-
128
- class CodePatternImportance:
129
- """Importance multipliers for different code patterns."""
130
-
131
- # Regex patterns to detect code structure changes in git diffs (e.g., class, function, import)
132
- # Note: The patterns are prefixed with "+" to match only added and modified lines
133
- PATTERNS: dict[str, float] = {
134
- # Structure changes
135
- r"\+\s*(class|interface|enum)\s+\w+": 1.8, # Class/interface/enum definitions
136
- r"\+\s*(def|function|func)\s+\w+\s*\(": 1.5, # Function definitions
137
- r"\+\s*(import|from .* import)": 1.3, # Imports
138
- r"\+\s*(public|private|protected)\s+\w+": 1.2, # Access modifiers
139
- # Configuration changes
140
- r"\+\s*\"(dependencies|devDependencies)\"": 1.4, # Package dependencies
141
- r"\+\s*version[\"\s:=]+[0-9.]+": 1.3, # Version changes
142
- # Logic changes
143
- r"\+\s*(if|else|elif|switch|case|for|while)[\s(]": 1.2, # Control structures
144
- r"\+\s*(try|catch|except|finally)[\s:]": 1.2, # Exception handling
145
- r"\+\s*return\s+": 1.1, # Return statements
146
- r"\+\s*await\s+": 1.1, # Async/await
147
- # Comments & docs
148
- r"\+\s*(//|#|/\*|\*\*)\s*TODO": 1.2, # TODOs
149
- r"\+\s*(//|#|/\*|\*\*)\s*FIX": 1.3, # FIXes
150
- r"\+\s*(\"\"\"|\'\'\')": 1.1, # Docstrings
151
- # Test code
152
- r"\+\s*(test|describe|it|should)\s*\(": 1.1, # Test definitions
153
- r"\+\s*(assert|expect)": 1.0, # Assertions
154
- }
155
-
156
-
157
- class Languages:
158
- """Language code mappings and utilities."""
159
-
160
- # Language code to full name mapping
161
- # Supports ISO 639-1 codes and common variants
162
- CODE_MAP: dict[str, str] = {
163
- # English
164
- "en": "English",
165
- # Chinese
166
- "zh": "Simplified Chinese",
167
- "zh-cn": "Simplified Chinese",
168
- "zh-hans": "Simplified Chinese",
169
- "zh-tw": "Traditional Chinese",
170
- "zh-hant": "Traditional Chinese",
171
- # Japanese
172
- "ja": "Japanese",
173
- # Korean
174
- "ko": "Korean",
175
- # Spanish
176
- "es": "Spanish",
177
- # Portuguese
178
- "pt": "Portuguese",
179
- # French
180
- "fr": "French",
181
- # German
182
- "de": "German",
183
- # Russian
184
- "ru": "Russian",
185
- # Hindi
186
- "hi": "Hindi",
187
- # Italian
188
- "it": "Italian",
189
- # Polish
190
- "pl": "Polish",
191
- # Turkish
192
- "tr": "Turkish",
193
- # Dutch
194
- "nl": "Dutch",
195
- # Vietnamese
196
- "vi": "Vietnamese",
197
- # Thai
198
- "th": "Thai",
199
- # Indonesian
200
- "id": "Indonesian",
201
- # Swedish
202
- "sv": "Swedish",
203
- # Arabic
204
- "ar": "Arabic",
205
- # Hebrew
206
- "he": "Hebrew",
207
- # Greek
208
- "el": "Greek",
209
- # Danish
210
- "da": "Danish",
211
- # Norwegian
212
- "no": "Norwegian",
213
- "nb": "Norwegian",
214
- "nn": "Norwegian",
215
- # Finnish
216
- "fi": "Finnish",
217
- }
218
-
219
- # List of languages with display names and English names for CLI selection
220
- # Format: (display_name, english_name)
221
- LANGUAGES: list[tuple[str, str]] = [
222
- ("English", "English"),
223
- ("简体中文", "Simplified Chinese"),
224
- ("繁體中文", "Traditional Chinese"),
225
- ("日本語", "Japanese"),
226
- ("한국어", "Korean"),
227
- ("Español", "Spanish"),
228
- ("Português", "Portuguese"),
229
- ("Français", "French"),
230
- ("Deutsch", "German"),
231
- ("Русский", "Russian"),
232
- ("हिन्दी", "Hindi"),
233
- ("Italiano", "Italian"),
234
- ("Polski", "Polish"),
235
- ("Türkçe", "Turkish"),
236
- ("Nederlands", "Dutch"),
237
- ("Tiếng Việt", "Vietnamese"),
238
- ("ไทย", "Thai"),
239
- ("Bahasa Indonesia", "Indonesian"),
240
- ("Svenska", "Swedish"),
241
- ("العربية", "Arabic"),
242
- ("עברית", "Hebrew"),
243
- ("Ελληνικά", "Greek"),
244
- ("Dansk", "Danish"),
245
- ("Norsk", "Norwegian"),
246
- ("Suomi", "Finnish"),
247
- ("Custom", "Custom"),
248
- ]
249
-
250
- @staticmethod
251
- def resolve_code(language: str) -> str:
252
- """Resolve a language code to its full name.
253
-
254
- Args:
255
- language: Language name or code (e.g., 'Spanish', 'es', 'zh-CN')
256
-
257
- Returns:
258
- Full language name (e.g., 'Spanish', 'Simplified Chinese')
259
-
260
- If the input is already a full language name, it's returned as-is.
261
- If it's a recognized code, it's converted to the full name.
262
- Otherwise, the input is returned unchanged (for custom languages).
263
- """
264
- # Normalize the code to lowercase for lookup
265
- code_lower = language.lower().strip()
266
-
267
- # Check if it's a recognized code
268
- if code_lower in Languages.CODE_MAP:
269
- return Languages.CODE_MAP[code_lower]
270
-
271
- # Return as-is (could be a full name or custom language)
272
- return language
273
-
274
-
275
- class CommitMessageConstants:
276
- """Constants for commit message generation and cleaning."""
277
-
278
- # Conventional commit type prefixes
279
- CONVENTIONAL_PREFIXES: list[str] = [
280
- "feat",
281
- "fix",
282
- "docs",
283
- "style",
284
- "refactor",
285
- "perf",
286
- "test",
287
- "build",
288
- "ci",
289
- "chore",
290
- ]
291
-
292
- # XML tags that may leak from prompt templates into AI responses
293
- XML_TAGS_TO_REMOVE: list[str] = [
294
- "<git-status>",
295
- "</git-status>",
296
- "<git_status>",
297
- "</git_status>",
298
- "<git-diff>",
299
- "</git-diff>",
300
- "<git_diff>",
301
- "</git_diff>",
302
- "<repository_context>",
303
- "</repository_context>",
304
- "<instructions>",
305
- "</instructions>",
306
- "<format>",
307
- "</format>",
308
- "<conventions>",
309
- "</conventions>",
310
- ]
311
-
312
- # Indicators that mark the start of the actual commit message in AI responses
313
- COMMIT_INDICATORS: list[str] = [
314
- "# Your commit message:",
315
- "Your commit message:",
316
- "The commit message is:",
317
- "Here's the commit message:",
318
- "Commit message:",
319
- "Final commit message:",
320
- "# Commit Message",
321
- ]
@@ -1,53 +0,0 @@
1
- gac/__init__.py,sha256=z9yGInqtycFIT3g1ca24r-A3699hKVaRqGUI79wsmMc,415
2
- gac/__version__.py,sha256=QjkK28WCwoefBMwiKqFYy76cOVTGklvGTI3wsZ1eIDk,66
3
- gac/ai.py,sha256=HnXmRFmUJin5k755iBqSLgKYssjShjKXz9SwICEpMag,3835
4
- gac/ai_utils.py,sha256=YpMEXCXkY1KqLIoYOmMGwVzTxUq-jof_v8VYbsgFMl0,8940
5
- gac/auth_cli.py,sha256=Bd2TSjoVruOwzcPjDvyjfuKtlBr_wEScf8AWsddKfU0,2224
6
- gac/cli.py,sha256=ZbUGyKHuxfW1p6zaiTl8FU_tIYaxPN36tCxLYBinDFk,7450
7
- gac/config.py,sha256=_EWAtHL9FMrvO4wD0ReZQEstKzhF1f2rbSm9dWCT350,2155
8
- gac/config_cli.py,sha256=o8UEEoWwZJ7xmDUbNPZEnbdANd1nLb4HMpmqMbcbbaY,2376
9
- gac/constants.py,sha256=nd8aiNCAsvP1OM4VWwXjonqA7RAtPwTheA__GrVuP5o,9700
10
- gac/diff_cli.py,sha256=wnVQ9OFGnM0d2Pj9WVjWbo0jxqIuRHVAwmb8wU9Pa3E,5676
11
- gac/errors.py,sha256=ysDIVRCd0YQVTOW3Q6YzdolxCdtkoQCAFf3_jrqbjUY,7916
12
- gac/git.py,sha256=_NRkOyb6u8SiPrG-t-7GspjdSp7yptmNj1gT8VexmcY,12913
13
- gac/init_cli.py,sha256=UbldjcEjypHHpAn49tMddzaFQtwwAjlf8ZBQVPoz9YQ,2299
14
- gac/language_cli.py,sha256=NHg8Q2cAjt4-VOaIYdU5FL_ISvSyu5rbgs232CqfhzM,12929
15
- gac/main.py,sha256=jL26ti3t3-3ykV20tJaOdNsDFPKJoqKZX1fg20uYLGM,41872
16
- gac/model_cli.py,sha256=DGI8V6QWyI07KeVYJMzXTMxqQg4crhnSfuOUYiZYygE,16013
17
- gac/preprocess.py,sha256=hk2p2X4-xVDvuy-T1VMzMa9k5fTUbhlWDyw89DCf81Q,15379
18
- gac/prompt.py,sha256=MzW-OzixAOltVcIVaRp6_hm8HscxRcmxj9Jh94P6Rvo,35454
19
- gac/security.py,sha256=QT91mBEo2Y7la-aXvKuF2zhWuoOSXb6PWKLJ93kSy2k,9926
20
- gac/utils.py,sha256=gTpc9zLzy3-3L5k-V5uSeFI-NnSPabA1GGVwSgpeMSk,11709
21
- gac/workflow_utils.py,sha256=-O4QRfY1bbv2lh1tpTaAEd_N0OE4eHV6E_vRvzBCFtk,8268
22
- gac/oauth/__init__.py,sha256=hPSGHlt-BFZXSodg-n6S405-5YZComyV_iEtzkPumdQ,46
23
- gac/oauth/claude_code.py,sha256=S4XsamRKOJoBwXo3GyhhcP5ypj3RE2akoBSo2yojtS8,12120
24
- gac/providers/__init__.py,sha256=th44JWjSQl8YgbLUmbRHXZS8jDXDFuBLeKpXDhL979w,2889
25
- gac/providers/anthropic.py,sha256=VK5d1s1PmBNDwh_x7illQ2CIZIHNIYU28btVfizwQPs,2036
26
- gac/providers/azure_openai.py,sha256=X1T1jtJDQmTw2Qm_I2onzEUDpfRQ49mj1WDGBZ3pXlI,3919
27
- gac/providers/cerebras.py,sha256=Ik8lhlsliGJVkgDgqlThfpra9tqbdYQZkaC4eNxRd9w,1648
28
- gac/providers/chutes.py,sha256=cclJOLuGVIiiaF-9Bs1kH6SSOhEmduGB2zZ86KIaXKw,2617
29
- gac/providers/claude_code.py,sha256=e_j0n0flN6m1UsY_v1lzwcy1miC9pynPY-1Fbq2akyw,4069
30
- gac/providers/custom_anthropic.py,sha256=aqtMdLnbwFjXkQzo7-pKfhIHktFuePVsnfDJOFJvDeM,5529
31
- gac/providers/custom_openai.py,sha256=kLRfClY6kdN8FGsFMYJVFCL82d34tnHZ9IPSZ2VPK2Q,3942
32
- gac/providers/deepseek.py,sha256=leT2S4_CE6JzwF3skDd4umBsu2rkJOJ66AfOdSL5wGc,1643
33
- gac/providers/fireworks.py,sha256=zsWhf6LMVdtsD9keXRFwgn9lCQigz6VmrDl6vqIVkdI,1688
34
- gac/providers/gemini.py,sha256=kl9WKdPm_ANYk0hsrUyMdACzR0cm8Eui9M1IwObYW-4,3348
35
- gac/providers/groq.py,sha256=9v2fAjDa_iRNHFptiUBN8Vt7ZDKkW_JOmIBeYvycD1M,2806
36
- gac/providers/kimi_coding.py,sha256=Nj8iojesCvCbwEEH3F8xNchIE_fmA1S2SMjGhD9arek,2727
37
- gac/providers/lmstudio.py,sha256=R82-f0tWdFfGQxLT6o3Q2tfvYguF7ESUg9DEUHNyrDk,2146
38
- gac/providers/minimax.py,sha256=oI5rEVlkcYenNUNH53zS00X8NqpcZ1gMsTGzQCsmes4,1630
39
- gac/providers/mistral.py,sha256=b2Du1nJutKjmJXmsXz4Ne43Yn52OSS0q6BKGoZnfH8Q,1630
40
- gac/providers/moonshot.py,sha256=Wy0RdYlKCkeRBv40jAJkybjXh420eb2btrTPTLioTbQ,1662
41
- gac/providers/ollama.py,sha256=hPkagbhEiAoH9RTET4EQe9-lTL0YmMRCbQ5dVbRQw6Q,2095
42
- gac/providers/openai.py,sha256=iHVD6bHf57W-QmW7u1Ee5vOpev7XZ-K75NcolLfebOk,1630
43
- gac/providers/openrouter.py,sha256=H3ce8JcRUYq1I30lOjGESdX7jfoPkW3mKAYnc2aYfBw,2204
44
- gac/providers/replicate.py,sha256=TjWZOIZBCq226zr_w0j0YpBxgtp0VY33yryd8q9akuo,3785
45
- gac/providers/streamlake.py,sha256=KAA2ZnpuEI5imzvdWVWUhEBHSP0BMnprKXte6CbwBWY,2047
46
- gac/providers/synthetic.py,sha256=sRMIJTS9LpcXd9A7qp_ZjZxdqtTKRn9fl1W4YwJZP4c,1855
47
- gac/providers/together.py,sha256=1bUIVHfYzcEDw4hQPE8qV6hjc2JNHPv_khVgpk2IJxI,1667
48
- gac/providers/zai.py,sha256=kywhhrCfPBu0rElZyb-iENxQxxpVGykvePuL4xrXlaU,2739
49
- gac-3.6.0.dist-info/METADATA,sha256=aPkvY8fwgU4gtKZojVzp3nbsfCpeWVLNWwM4lAbeQ7g,11254
50
- gac-3.6.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
51
- gac-3.6.0.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
52
- gac-3.6.0.dist-info/licenses/LICENSE,sha256=vOab37NouL1PNs5BswnPayrMCqaN2sqLfMQfqPDrpZg,1103
53
- gac-3.6.0.dist-info/RECORD,,
File without changes