git-llm-tool 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 skyler-gogolook
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,415 @@
1
+ Metadata-Version: 2.3
2
+ Name: git-llm-tool
3
+ Version: 0.1.0
4
+ Summary: AI-powered git commit message and changelog generator
5
+ License: MIT
6
+ Keywords: git,commit,llm,ai,automation,jira,conventional-commits
7
+ Author: skyler-gogolook
8
+ Author-email: skyler.lo@gogolook.com
9
+ Requires-Python: >=3.12,<4.0
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Software Development :: Version Control :: Git
19
+ Classifier: Topic :: Utilities
20
+ Requires-Dist: anthropic (>=0.20.0,<0.21.0)
21
+ Requires-Dist: click (>=8.1.0,<9.0.0)
22
+ Requires-Dist: google-generativeai (>=0.5.0,<0.6.0)
23
+ Requires-Dist: openai (>=1.0.0,<2.0.0)
24
+ Requires-Dist: pyyaml (>=6.0,<7.0)
25
+ Project-URL: Documentation, https://github.com/z0890142/git-llm-tool#readme
26
+ Project-URL: Homepage, https://github.com/z0890142/git-llm-tool
27
+ Project-URL: Repository, https://github.com/z0890142/git-llm-tool
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Git-LLM-Tool
31
+
32
+ [![Python Version](https://img.shields.io/badge/python-3.12+-blue.svg)](https://python.org)
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
34
+ [![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
35
+
36
+ AI-powered git commit message and changelog generator using LLM APIs.
37
+
38
+ ## Table of Contents
39
+
40
+ - [Features](#features)
41
+ - [Installation](#installation)
42
+ - [Quick Start](#quick-start)
43
+ - [Configuration](#configuration)
44
+ - [CLI Commands Reference](#cli-commands-reference)
45
+ - [Environment Variables](#environment-variables)
46
+ - [Usage Examples](#usage-examples)
47
+ - [Supported Models](#supported-models)
48
+ - [Development](#development)
49
+ - [Contributing](#contributing)
50
+ - [Troubleshooting](#troubleshooting)
51
+ - [License](#license)
52
+
53
+ ## Features
54
+
55
+ - 🤖 **Smart Commit Messages**: Automatically generate commit messages from git diff using AI
56
+ - 📝 **Changelog Generation**: Generate structured changelogs from git history
57
+ - 🔧 **Multiple LLM Providers**: Support for OpenAI, Anthropic Claude, Google Gemini, and Azure OpenAI
58
+ - ⚙️ **Hierarchical Configuration**: Project-level and global configuration support
59
+ - 🎯 **Jira Integration**: Automatic ticket detection and work hours tracking
60
+ - 🌐 **Multi-language Support**: Generate messages in different languages
61
+ - ✏️ **Editor Integration**: Configurable editor support for reviewing commit messages
62
+ - 🚀 **Easy Setup**: Simple installation and configuration
63
+
64
+ ## Installation
65
+
66
+ ### From PyPI (Coming Soon)
67
+ ```bash
68
+ pip install git-llm-tool
69
+ ```
70
+
71
+ ### From Source
72
+ ```bash
73
+ git clone https://github.com/your-username/git-llm-tool.git
74
+ cd git-llm-tool
75
+ poetry install
76
+ ```
77
+
78
+ ## Quick Start
79
+
80
+ ### 1. Initialize Configuration
81
+ ```bash
82
+ git-llm config init
83
+ ```
84
+
85
+ ### 2. Configure Your API Key
86
+ Choose one of the supported providers:
87
+
88
+ ```bash
89
+ # OpenAI
90
+ git-llm config set llm.api_keys.openai sk-your-openai-key-here
91
+
92
+ # Anthropic Claude
93
+ git-llm config set llm.api_keys.anthropic sk-ant-your-key-here
94
+
95
+ # Google Gemini
96
+ git-llm config set llm.api_keys.google your-gemini-key-here
97
+
98
+ # Azure OpenAI
99
+ git-llm config set llm.api_keys.azure_openai your-azure-key
100
+ git-llm config set llm.azure_openai.endpoint https://your-resource.openai.azure.com/
101
+ git-llm config set llm.azure_openai.deployment_name gpt-4o
102
+ ```
103
+
104
+ ### 3. Generate Commit Messages
105
+ ```bash
106
+ # Stage your changes
107
+ git add .
108
+
109
+ # Generate and review commit message (opens editor)
110
+ git-llm commit
111
+
112
+ # Or apply directly without review
113
+ git-llm commit --apply
114
+ ```
115
+
116
+ ### 4. Generate Changelogs
117
+ ```bash
118
+ # Generate changelog from last tag to HEAD
119
+ git-llm changelog
120
+
121
+ # Generate changelog for specific range
122
+ git-llm changelog --from v1.0.0 --to v2.0.0
123
+ ```
124
+
125
+ ## Configuration
126
+
127
+ ### Configuration Hierarchy
128
+
129
+ The tool uses a hierarchical configuration system (highest to lowest priority):
130
+ 1. **CLI flags** (highest priority)
131
+ 2. **Project config** `.git-llm-tool.yaml`
132
+ 3. **Global config** `~/.git-llm-tool/config.yaml`
133
+ 4. **Environment variables**
134
+ 5. **Default values**
135
+
136
+ ### Configuration Options
137
+
138
+ #### LLM Settings
139
+ ```bash
140
+ # Set default model
141
+ git-llm config set llm.default_model gpt-4o
142
+
143
+ # Set output language (en, zh, ja, etc.)
144
+ git-llm config set llm.language en
145
+
146
+ # API Keys
147
+ git-llm config set llm.api_keys.openai sk-your-key
148
+ git-llm config set llm.api_keys.anthropic sk-ant-your-key
149
+ git-llm config set llm.api_keys.google your-key
150
+
151
+ # Azure OpenAI specific settings
152
+ git-llm config set llm.azure_openai.endpoint https://your-resource.openai.azure.com/
153
+ git-llm config set llm.azure_openai.api_version 2024-12-01-preview
154
+ git-llm config set llm.azure_openai.deployment_name gpt-4o
155
+ ```
156
+
157
+ #### Editor Configuration
158
+ ```bash
159
+ # Set preferred editor for commit message review
160
+ git-llm config set editor.preferred_editor vi
161
+ git-llm config set editor.preferred_editor nano
162
+ git-llm config set editor.preferred_editor "code --wait" # VS Code
163
+ git-llm config set editor.preferred_editor "subl --wait" # Sublime Text
164
+ ```
165
+
166
+ **Editor Priority (highest to lowest):**
167
+ 1. `editor.preferred_editor` config
168
+ 2. `git config core.editor`
169
+ 3. Environment variables (`GIT_EDITOR`, `VISUAL`, `EDITOR`)
170
+ 4. System defaults (`nano`, `vim`, `vi`)
171
+
172
+ #### Jira Integration
173
+ ```bash
174
+ # Enable Jira integration
175
+ git-llm config set jira.enabled true
176
+
177
+ # Set branch regex pattern for ticket extraction
178
+ git-llm config set jira.branch_regex '^(feat|fix|chore)\/([A-Z]+-\d+)\/.+$'
179
+ ```
180
+
181
+ ### Example Configuration File
182
+
183
+ Global config (`~/.git-llm-tool/config.yaml`):
184
+ ```yaml
185
+ llm:
186
+ default_model: 'gpt-4o'
187
+ language: 'en'
188
+ api_keys:
189
+ openai: 'sk-your-openai-key'
190
+ anthropic: 'sk-ant-your-key'
191
+ google: 'your-gemini-key'
192
+ azure_openai:
193
+ endpoint: 'https://your-resource.openai.azure.com/'
194
+ api_version: '2024-12-01-preview'
195
+ deployment_name: 'gpt-4o'
196
+
197
+ editor:
198
+ preferred_editor: 'vi'
199
+
200
+ jira:
201
+ enabled: true
202
+ branch_regex: '^(feat|fix|chore)\/([A-Z]+-\d+)\/.+$'
203
+ ```
204
+
205
+ ### View Configuration
206
+ ```bash
207
+ # View all configuration
208
+ git-llm config get
209
+
210
+ # View specific setting
211
+ git-llm config get llm.default_model
212
+ git-llm config get editor.preferred_editor
213
+ ```
214
+
215
+ ## CLI Commands Reference
216
+
217
+ ### Commit Command
218
+ ```bash
219
+ git-llm commit [OPTIONS]
220
+
221
+ Options:
222
+ -a, --apply Apply commit message directly without opening editor
223
+ -m, --model TEXT Override LLM model (e.g., gpt-4, claude-3-sonnet)
224
+ -l, --language TEXT Override output language (e.g., en, zh, ja)
225
+ -v, --verbose Enable verbose output
226
+ --help Show help message
227
+ ```
228
+
229
+ ### Changelog Command
230
+ ```bash
231
+ git-llm changelog [OPTIONS]
232
+
233
+ Options:
234
+ --from TEXT Starting reference (default: last tag)
235
+ --to TEXT Ending reference (default: HEAD)
236
+ -o, --output TEXT Output file (default: stdout)
237
+ -f, --force Force overwrite existing output file
238
+ --help Show help message
239
+ ```
240
+
241
+ ### Config Commands
242
+ ```bash
243
+ git-llm config init # Initialize configuration
244
+ git-llm config get [KEY] # Get configuration value(s)
245
+ git-llm config set KEY VALUE # Set configuration value
246
+ ```
247
+
248
+ ## Environment Variables
249
+
250
+ You can also configure the tool using environment variables:
251
+
252
+ ```bash
253
+ # LLM API Keys
254
+ export OPENAI_API_KEY="sk-your-openai-key"
255
+ export ANTHROPIC_API_KEY="sk-ant-your-key"
256
+ export GOOGLE_API_KEY="your-gemini-key"
257
+
258
+ # Azure OpenAI
259
+ export AZURE_OPENAI_API_KEY="your-azure-key"
260
+ export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
261
+ export AZURE_OPENAI_API_VERSION="2024-12-01-preview"
262
+ export AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o"
263
+
264
+ # Override default model
265
+ export GIT_LLM_MODEL="gpt-4o"
266
+ export GIT_LLM_LANGUAGE="en"
267
+ ```
268
+
269
+ ## Usage Examples
270
+
271
+ ### Basic Workflow
272
+ ```bash
273
+ # 1. Make changes to your code
274
+ echo "console.log('Hello World');" > app.js
275
+
276
+ # 2. Stage changes
277
+ git add app.js
278
+
279
+ # 3. Generate commit message with review
280
+ git-llm commit
281
+ # Opens your editor with AI-generated message for review
282
+
283
+ # 4. Or apply directly
284
+ git-llm commit --apply
285
+ ```
286
+
287
+ ### Using Different Models
288
+ ```bash
289
+ # Use specific model for this commit
290
+ git-llm commit --model claude-3-sonnet
291
+
292
+ # Use different language
293
+ git-llm commit --language zh
294
+ ```
295
+
296
+ ### Project-specific Configuration
297
+ Create `.git-llm-tool.yaml` in your project root:
298
+ ```yaml
299
+ llm:
300
+ default_model: 'claude-3-sonnet'
301
+ language: 'zh'
302
+ editor:
303
+ preferred_editor: 'code --wait'
304
+ jira:
305
+ enabled: true
306
+ branch_regex: '^(feat|fix|docs)\/([A-Z]+-\d+)\/.+$'
307
+ ```
308
+
309
+ ## Supported Models
310
+
311
+ ### OpenAI
312
+ - `gpt-4o` (recommended)
313
+ - `gpt-4o-mini`
314
+ - `gpt-4-turbo`
315
+ - `gpt-3.5-turbo`
316
+
317
+ ### Anthropic Claude
318
+ - `claude-3-5-sonnet-20241022` (recommended)
319
+ - `claude-3-5-haiku-20241022`
320
+ - `claude-3-opus-20240229`
321
+
322
+ ### Google Gemini
323
+ - `gemini-1.5-pro`
324
+ - `gemini-1.5-flash`
325
+
326
+ ### Azure OpenAI
327
+ - Any deployment of the above OpenAI models
328
+
329
+ ## Development
330
+
331
+ ### Setup Development Environment
332
+ ```bash
333
+ # Clone repository
334
+ git clone https://github.com/your-username/git-llm-tool.git
335
+ cd git-llm-tool
336
+
337
+ # Install dependencies
338
+ poetry install
339
+
340
+ # Install pre-commit hooks
341
+ poetry run pre-commit install
342
+ ```
343
+
344
+ ### Running Tests
345
+ ```bash
346
+ # Run all tests
347
+ poetry run pytest
348
+
349
+ # Run with coverage
350
+ poetry run pytest --cov=git_llm_tool
351
+
352
+ # Run specific test file
353
+ poetry run pytest tests/test_config.py
354
+ ```
355
+
356
+ ### Code Formatting
357
+ ```bash
358
+ # Format code
359
+ poetry run black .
360
+ poetry run isort .
361
+
362
+ # Check formatting
363
+ poetry run black --check .
364
+ poetry run flake8 .
365
+ ```
366
+
367
+ ### Building and Publishing
368
+ ```bash
369
+ # Build package
370
+ poetry build
371
+
372
+ # Publish to PyPI (maintainers only)
373
+ poetry publish
374
+ ```
375
+
376
+ ## Contributing
377
+
378
+ 1. Fork the repository
379
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
380
+ 3. Make your changes
381
+ 4. Add tests for new functionality
382
+ 5. Ensure all tests pass (`poetry run pytest`)
383
+ 6. Format code (`poetry run black . && poetry run isort .`)
384
+ 7. Commit your changes (`git-llm commit` 😉)
385
+ 8. Push to the branch (`git push origin feature/amazing-feature`)
386
+ 9. Open a Pull Request
387
+
388
+ ## Requirements
389
+
390
+ - Python 3.12+
391
+ - Git
392
+ - At least one LLM provider API key
393
+
394
+ ## Troubleshooting
395
+
396
+ ### Common Issues
397
+
398
+ **"No suitable editor found"**
399
+ - Set your preferred editor: `git-llm config set editor.preferred_editor vi`
400
+ - Or set git editor: `git config --global core.editor vi`
401
+
402
+ **"No staged changes found"**
403
+ - Stage your changes first: `git add .`
404
+
405
+ **"API Error: Invalid API key"**
406
+ - Check your API key configuration: `git-llm config get`
407
+ - Ensure the key is correctly set: `git-llm config set llm.api_keys.openai sk-your-key`
408
+
409
+ **"No commits found in range"**
410
+ - Make sure you have commits in the specified range
411
+ - Check git log: `git log --oneline`
412
+
413
+ ## License
414
+
415
+ MIT License