dorian-commit 1.1.0 → 1.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/bin/commit +34 -27
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96ab8fd00e486fb48cb313023efd6ecf14763427593916b018304628f468eb05
|
4
|
+
data.tar.gz: 3bae8a19f1e528450a06600b08a7b4e6e63ad9e80dd742b79984edde5a08f1f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be08309f81e4dfa4100f8186e7de3a3cd4e6b95dbb2dab6b17f434918f92c8e73e30b2830ffaaa9d84c87318c4beaa181a2004bb92f7f3e1a65991646a62c901
|
7
|
+
data.tar.gz: 7eca41f69e2d35094437282a05dcd0c26b64c0a8ddf35f23e71f554765c4e7ea9fce849396bfe27c93b218915e120d220892e50f7fec9f9f63e1d2fcc5906a59
|
data/bin/commit
CHANGED
@@ -24,12 +24,25 @@ PROMPT_2 = "for the following diff:"
|
|
24
24
|
PROMPT_3 = "for the following git status:"
|
25
25
|
PROMPT_4 = "for the following comment:"
|
26
26
|
|
27
|
-
parsed =
|
27
|
+
parsed =
|
28
|
+
Dorian::Arguments.parse(
|
29
|
+
tokens: {
|
30
|
+
type: :integer,
|
31
|
+
alias: :t,
|
32
|
+
default: 1000
|
33
|
+
},
|
34
|
+
version: {
|
35
|
+
alias: :v
|
36
|
+
},
|
37
|
+
help: {
|
38
|
+
alias: :h
|
39
|
+
}
|
40
|
+
)
|
28
41
|
|
29
42
|
abort parsed.help if parsed.options.help
|
30
43
|
|
31
44
|
if parsed.options.version
|
32
|
-
abort File.read(File.expand_path("
|
45
|
+
abort File.read(File.expand_path("../VERSION", __dir__))
|
33
46
|
end
|
34
47
|
|
35
48
|
content_2 = `git diff --staged`
|
@@ -43,34 +56,28 @@ encoder = Tiktoken.encoding_for_model("gpt-4o")
|
|
43
56
|
|
44
57
|
content_2_encoded = encoder.encode(content_2)
|
45
58
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
{ role: :system, content: PROMPT_2 },
|
51
|
-
|
52
|
-
]
|
53
|
-
end
|
59
|
+
messages_2 =
|
60
|
+
if content_2_encoded.length > parsed.options.tokens
|
61
|
+
[]
|
62
|
+
else
|
63
|
+
[{ role: :system, content: PROMPT_2 }, { role: :user, content: content_2 }]
|
64
|
+
end
|
54
65
|
|
55
66
|
content_3_encoded = encoder.encode(content_3)
|
56
67
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
{ role: :system, content: PROMPT_3 },
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
{ role: :system, content: PROMPT_4 },
|
71
|
-
{ role: :user, content: content_4 }
|
72
|
-
]
|
73
|
-
end
|
68
|
+
messages_3 =
|
69
|
+
if content_3_encoded.length > parsed.options.tokens
|
70
|
+
[]
|
71
|
+
else
|
72
|
+
[{ role: :system, content: PROMPT_3 }, { role: :user, content: content_3 }]
|
73
|
+
end
|
74
|
+
|
75
|
+
messages_4 =
|
76
|
+
if content_4.empty?
|
77
|
+
[]
|
78
|
+
else
|
79
|
+
[{ role: :system, content: PROMPT_4 }, { role: :user, content: content_4 }]
|
80
|
+
end
|
74
81
|
|
75
82
|
uri = URI.parse("https://api.openai.com/v1/chat/completions")
|
76
83
|
|
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: 1.
|
4
|
+
version: 1.2.0
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dorian-arguments
|
@@ -71,9 +71,9 @@ require_paths:
|
|
71
71
|
- lib
|
72
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 3.3.4
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|