jeeves-git-commit 2.1.0 → 2.3.0
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.
- checksums.yaml +4 -4
- data/README.md +5 -7
- data/config/prompt +13 -12
- data/lib/jeeves/version.rb +1 -1
- data/lib/jeeves.rb +50 -14
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f9cafa5a9ee72892de5d30d61a265d6aafe57a992c2be8ca86619a9db35a9ee
|
4
|
+
data.tar.gz: 6cc58003d2999ee7c5346782fab3ffd2d74857da5752f99a72653876b83c27a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feb83d49fee7a876c25260eb8f9d34538f9022266b5f866f3edcd625f6c3cf10453284b4e059b405377bf860baba5d6ef7fe0590b0e3e40314c0c256b253aff5
|
7
|
+
data.tar.gz: bd432c77c41aa452ab0699e87444fa310c34ffbcf5663f78332933218706ad2f79fc388dd6e973c69204129d0c34e7a1ac1cd129babfceb606d92297ba928a06
|
data/README.md
CHANGED
@@ -9,14 +9,13 @@ Jeeves is a command-line tool that creates AI-powered Git commit messages that m
|
|
9
9
|
## Features
|
10
10
|
|
11
11
|
- Generate intelligent [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) messages with [gitmoji](https://gitmoji.dev) based on your staged changes that point out what an idiot you are.
|
12
|
-
- Option to automatically stage all changes before committing
|
13
|
-
- Option to push changes after committing
|
14
|
-
- Customizable AI prompts for tailored commit message generation
|
15
|
-
- Choose any AI model (chat-gpt
|
12
|
+
- Option to automatically stage all changes before committing.
|
13
|
+
- Option to push changes after committing.
|
14
|
+
- Customizable AI prompts for tailored commit message generation.
|
15
|
+
- Choose any AI model (chat-gpt 5-mini by default).
|
16
16
|
|
17
17
|
## Example Commit message
|
18
18
|
|
19
|
-
```
|
20
19
|
✨ refactor(HTMLText): rewrite HTML parsing and rendering from scratch because why not torture future maintainers
|
21
20
|
Completely scrap the previously sane approach of leveraging NSAttributedString's native HTML importer—because parsing HTML by hand in SwiftUI is obviously a great idea—and replace it with a painfully verbose custom parser that handles only a handful of tags (`<b>`, `<i>`, `<u>`, `<strong>`, `<em>`) by rudimentary string manipulation and manual state tracking.
|
22
21
|
|
@@ -27,7 +26,6 @@ Replace cached AttributedString with a freshly built one on each render, ignorin
|
|
27
26
|
Throw in a sprawling debug preview showcasing trivial formatting examples like `"Bold text"`, `"<b>Bold <i>nested</i></b>"`, and some paragraph-handling tests to prove the gross oversimplification, all stacked in a monstrously long VStack with no regard for code readability or separation of concerns.
|
28
27
|
|
29
28
|
In summary: regress from standard, battle-tested Cocoa HTML rendering to a brittle, hand-rolled solution that’s both inefficient and incomplete. Future developers, good luck deciphering this spaghetti; you’ll need it.
|
30
|
-
```
|
31
29
|
|
32
30
|
## Installation
|
33
31
|
|
@@ -120,7 +118,7 @@ Optionally, you can specify a different model by setting:
|
|
120
118
|
export GIT_COMMIT_MODEL="openai/gpt-4o"
|
121
119
|
```
|
122
120
|
|
123
|
-
The default model is `openai/gpt-
|
121
|
+
The default model is `openai/gpt-4o-mini` if not specified.
|
124
122
|
|
125
123
|
### Prompt Configuration
|
126
124
|
|
data/config/prompt
CHANGED
@@ -1,19 +1,20 @@
|
|
1
|
-
|
1
|
+
You are a git commit message generator. Your job is to write a commit message for the following git diff.
|
2
2
|
|
3
|
-
|
4
|
-
- Start with an appropriate gitmoji based on the nature of the changes
|
5
|
-
- Follow the Conventional Commits format (https://www.conventionalcommits.org/en/v1.0.0/)
|
6
|
-
- Explain WHAT changed and WHY it changed
|
7
|
-
- Use present tense ("add" not "added")
|
8
|
-
- Be extremely critical and mercilessly roast the author of the change
|
9
|
-
- Assume the audience is educated software engineers
|
3
|
+
OUTPUT ONLY THE COMMIT MESSAGE - NO EXPLANATIONS, NO REASONING, NO COMMENTARY.
|
10
4
|
|
11
|
-
|
12
|
-
|
5
|
+
Rules for the commit message:
|
6
|
+
- Start with a gitmoji emoji
|
7
|
+
- Follow conventional commit format: type(scope): description
|
8
|
+
- Be brutally honest and roast the code author
|
9
|
+
- Use present tense verbs
|
10
|
+
- Include a detailed body explaining the changes
|
13
11
|
|
14
|
-
|
12
|
+
Example:
|
13
|
+
✨ feat(api): add error handling because apparently nobody thought about what happens when things go wrong
|
15
14
|
|
16
|
-
|
15
|
+
Implement basic error handling for the authentication endpoint because someone decided to ship code that crashes spectacularly when the database is unreachable. Add try-catch blocks, proper error responses, and logging so we can at least pretend to be professional developers.
|
17
16
|
|
18
17
|
DIFF:
|
19
18
|
{{DIFF}}
|
19
|
+
|
20
|
+
COMMIT MESSAGE:
|
data/lib/jeeves/version.rb
CHANGED
data/lib/jeeves.rb
CHANGED
@@ -120,9 +120,11 @@ module Jeeves
|
|
120
120
|
exit 1
|
121
121
|
end
|
122
122
|
|
123
|
-
model = ENV['GIT_COMMIT_MODEL'] || 'openai/gpt-
|
123
|
+
model = ENV['GIT_COMMIT_MODEL'] || 'openai/gpt-4o-mini'
|
124
124
|
|
125
|
-
|
125
|
+
prompt_file_path = get_prompt_file_path
|
126
|
+
puts "Using prompt file: #{prompt_file_path}"
|
127
|
+
prompt = File.read(prompt_file_path).gsub('{{DIFF}}', diff)
|
126
128
|
|
127
129
|
uri = URI.parse('https://openrouter.ai/api/v1/chat/completions')
|
128
130
|
http = Net::HTTP.new(uri.host, uri.port)
|
@@ -133,25 +135,59 @@ module Jeeves
|
|
133
135
|
request['Authorization'] = "Bearer #{api_key}"
|
134
136
|
request['HTTP-Referer'] = 'https://github.com/jeeves-git-commit'
|
135
137
|
|
136
|
-
|
137
|
-
|
138
|
-
|
138
|
+
# For reasoning models, use system message to enforce output format
|
139
|
+
messages = if model.include?('gpt-5') || model.include?('o1')
|
140
|
+
[
|
141
|
+
{ role: 'system', content: 'You are a git commit message generator. Respond ONLY with the final commit message. Do not show your thinking or reasoning process.' },
|
142
|
+
{ role: 'user', content: prompt }
|
143
|
+
]
|
144
|
+
else
|
145
|
+
[
|
139
146
|
{ role: 'user', content: prompt }
|
140
|
-
]
|
141
|
-
|
142
|
-
|
147
|
+
]
|
148
|
+
end
|
149
|
+
|
150
|
+
request_body = {
|
151
|
+
model: model,
|
152
|
+
messages: messages,
|
153
|
+
max_tokens: 1000,
|
154
|
+
stop: ["END_COMMIT"]
|
155
|
+
}
|
156
|
+
|
157
|
+
# Remove any reasoning parameters that cause API errors
|
158
|
+
# GPT-5 mini will put reasoning in the reasoning field regardless
|
159
|
+
|
160
|
+
request.body = request_body.to_json
|
143
161
|
|
144
162
|
begin
|
145
163
|
response = http.request(request)
|
146
164
|
|
147
165
|
if response.code == '200'
|
148
166
|
result = JSON.parse(response.body)
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
167
|
+
|
168
|
+
# Better error handling for API response structure
|
169
|
+
if result['choices'] && result['choices'][0] && result['choices'][0]['message']
|
170
|
+
message = result['choices'][0]['message']
|
171
|
+
commit_message = message['content']
|
172
|
+
|
173
|
+
if commit_message && !commit_message.strip.empty?
|
174
|
+
commit_message = commit_message.strip
|
175
|
+
puts "Generated commit message:"
|
176
|
+
puts "------------------------"
|
177
|
+
puts commit_message
|
178
|
+
puts "------------------------"
|
179
|
+
return commit_message
|
180
|
+
else
|
181
|
+
puts "Error: API returned empty commit message"
|
182
|
+
puts "This model (#{model}) may not be compatible with direct output."
|
183
|
+
puts "Try using a different model with: export GIT_COMMIT_MODEL=\"openai/gpt-4o-mini\""
|
184
|
+
exit 1
|
185
|
+
end
|
186
|
+
else
|
187
|
+
puts "Error: Unexpected API response structure"
|
188
|
+
puts "Full API response: #{response.body}"
|
189
|
+
exit 1
|
190
|
+
end
|
155
191
|
else
|
156
192
|
puts "API Error (#{response.code}): #{response.body}"
|
157
193
|
exit 1
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jeeves-git-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Bishop
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: json
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
rubygems_version: 3.6.
|
115
|
+
rubygems_version: 3.6.9
|
116
116
|
specification_version: 4
|
117
117
|
summary: AI-powered Git commit message generator
|
118
118
|
test_files: []
|