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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d33b4fb255d17e002241c8d049c7ddae3ae67a91bc5047775a3805ab0b98328
4
- data.tar.gz: 2ddd4787eecc43049ea2f548832fa448f18f5939c52a807f93d5ae4968da6193
3
+ metadata.gz: 677bf4f9a06e89a9595db0b00170e3f3f681f10df110796cae33de79e8f1a539
4
+ data.tar.gz: d2ada07c647aff576ba3c60550643e2bb729184b55d3c00f0a5d557fa83071a4
5
5
  SHA512:
6
- metadata.gz: 8820879243003de78152d85a10b5ec1ba3b3b9738074f45b35ec7f518c13815809ab2bda9c944662db25bc5de8245895e7d8b3f6b5e435a08aa6ed1e645887a5
7
- data.tar.gz: a764e5adf9a315fc5eab5d3cba3b3447ad3217973308c5ff5419e3b1696c7b6b76b019fc31bd64da25561d88709454a184f5af82f1aabdfb3a2359ec157efe90
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.30.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
@@ -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 #{api_key}"
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
- "codex",
14
- "exec",
15
- "-c",
16
- "preferred_auth_method=apikey",
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
@@ -1,3 +1,3 @@
1
1
  module Internator
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlexLarra