dorian-commit 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/commit +12 -7
- metadata +4 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52b83c8fffda78584363b2d97d26a5da277b13fb640f5eb0a9e935446848f4d0
|
4
|
+
data.tar.gz: 2a8ee8d66bbdc09844a2a8850549b8e74a32dd93527c4623c48dcb63e1f4e4fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6ec2f80ae82311479444e59b6ad51c66bb731cf59979ef14756840c03fc4f675aa413a6223bfaef11811e5855cc0181e94c02cfe59c436d31186b747079ecf1
|
7
|
+
data.tar.gz: 9504f8ffae772c26fe24c3de06755a6c71b140b1a6a9255d4052f014e5276c3a3a9482fccca22d26a27c85da1e59a6640c35898669ff9f7f80b6609d7b5fdf4e
|
data/bin/commit
CHANGED
@@ -9,7 +9,8 @@ require "git"
|
|
9
9
|
abort "USAGE: commit" if ARGV.any?
|
10
10
|
|
11
11
|
TOKEN_FILE = File.join(Dir.home, ".commit")
|
12
|
-
PROMPT =
|
12
|
+
PROMPT =
|
13
|
+
"simple, clear, short, lowercase commit message for the following diff:"
|
13
14
|
|
14
15
|
if File.exist?(TOKEN_FILE)
|
15
16
|
TOKEN = File.read(TOKEN_FILE).strip
|
@@ -28,21 +29,25 @@ uri = URI("https://api.openai.com/v1/chat/completions")
|
|
28
29
|
http = Net::HTTP.new(uri.host, uri.port)
|
29
30
|
http.use_ssl = true
|
30
31
|
|
31
|
-
request =
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
request =
|
33
|
+
Net::HTTP::Post.new(
|
34
|
+
uri.path,
|
35
|
+
{
|
36
|
+
"Content-Type" => "application/json",
|
37
|
+
"Authorization" => "Bearer #{TOKEN}"
|
38
|
+
}
|
39
|
+
)
|
35
40
|
|
36
41
|
request.body = {
|
37
42
|
model: "gpt-4o",
|
38
43
|
messages: [
|
39
44
|
{ role: "system", content: PROMPT },
|
40
45
|
{ role: "user", content: STAGED }
|
41
|
-
]
|
46
|
+
]
|
42
47
|
}.to_json
|
43
48
|
|
44
49
|
response = http.request(request)
|
45
50
|
json = JSON.parse(response.body)
|
46
|
-
message = json.dig(
|
51
|
+
message = json.dig("choices", 0, "message", "content").strip
|
47
52
|
Git.open(".").commit(message)
|
48
53
|
puts message
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -24,10 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description:
|
28
|
-
commit with openai api
|
29
|
-
|
30
|
-
e.g. `commit`
|
27
|
+
description: commit with ai
|
31
28
|
email: dorian@dorianmarie.com
|
32
29
|
executables:
|
33
30
|
- commit
|
@@ -58,5 +55,5 @@ requirements: []
|
|
58
55
|
rubygems_version: 3.5.11
|
59
56
|
signing_key:
|
60
57
|
specification_version: 4
|
61
|
-
summary: commit with
|
58
|
+
summary: commit with ai
|
62
59
|
test_files: []
|