dorian-commit 0.4.1 → 0.4.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/commit +12 -7
  3. metadata +4 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1755970ac251ca93f075f8377be124343de1bd927127e8dd98739527d0dec435
4
- data.tar.gz: 55f49464c33b2e61c9c81e5f30c3a1354fa34a0168f4edb050d1aa4d07a04e54
3
+ metadata.gz: 52b83c8fffda78584363b2d97d26a5da277b13fb640f5eb0a9e935446848f4d0
4
+ data.tar.gz: 2a8ee8d66bbdc09844a2a8850549b8e74a32dd93527c4623c48dcb63e1f4e4fb
5
5
  SHA512:
6
- metadata.gz: caec97a14207833cc2bb3958a8c3d96a58ea8428b933da382f807d64db15d46b11a26374597a94370082d6125428c86a4e980b5161d419c6484e5d7708c2d52e
7
- data.tar.gz: 4d151d4dc995c2affd1c7cef5b755815d3d88c751334c14037555e71835685eb699cb4d68cb586195b1871c9b65486c7922a4e4ad602aafbd8f855d3e721fdc7
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 = "simple, clear, short, lowercase commit message for the following diff:"
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 = Net::HTTP::Post.new(uri.path, {
32
- "Content-Type" => "application/json",
33
- "Authorization" => "Bearer #{TOKEN}"
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('choices', 0, 'message', 'content').strip
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.1
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-16 00:00:00.000000000 Z
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 openai api
58
+ summary: commit with ai
62
59
  test_files: []