internator 0.1.2 → 0.1.3
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 -8
- data/lib/internator/cli.rb +34 -1
- 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: 18073f78a16e36078bdb10011feef8ba71f41d77aa9a466ec6fca41f93ed0be4
|
4
|
+
data.tar.gz: a08364f38362e1f96d19f81e46425191154aa1f5b50e997006dd04f692eaf1de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44e06263a8eaa9a9f770d12e31a41fbeb093505bb7e11a285e2c5f525561874340d2d3f3d519a49d686add8fe90cb09881a5a1d336249a9474d3e12e74a9fd3d
|
7
|
+
data.tar.gz: c8a452eb85370e576aa91b31b48669d091e1cc50fd342e394e07011646eba7a655fe8fe39459594ac269e176c2bef64a7016c36cc0417a34758563dc03fd2f5f
|
data/README.md
CHANGED
@@ -31,15 +31,8 @@ Example:
|
|
31
31
|
```bash
|
32
32
|
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
|
-
If you use tmux ensure `OPENAI_API_KEY` is forwarded into tmux sessions. Add the following to your `~/.tmux.conf`:
|
37
|
-
|
38
|
-
```tmux
|
39
|
-
# Ensure OPENAI_API_KEY is passed into tmux sessions if you use it.
|
40
|
-
set -g update-environment "OPENAI_API_KEY"
|
41
|
-
set-environment -g OPENAI_API_KEY "#{ENV:OPENAI_API_KEY}"
|
42
|
-
```
|
43
36
|
## Contributing
|
44
37
|
|
45
38
|
Feel free to open issues or submit pull requests.
|
data/lib/internator/cli.rb
CHANGED
@@ -58,8 +58,41 @@ module Internator
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
# Detect the repository's default branch across remotes (e.g., main, master, develop)
|
62
|
+
def self.detect_default_base
|
63
|
+
remotes = `git remote`.split("\n").reject(&:empty?)
|
64
|
+
remotes.unshift('origin') unless remotes.include?('origin')
|
65
|
+
remotes.each do |remote|
|
66
|
+
# Try to resolve remote HEAD via rev-parse
|
67
|
+
ref = `git rev-parse --abbrev-ref #{remote}/HEAD 2>/dev/null`.strip
|
68
|
+
return ref unless ref.empty?
|
69
|
+
# Fallback to symbolic-ref
|
70
|
+
sym = `git symbolic-ref refs/remotes/#{remote}/HEAD 2>/dev/null`.strip
|
71
|
+
if sym.start_with?('refs/remotes/')
|
72
|
+
return sym.sub('refs/remotes/', '')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
|
78
|
+
# Executes one Codex iteration by diffing against the appropriate base branch
|
61
79
|
def self.codex_cycle(objectives, iteration)
|
62
|
-
|
80
|
+
# Determine configured upstream and current branch name
|
81
|
+
upstream = `git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null`.strip
|
82
|
+
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
|
83
|
+
# Choose diff base:
|
84
|
+
# 1) If upstream is tracking current branch, use remote default branch
|
85
|
+
# 2) Else if upstream exists, diff against that
|
86
|
+
# 3) Otherwise fallback to remote default branch or master
|
87
|
+
if !upstream.empty? && upstream.split('/').last == current_branch
|
88
|
+
base = detect_default_base || upstream
|
89
|
+
elsif !upstream.empty?
|
90
|
+
base = upstream
|
91
|
+
else
|
92
|
+
base = detect_default_base || 'master'
|
93
|
+
end
|
94
|
+
# Get the diff against the chosen base
|
95
|
+
current_diff = `git diff #{base} 2>/dev/null`
|
63
96
|
current_diff = "No initial changes" if current_diff.strip.empty?
|
64
97
|
prompt = <<~PROMPT
|
65
98
|
Objectives: #{objectives}
|
data/lib/internator/version.rb
CHANGED