llm_fixer 0.0.5 → 0.0.7
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/Gemfile.lock +1 -1
- data/README.md +3 -0
- data/lib/llm_fixer/static_analysis_fixer.rb +14 -23
- data/lib/llm_fixer/version.rb +1 -1
- data/lib/templates/fix_prompt_system.erb +1 -1
- metadata +2 -3
- data/.rspec_status +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5135df7d976551f745312f036ceccb58b06a4555bcb64682da8043e27478ff1
|
4
|
+
data.tar.gz: a3abeda24ca16df63b22d5ad108ab378172c2f2da9854151719fd00f519354ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56936bb3c0c5bf73a4213040b9ba4fa1a3fa05bed42e346e5334f44f2e0f92688b5887ad2b5cf6fac44ea3504f0d05894a8bacf05979c684999e3c48370bce20
|
7
|
+
data.tar.gz: f46b579da3289127eb6d782a20719d5a5d24e4321e60653596d8ae3f2713f5470f477319ccef02f3bbd100501e5cdb1b8a39deea9d9b526d5db3364ca1d48db4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -31,6 +31,7 @@ You can customize the behavior using the following environment variables:
|
|
31
31
|
- `LLM_API_KEY` : LLM API key
|
32
32
|
- `LLM_API_BASE` : Base URL for the LLM API
|
33
33
|
- `LLM_MODEL` : LLM model to use
|
34
|
+
- `LLM_REASONING_EFFORT` : (Optional) Reasoning effort level for the LLM. Valid values: `low`, `medium`, `high`
|
34
35
|
|
35
36
|
## Usage
|
36
37
|
|
@@ -58,6 +59,8 @@ Local(LM Studio)
|
|
58
59
|
export LLM_API_KEY="n/a"
|
59
60
|
export LLM_API_BASE="http://localhost:1234"
|
60
61
|
export LLM_MODEL="tinyswallow-1.5b-instruct"
|
62
|
+
# Optional: Set reasoning effort (low, medium, or high)
|
63
|
+
export LLM_REASONING_EFFORT="high"
|
61
64
|
```
|
62
65
|
|
63
66
|
##
|
@@ -19,7 +19,9 @@ module LlmFixer
|
|
19
19
|
request_timeout: 600,
|
20
20
|
)
|
21
21
|
@model = ENV.fetch("LLM_MODEL", DEFAULT_MODEL)
|
22
|
+
@reasoning_effort = ENV.fetch("LLM_REASONING_EFFORT", nil)
|
22
23
|
puts "LLM model: #{@model}"
|
24
|
+
puts "Reasoning effort: #{@reasoning_effort}" if @reasoning_effort
|
23
25
|
end
|
24
26
|
|
25
27
|
def fix_file(args, additional_prompt = nil)
|
@@ -73,16 +75,19 @@ module LlmFixer
|
|
73
75
|
puts messages
|
74
76
|
full_response = ""
|
75
77
|
puts "===== Start generating fix ====="
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
},
|
78
|
+
|
79
|
+
parameters = {
|
80
|
+
model: @model,
|
81
|
+
messages: messages,
|
82
|
+
stream: proc { |chunk|
|
83
|
+
content = chunk.dig("choices", 0, "delta", "content")
|
84
|
+
full_response += content if content
|
84
85
|
},
|
85
|
-
|
86
|
+
}
|
87
|
+
|
88
|
+
parameters[:reasoning] = { effort: @reasoning_effort } if %w(low medium high).include?(@reasoning_effort)
|
89
|
+
|
90
|
+
@client.chat(parameters: parameters)
|
86
91
|
|
87
92
|
full_response.strip!
|
88
93
|
# remove markdown syntax
|
@@ -111,19 +116,5 @@ module LlmFixer
|
|
111
116
|
|
112
117
|
messages
|
113
118
|
end
|
114
|
-
|
115
|
-
# LLMが警告以外の場所も直した上、差分として上げなかったため、不正なパッチになってしまったので一旦ファイル丸ごと出力されることしにた
|
116
|
-
def apply_patch(patch)
|
117
|
-
Tempfile.create("patch") do |f|
|
118
|
-
f.write(patch)
|
119
|
-
f.close
|
120
|
-
patch_command = "patch -f --no-backup-if-mismatch -p1 < #{f.path}"
|
121
|
-
_, stderr, status = Open3.capture3(patch_command)
|
122
|
-
unless status.exitstatus.zero?
|
123
|
-
puts "Failed to apply patch: #{stderr}".colorize(:red)
|
124
|
-
exit 1
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
119
|
end
|
129
120
|
end
|
data/lib/llm_fixer/version.rb
CHANGED
@@ -2,6 +2,6 @@ You are a code repair assistant. Your task is to fix static analysis errors in c
|
|
2
2
|
You should:
|
3
3
|
- Fix only the error locations. Don't add comments that explain the process.
|
4
4
|
- Delete unnecessary lines instead of commenting them out
|
5
|
-
- Generate fixed full source code
|
5
|
+
- Generate only fixed full source code. Don't add any comments.
|
6
6
|
|
7
7
|
The command, FileContent, and ErrorOutput will be provided in the user message.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llm_fixer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaiba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -132,7 +132,6 @@ extensions: []
|
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
134
|
- ".rspec"
|
135
|
-
- ".rspec_status"
|
136
135
|
- ".rubocop.yml"
|
137
136
|
- Gemfile
|
138
137
|
- Gemfile.lock
|
data/.rspec_status
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
example_id | status | run_time |
|
2
|
-
------------------------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:1:1:1] | passed | 0.01216 seconds |
|
4
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:1:2:1] | passed | 0.0065 seconds |
|
5
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:1:2:2] | passed | 0.00644 seconds |
|
6
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:1:3:1] | passed | 0.00635 seconds |
|
7
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:2:1] | passed | 0.00056 seconds |
|
8
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:2:2] | passed | 0.00033 seconds |
|
9
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:3:1] | passed | 0.00156 seconds |
|
10
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:3:2] | passed | 0.00018 seconds |
|
11
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:4:1:1] | passed | 0.00012 seconds |
|
12
|
-
./spec/llm_fixer/static_analysis_fixer_spec.rb[1:4:2:1] | passed | 0.00015 seconds |
|