dorian-commit 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- 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: 91a09f92909e81f2a2f56cbf28b961c78f93299473f58357b00cbbee95026edc
|
4
|
+
data.tar.gz: 77c2efb3a5803bd1ae6a24c94ce5395f65f02fc7c493b90a9fb3a7683b340749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef4bde195f715f6133c703794ef3e6b6498be8ae04bfd51163d5aef9adef5cba5afaf62fc690cdd2f6cc72a8a260770a9e808afa7fd99e6dd1a8a360b30f79a7
|
7
|
+
data.tar.gz: 4ba57647e46452ba87af5ebfd59a9c9f873dfd1fcd718b6baf9a219ae41336bc966b69dc79e64ab9c4a56d1b026f31384d3ffb2869c6b38638aefdad7f44a940
|
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.1
|
4
|
+
version: 1.2.1
|
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-
|
11
|
+
date: 2024-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dorian-arguments
|
@@ -73,14 +73,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '3'
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.5.
|
83
|
+
rubygems_version: 3.5.16
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: commit with ai
|