gmsg 0.1.4__tar.gz → 0.1.5__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.
- {gmsg-0.1.4 → gmsg-0.1.5}/PKG-INFO +1 -1
- gmsg-0.1.5/gmsg/README.md +121 -0
- {gmsg-0.1.4 → gmsg-0.1.5}/pyproject.toml +1 -1
- {gmsg-0.1.4 → gmsg-0.1.5}/LICENSE +0 -0
- {gmsg-0.1.4 → gmsg-0.1.5}/README.md +0 -0
- {gmsg-0.1.4 → gmsg-0.1.5}/gmsg/__init__.py +0 -0
- {gmsg-0.1.4 → gmsg-0.1.5}/gmsg/api_key.py +0 -0
- {gmsg-0.1.4 → gmsg-0.1.5}/gmsg/gmsg.py +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# gmsg
|
|
2
|
+
|
|
3
|
+
A command-line tool that automatically generates concise and meaningful Git commit messages using Google's Gemini model based on your staged changes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 Features
|
|
8
|
+
|
|
9
|
+
* ✅ Detects if the current directory is a Git repository
|
|
10
|
+
* ✅ Retrieves your staged changes via `git diff --cached`
|
|
11
|
+
* ✅ Uses Gemini (for now) to generate a one-liner commit message
|
|
12
|
+
* ✅ Allows you to:
|
|
13
|
+
|
|
14
|
+
* Accept the suggestion
|
|
15
|
+
* Edit the message in your preferred text editor
|
|
16
|
+
* Regenerate a new suggestion
|
|
17
|
+
* ✅ Automatically commits the changes with your selected message
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📦 Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install gmsg
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🛠️ Configuration
|
|
30
|
+
|
|
31
|
+
Get your [Google Gemini API key](https://aistudio.google.com/app/apikey) if you don't have already.
|
|
32
|
+
|
|
33
|
+
### 1. Set API key
|
|
34
|
+
|
|
35
|
+
Enter your api key when package is used for the first time.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
$ ENTER your API Key=
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## ⚙️ Usage
|
|
44
|
+
|
|
45
|
+
1. Stage your changes:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git add .
|
|
49
|
+
or
|
|
50
|
+
git add <file>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. Run the package:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
gmsg
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
3. Follow the prompts:
|
|
60
|
+
|
|
61
|
+
* Press `y/Y/enter` to commit with the suggested message
|
|
62
|
+
* Press `e` to edit the message in your default `$EDITOR` (e.g., `vim`)
|
|
63
|
+
* Press `n` to regenerate the commit message
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## ✨ Example
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
$ git add some_file.py
|
|
71
|
+
$ gmsg
|
|
72
|
+
|
|
73
|
+
> Generate a one liner git commit message for these changes...
|
|
74
|
+
> Added error handling in API response parser
|
|
75
|
+
|
|
76
|
+
Do you want to continue with this message? [Y = yes / e = edit / n = no]: y
|
|
77
|
+
Running: `git commit -m Added error handling in API response parser`
|
|
78
|
+
Message committed to git. You can run `git commit --amend` to modify it.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 🧩 Requirements
|
|
84
|
+
|
|
85
|
+
* Python 3.10+
|
|
86
|
+
* [Google Generative AI SDK](https://pypi.org/project/google-generativeai/)
|
|
87
|
+
* Git installed and available in your system path
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📍 Roadmap
|
|
91
|
+
|
|
92
|
+
Here are some upcoming features and improvements planned for this project:
|
|
93
|
+
|
|
94
|
+
* [ ] **CLI Arguments Support**
|
|
95
|
+
Add flags like `--dry-run` for non-interactive use.
|
|
96
|
+
|
|
97
|
+
* [ ] **Multi-line Commit Messages**
|
|
98
|
+
Option to generate more descriptive, multi-line messages with summaries and bullet points.
|
|
99
|
+
|
|
100
|
+
* [ ] **Better Diff Parsing**
|
|
101
|
+
Use syntax-aware parsing to improve prompt context and generate more accurate commit messages.
|
|
102
|
+
|
|
103
|
+
* [ ] **Git Hook Integration**
|
|
104
|
+
Provide an installable Git commit hook that auto-runs this tool on `git commit`.
|
|
105
|
+
|
|
106
|
+
* [ ] **Support for Other LLMs**
|
|
107
|
+
Add support for OpenAI's GPT, Claude, or local models using plugins/adapters.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
## 📝 License
|
|
113
|
+
|
|
114
|
+
MIT License. Feel free to use, modify, and contribute!
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🤝 Contributing
|
|
119
|
+
|
|
120
|
+
Pull requests are welcome. For major changes, open an issue first to discuss what you'd like to change.
|
|
121
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -118,6 +118,7 @@ def printt(text: str, is_success: bool = True):
|
|
|
118
118
|
|
|
119
119
|
def main():
|
|
120
120
|
try:
|
|
121
|
+
user_api_key = get_or_set_api_key()
|
|
121
122
|
if not is_git_repo():
|
|
122
123
|
printt("Not a git repository.", is_success=False)
|
|
123
124
|
sys.exit(1)
|
|
@@ -127,7 +128,6 @@ def main():
|
|
|
127
128
|
printt("No staged changes found.", is_success=False)
|
|
128
129
|
sys.exit(1)
|
|
129
130
|
|
|
130
|
-
user_api_key = get_or_set_api_key()
|
|
131
131
|
cycle_through_messages(diff, user_api_key)
|
|
132
132
|
|
|
133
133
|
except KeyboardInterrupt:
|