compose 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/prompts/task.txt +2 -0
- data/config/prompts/verify.txt +4 -1
- data/lib/compose/edit_processor.rb +4 -2
- data/lib/compose/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: '0181e80bc473a0e67c074cc18b299be97ecad391875a7578780a3f8a93286cdc'
|
4
|
+
data.tar.gz: a4d171f396fd690387c122958565eb047efd3b0ef11c99acd6fc6e557a78f1e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 172b6babed118da8b989bffb8dad311eef02a27c21200df782fccf29783d929559ca44e98023c4ac2e3607e1ece53a36e7490834c9fc09aaffe82aaf8dfc94ec
|
7
|
+
data.tar.gz: 89b5cd472edfe13a5007e753d23bca1be694ae056314f71376f442af323de21e1bdcf395c0560445534172c22a7304185df21d0b1835c7e65f05c26c325bf050
|
data/config/prompts/task.txt
CHANGED
@@ -7,6 +7,8 @@ Facts:
|
|
7
7
|
2. Leave toLine empty for additions.
|
8
8
|
3. Make sure the code snippet in the edit is complete. Feel free to make multiple edits, avoid repeating existing code if you can.
|
9
9
|
4. Ensure the line numbers are accurate. Feel free to repeat existing code from previous or after lines to be sure.
|
10
|
+
5. When adding new code to the end of a file, make sure to repeat the last
|
11
|
+
line of the file in the edit before adding a new line.
|
10
12
|
|
11
13
|
```json
|
12
14
|
{
|
data/config/prompts/verify.txt
CHANGED
@@ -10,7 +10,10 @@ Verify this change:
|
|
10
10
|
{{CHANGE}}
|
11
11
|
```
|
12
12
|
|
13
|
-
and make sure it's needed and it's only replacing the correct lines, or adding
|
13
|
+
and make sure it's needed and it's only replacing the correct lines, or adding
|
14
|
+
the code to the correct place. Feel free to change additions to replacements
|
15
|
+
or vice versa, fix atLine, fromLineNumber, toLineNumber if they would produce
|
16
|
+
duplicated code lines, `or skip edits if they're not needed.
|
14
17
|
Return only the fixed change object following this JSON spec:
|
15
18
|
|
16
19
|
```json
|
@@ -86,7 +86,7 @@ module Compose
|
|
86
86
|
|
87
87
|
case edit[:change][:type]
|
88
88
|
when 'addition'
|
89
|
-
new_content.insert(edit[:change][:atLine] - 1, edit[:code])
|
89
|
+
new_content.insert(edit[:change][:atLine] - 1, edit[:code].split("\n").map { |line| line + "\n" })
|
90
90
|
when 'replacement'
|
91
91
|
new_content[edit[:change][:fromLineNumber] - 1..edit[:change][:toLineNumber] - 1] = edit[:code].split("\n").map { |line| line + "\n" }
|
92
92
|
end
|
@@ -109,7 +109,7 @@ module Compose
|
|
109
109
|
case edit[:change][:type]
|
110
110
|
when 'addition'
|
111
111
|
adjusted_line = edit[:change][:atLine] + line_offset
|
112
|
-
content.insert(adjusted_line - 1, edit[:code])
|
112
|
+
content.insert(adjusted_line - 1, edit[:code].split("\n").map { |line| line + "\n" })
|
113
113
|
line_offset += edit[:code].count("\n") + 1
|
114
114
|
when 'replacement'
|
115
115
|
from_line = edit[:change][:fromLineNumber] + line_offset
|
@@ -121,6 +121,8 @@ module Compose
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
+
content = content.flatten
|
125
|
+
|
124
126
|
FileUtils.mkdir_p(File.dirname(filename))
|
125
127
|
File.write(filename, content.join)
|
126
128
|
puts "Applied changes to #{filename}".green
|
data/lib/compose/version.rb
CHANGED