internator 0.1.5 → 0.1.6

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: 1af75a509f24238b06b9081ec89eda9dcf3981ec697fc1dd0e1b6287ee86afff
4
- data.tar.gz: 1e105ebea5a252205ef570a996ede9759c072d0f4ae58555813ec291458d6b66
3
+ metadata.gz: 6f09125886d45ef7715beec21a71c377bfc87c0bbda9961b43672d6f14bf483f
4
+ data.tar.gz: 8af709fed7f4efbb39c9047ad38e341c38934d50d2dc09ee07cc45345be28edc
5
5
  SHA512:
6
- metadata.gz: 69d1281c009c468e94937e19a45fc68238b3bdb0bdb8f35b6e401882f8b9552c5dc992ff65b30f1ffac80511edd9aedccc6375b403dcb781c6279bd610811bad
7
- data.tar.gz: 17d16892a135a1ae0d92be8f674329cdafe50f978726387347e73e86e7e6b6f4f3c1cc69e3e164733a8d981ae7fb1191035ec91ae50c42486896793843ae27de
6
+ metadata.gz: 5a33350b6d1b501be5607a7d5b60bf0cbd3118c6cb1ddd7d9bd3a2eefd7d0c7dee4b37776f704abb04312460661e716d42a89f88d0c56787644adc04a22fc5cb
7
+ data.tar.gz: e844ba9e21223c9f2b10a9e420f4b3cf448c6d95074ba023feaf9612b64602e0ab517caaf443c3b3f38984d093cc6eed5f9b3ff7e4415d61471e88a574bc559a
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.
10
+ - [Codex CLI](https://github.com/openai/codex) installed (>= 0.3.0).
11
11
  - Environment variable `OPENAI_API_KEY` set to your OpenAI API key.
12
12
 
13
13
  ## Installation
@@ -25,7 +25,7 @@ internator "<PR Objectives>" [delay_mins]
25
25
  ```
26
26
 
27
27
  - `<PR Objectives>`: Description of what the pull request should achieve.
28
- - `[delay_mins]`: (Optional) Minutes to wait between iterations (default: 0).
28
+ - `[delay_mins]`: (Optional) Minutes to wait between commits (default: 0).
29
29
 
30
30
  Example:
31
31
  ```bash
@@ -33,9 +33,22 @@ internator "Refactor authentication flow and add tests" 10
33
33
  ```
34
34
  For more detailed usage tips, see the [Usage Tips wiki page](https://github.com/AlexLarra/internator/wiki/Usage-tips).
35
35
 
36
- ## Contributing
36
+ ## Configuration
37
37
 
38
- Feel free to open issues or submit pull requests.
38
+ Internator reads custom instructions from a YAML file at `~/.internator_config.yml`. The file must define an `instructions` key whose value is the instruction text. For example:
39
+
40
+ ```yaml
41
+ # ~/.internator_config.yml
42
+ instructions: |
43
+ 1. Do not overuse code comments; if the method name says it all, comments are not necessary.
44
+ 2. Please treat files as if Vim were saving them with `set binary` and `set noeol`, i.e. do not add a final newline at the end of the file.
45
+ ```
46
+
47
+ When present, Internator will use these instructions instead of the built-in defaults.
48
+
49
+ ## Contributing
50
+
51
+ Feel free to open issues or submit pull requests.
39
52
 
40
53
  ## License
41
54
 
@@ -2,10 +2,54 @@ require "net/http"
2
2
  require "uri"
3
3
  require "json"
4
4
  require "tempfile"
5
+ require "yaml"
5
6
 
6
7
  module Internator
7
8
  # Command-line interface for the Internator gem
8
9
  class CLI
10
+ # Configuration file for custom options (YAML format).
11
+ CONFIG_FILE = File.expand_path('~/.internator_config.yml')
12
+
13
+ def self.config
14
+ @config ||= begin
15
+ if File.exist?(CONFIG_FILE)
16
+ YAML.load_file(CONFIG_FILE)
17
+ else
18
+ {}
19
+ end
20
+ rescue => e
21
+ warn "⚠️ Could not parse config file #{CONFIG_FILE}: #{e.message}"
22
+ {}
23
+ end
24
+ end
25
+
26
+ # Load custom instructions from config or fall back to built-in defaults
27
+ def self.instructions
28
+ main = <<~MAIN_INSTRUCTIONS
29
+ 1. If there are changes in the PR, first check if it has already been completed; if so, do nothing.
30
+ 2. Make ONLY one incremental change.
31
+ 3. Prioritize completing main objectives.
32
+ MAIN_INSTRUCTIONS
33
+
34
+ # Load custom instructions from ~/.internator_config.yml or fall back to built-in defaults
35
+ secondary =
36
+ if config.is_a?(Hash) && config['instructions'].is_a?(String)
37
+ config['instructions'].strip
38
+ else
39
+ <<~SECONDARY_INSTRUCTIONS
40
+ 1. Do not overuse code comments; if the method name says it all, comments are not necessary.
41
+ 2. Please treat files as if Vim were saving them with `set binary` and `set noeol`, i.e. do not add a final newline at the end of the file.
42
+ SECONDARY_INSTRUCTIONS
43
+ end
44
+
45
+ <<~INSTRUCTIONS.chomp
46
+ Main instructions:
47
+ #{main}
48
+ Secondary instructions:
49
+ #{secondary}
50
+ INSTRUCTIONS
51
+ end
52
+
9
53
  def self.run(args = ARGV)
10
54
  unless system("which codex > /dev/null 2>&1")
11
55
  abort "❌ 'codex' CLI is not installed or not in PATH. Please install it from https://github.com/openai/codex"
@@ -99,12 +143,7 @@ module Internator
99
143
  Iteration: #{iteration}
100
144
  Current Pull Request: #{current_diff}
101
145
 
102
- Instructions:
103
- 1. If there are changes in the PR, first check if it has already been completed; if so, do nothing.
104
- 2. Make ONLY one incremental change.
105
- 3. Prioritize completing main objectives.
106
- 4. Do not overuse code comments; if the method name says it all, comments are not necessary.
107
- 5. Please treat files as if Vim were saving them with `set binary` and `set noeol`, i.e. do not add a final newline at the end of the file.
146
+ #{instructions}
108
147
  PROMPT
109
148
 
110
149
  CodexService.new(prompt).call
@@ -1,3 +1,3 @@
1
1
  module Internator
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlexLarra