internator 0.1.8 → 0.1.9
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 +1 -1
- data/lib/internator/cli.rb +1 -2
- data/lib/internator/codex_service.rb +8 -12
- data/lib/internator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 677bf4f9a06e89a9595db0b00170e3f3f681f10df110796cae33de79e8f1a539
|
4
|
+
data.tar.gz: d2ada07c647aff576ba3c60550643e2bb729184b55d3c00f0a5d557fa83071a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 417692ddaf3d8cc9fc8c4ce84c77aa627ceba9c1f3aed744737ef0525a9baab8705bfc6abcce5a15b3ffb6288999d817ff10c0442effe7a5c3332fa9d0f6cd00
|
7
|
+
data.tar.gz: 198f1b5c098fe81e6e49388e2f557362193ae7851156606c3e777bc8edf9495a7312c938ec84dbdc5d63690ab69e75ed7f768a760866da61649f20e8657f5da1
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Internator is a Ruby-based CLI tool that automates iterative pull request improv
|
|
7
7
|
## Requirements
|
8
8
|
|
9
9
|
- Ruby (>= 2.5).
|
10
|
-
- [Codex CLI](https://github.com/openai/codex) installed (v 0.
|
10
|
+
- [Codex CLI](https://github.com/openai/codex) installed (v 0.46.0).
|
11
11
|
- Environment variable `OPENAI_API_KEY` set to your OpenAI API key.
|
12
12
|
|
13
13
|
## Installation
|
data/lib/internator/cli.rb
CHANGED
@@ -180,13 +180,12 @@ module Internator
|
|
180
180
|
|
181
181
|
# Generate a concise commit message for the given diff using OpenAI
|
182
182
|
def self.generate_commit_message(diff)
|
183
|
-
api_key = ENV["OPENAI_API_KEY"]
|
184
183
|
uri = URI("https://api.openai.com/v1/chat/completions")
|
185
184
|
http = Net::HTTP.new(uri.host, uri.port)
|
186
185
|
http.use_ssl = true
|
187
186
|
headers = {
|
188
187
|
"Content-Type" => "application/json",
|
189
|
-
"Authorization" => "Bearer #{
|
188
|
+
"Authorization" => "Bearer #{ENV["OPENAI_API_KEY"]}"
|
190
189
|
}
|
191
190
|
body = {
|
192
191
|
model: "gpt-4o-mini",
|
@@ -1,23 +1,19 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
1
3
|
module Internator
|
2
|
-
# Service for executing the Codex CLI with full-auto mode
|
3
4
|
class CodexService
|
4
|
-
# @param instruction [String] Text instruction for Codex
|
5
5
|
def initialize(instruction)
|
6
6
|
@instruction = instruction
|
7
7
|
end
|
8
8
|
|
9
|
-
# Executes `codex --full-auto` with the provided instruction.
|
9
|
+
# Executes `codex exec --full-auto` with the provided instruction.
|
10
10
|
# @return [Integer] Exit code of the Codex process
|
11
11
|
def call
|
12
|
-
command =
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"--full-auto",
|
18
|
-
@instruction
|
19
|
-
]
|
20
|
-
system(*command)
|
12
|
+
command = <<~CMD
|
13
|
+
printenv OPENAI_API_KEY | codex login --with-api-key &&
|
14
|
+
codex exec --full-auto #{Shellwords.escape(@instruction)}
|
15
|
+
CMD
|
16
|
+
system(command)
|
21
17
|
$?.exitstatus
|
22
18
|
end
|
23
19
|
end
|
data/lib/internator/version.rb
CHANGED