jeeves-git-commit 2.1.0 → 2.2.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 +3 -5
- data/config/prompt +2 -0
- data/lib/jeeves/version.rb +1 -1
- data/lib/jeeves.rb +55 -13
- 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: 7c872a93b165676929a52e68bde2ec00eeb33117a0307f63d2a2ad61913a8ba5
|
4
|
+
data.tar.gz: 57a1e4553c635cb3d7dd85e261ee819a80e11eeba89aa6888d0c6ba8070f17da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8954926ae9d9119eea5d1ac54fd8d5c7694c6e8fd038ee5f34c5468ad72f0e6566f42ec3f80f4f0903b6e61b3723af85604def5bf29c596daaaec038be801f0
|
7
|
+
data.tar.gz: 071ac9b3e481c645de211cf0e083b322f6bd6642992706618e4ff2b7c9d04f39c404c94d992a0d939c7d7d71a190d84ab1b8fa6dee24d58324205a87c103279d
|
data/README.md
CHANGED
@@ -12,11 +12,10 @@ Jeeves is a command-line tool that creates AI-powered Git commit messages that m
|
|
12
12
|
- Option to automatically stage all changes before committing
|
13
13
|
- Option to push changes after committing
|
14
14
|
- Customizable AI prompts for tailored commit message generation
|
15
|
-
- Choose any AI model (chat-gpt
|
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
|
|
@@ -117,10 +115,10 @@ You can get an API key from [OpenRouter](https://openrouter.ai/).
|
|
117
115
|
Optionally, you can specify a different model by setting:
|
118
116
|
|
119
117
|
```bash
|
120
|
-
export GIT_COMMIT_MODEL="openai/gpt-
|
118
|
+
export GIT_COMMIT_MODEL="openai/gpt-5-chat"
|
121
119
|
```
|
122
120
|
|
123
|
-
The default model is `openai/gpt-
|
121
|
+
The default model is `openai/gpt-5-mini` if not specified.
|
124
122
|
|
125
123
|
### Prompt Configuration
|
126
124
|
|
data/config/prompt
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
Generate a git commit message based on the following diff.
|
2
2
|
|
3
|
+
IMPORTANT: Respond ONLY with the final commit message. Do not include any reasoning, thinking, or explanation about how you created the message.
|
4
|
+
|
3
5
|
The commit message should:
|
4
6
|
- Start with an appropriate gitmoji based on the nature of the changes
|
5
7
|
- Follow the Conventional Commits format (https://www.conventionalcommits.org/en/v1.0.0/)
|
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-5-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,65 @@ 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
|
-
]
|
147
|
+
]
|
148
|
+
end
|
149
|
+
|
150
|
+
request_body = {
|
151
|
+
model: model,
|
152
|
+
messages: messages,
|
141
153
|
max_tokens: 500
|
142
|
-
}
|
154
|
+
}
|
155
|
+
|
156
|
+
# For reasoning models, try to exclude reasoning from output
|
157
|
+
if model.include?('gpt-5') || model.include?('o1')
|
158
|
+
request_body[:reasoning] = { exclude: true }
|
159
|
+
end
|
160
|
+
|
161
|
+
request.body = request_body.to_json
|
143
162
|
|
144
163
|
begin
|
145
164
|
response = http.request(request)
|
146
165
|
|
147
166
|
if response.code == '200'
|
148
167
|
result = JSON.parse(response.body)
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
168
|
+
|
169
|
+
# Better error handling for API response structure
|
170
|
+
if result['choices'] && result['choices'][0] && result['choices'][0]['message']
|
171
|
+
message = result['choices'][0]['message']
|
172
|
+
commit_message = message['content']
|
173
|
+
|
174
|
+
# Handle OpenAI reasoning models (like GPT-5 mini) where content might be empty
|
175
|
+
# but reasoning contains the actual response
|
176
|
+
if (!commit_message || commit_message.strip.empty?) && message['reasoning']
|
177
|
+
commit_message = message['reasoning']
|
178
|
+
end
|
179
|
+
|
180
|
+
if commit_message && !commit_message.strip.empty?
|
181
|
+
commit_message = commit_message.strip
|
182
|
+
puts "Generated commit message:"
|
183
|
+
puts "------------------------"
|
184
|
+
puts commit_message
|
185
|
+
puts "------------------------"
|
186
|
+
return commit_message
|
187
|
+
else
|
188
|
+
puts "Error: API returned empty commit message"
|
189
|
+
puts "Full API response: #{response.body}"
|
190
|
+
exit 1
|
191
|
+
end
|
192
|
+
else
|
193
|
+
puts "Error: Unexpected API response structure"
|
194
|
+
puts "Full API response: #{response.body}"
|
195
|
+
exit 1
|
196
|
+
end
|
155
197
|
else
|
156
198
|
puts "API Error (#{response.code}): #{response.body}"
|
157
199
|
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.2.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: []
|