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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 508b98001145212b3564c55c7dfaff2b57bf429765821aac7dd60573a7da460f
4
- data.tar.gz: f772d59ee613bd395c88fd1adc63cb421a2786296c40d457eca3fb01ad14a1c1
3
+ metadata.gz: 18073f78a16e36078bdb10011feef8ba71f41d77aa9a466ec6fca41f93ed0be4
4
+ data.tar.gz: a08364f38362e1f96d19f81e46425191154aa1f5b50e997006dd04f692eaf1de
5
5
  SHA512:
6
- metadata.gz: 3a97dc5c4f7e5be5a2ec332275573d6576da0f53e708c643f53c3f73da9e03a278ce037f498c0299bb10c5e4108629ee299552b8cabc4b72f11c9068be7ee7be
7
- data.tar.gz: da6035798511857c09f7aadb85d78572f00fea31bc26883612dad4154c406693e363c29131c02079c76292021af65ceaa3fe9c6ab5cd329ea01347d5ab45f8c3
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
- ## Tmux
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.
@@ -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
- current_diff = `git diff master 2>/dev/null`
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}
@@ -1,3 +1,3 @@
1
1
  module Internator
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlexLarra