Skip to content

Commit adf17ef

Browse files
committed
Reorder edit format instructions and fix code block formatting in readme
1 parent af8a063 commit adf17ef

2 files changed

Lines changed: 69 additions & 86 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,8 @@ _TAB completions from SOTA reasoning models._
191191
192192
### File `[ACTIVE FILE PATH]`
193193
194-
```
195-
196194
[PREFIX]<missing_text>[PROMPT]</missing_text>[SUFFIX]
197195
198-
```
199-
200196
# Output formatting
201197
202198
Your response must begin with a markdown heading identifying the file and the cursor position, followed by a markdown code block containing the replacement text, followed by a brief explanation. The heading must be: "### Code at cursor: `[ACTIVE FILE PATH]` (ROW:COL)". Always refer to the symbol "<missing_text>" as "cursor position" and "replacement" as "completion". Example:
@@ -222,12 +218,8 @@ Find correct replacement text for the <missing_text> symbol.
222218
223219
### File `[ACTIVE FILE PATH]`
224220
225-
```
226-
227221
[PREFIX]<missing_text>[PROMPT]</missing_text>[SUFFIX]
228222
229-
```
230-
231223
# Output formatting
232224
233225
Find correct replacement for the <missing_text> symbol. Respond with replacement text within "replacement" XML tags, without explanations or any other text.
@@ -276,7 +268,7 @@ _Applying malformed edits._
276268
<details>
277269
<summary>WEB/API</summary>
278270

279-
````
271+
```
280272
[ORIGINAL FILE]
281273
282274
[MALFORMED EDITS]
@@ -285,22 +277,13 @@ _Applying malformed edits._
285277
286278
Your response must begin with a markdown heading identifying the file, followed by a markdown code block containing the updated file. The heading must be: "### Patch repair: `path/to/file.ext`". Example:
287279
288-
### Patched file: `path/to/file.ext`
289-
290-
```python
291-
def add(a, b):
292-
return a + b
293-
294-
def subtract(a, b):
295-
return a - b
296-
297-
```
280+
[EXAMPLE]
298281
299282
# Task
300283
301284
Apply the attached changes to the file without explanations or any other text.
302285
303-
````
286+
```
304287

305288
</details>
306289

‎apps/editor/src/constants/edit-format-instructions.ts‎

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -28,59 +28,41 @@ def subtract(a, b):
2828
2929
### Renamed file: \`src/examples/math_utils.py\` (old) \`src/examples/calculator.py\` (new)`
3030

31-
export const EDIT_FORMAT_INSTRUCTIONS_TRUNCATED = `${intro}, followed by a markdown code block with file's contents. As a space saving measure, truncate blocks like unchanged function bodies (code inside {}) by replacing with ellipsis comments. Example:
32-
Updated the greeting text.
33-
34-
### Updated file: \`src/examples/hello.js\`
35-
36-
\`\`\`javascript
37-
const DURATION = 5;
38-
const GREETING = "Hello, World!";
39-
40-
function getDuration() {
41-
// ...
42-
}
43-
44-
function showGreeting() {
45-
// ...
46-
}
47-
\`\`\`
48-
49-
Updated the purpose text.
50-
51-
### Updated file: \`src/README.md\`
52-
53-
\`\`\`markdown
54-
## Purpose
55-
56-
Greet user saying "Hello, World!", for a duration of 5 seconds.
57-
58-
## License
59-
60-
<!-- ... --->
31+
export const EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE = `${intro}, followed by a markdown code block showing the original and updated code snippets with Git-style merge conflict syntax. Example:
32+
Changed greeting to wishes.
6133
62-
## Author
34+
### Updated file: \`src/examples/hello.py\`
6335
64-
<!-- ... --->
36+
\`\`\`python
37+
<<<<<<< SEARCH
38+
GREETING = "Welcome everyone!"
39+
=======
40+
WISHES = "Have a nice day!"
41+
>>>>>>> REPLACE
42+
<<<<<<< SEARCH
43+
def show_greeting():
44+
print(GREETING)
45+
=======
46+
def show_wishes():
47+
print(WISHES)
48+
>>>>>>> REPLACE
6549
\`\`\`
6650
6751
Created a simple calculator with addition and subtraction.
6852
69-
### Created file: \`src/examples/calculator.js\`
53+
### Created file: \`src/examples/calculator.py\`
7054
71-
\`\`\`javascript
72-
function add(a, b) {
73-
return a + b;
74-
}
55+
\`\`\`python
56+
def add(a, b):
57+
return a + b
7558
76-
function subtract(a, b) {
77-
return a - b;
78-
}
59+
def subtract(a, b):
60+
return a - b
7961
\`\`\`
8062
81-
### Deleted file: \`src/examples/weekdays.js\`
63+
### Deleted file: \`src/examples/weekdays.py\`
8264
83-
### Renamed file: \`src/examples/math-tools.js\` (old) \`src/examples/calculator.js\` (new)`
65+
### Renamed file: \`src/examples/math_utils.py\` (old) \`src/examples/calculator.py\` (new)`
8466

8567
export const EDIT_FORMAT_INSTRUCTIONS_DIFF = `${intro}, followed by a unified diff within a markdown code block. Example:
8668
Updated the greeting text.
@@ -115,38 +97,56 @@ def subtract(a, b):
11597
11698
### Renamed file: \`src/examples/math_utils.py\` (old) \`src/examples/calculator.py\` (new)`
11799

118-
export const EDIT_FORMAT_INSTRUCTIONS_SEARCH_REPLACE = `${intro}, followed by a markdown code block showing the original and updated code snippets with Git-style merge conflict syntax. Example:
119-
Changed greeting to wishes.
100+
export const EDIT_FORMAT_INSTRUCTIONS_TRUNCATED = `${intro}, followed by a markdown code block with file's contents. As a space saving measure, truncate blocks like unchanged function bodies (code inside {}) by replacing with ellipsis comments. Example:
101+
Updated the greeting text.
120102
121-
### Updated file: \`src/examples/hello.py\`
103+
### Updated file: \`src/examples/hello.js\`
122104
123-
\`\`\`python
124-
<<<<<<< SEARCH
125-
GREETING = "Welcome everyone!"
126-
=======
127-
WISHES = "Have a nice day!"
128-
>>>>>>> REPLACE
129-
<<<<<<< SEARCH
130-
def show_greeting():
131-
print(GREETING)
132-
=======
133-
def show_wishes():
134-
print(WISHES)
135-
>>>>>>> REPLACE
105+
\`\`\`javascript
106+
const DURATION = 5;
107+
const GREETING = "Hello, World!";
108+
109+
function getDuration() {
110+
// ...
111+
}
112+
113+
function showGreeting() {
114+
// ...
115+
}
116+
\`\`\`
117+
118+
Updated the purpose text.
119+
120+
### Updated file: \`src/README.md\`
121+
122+
\`\`\`markdown
123+
## Purpose
124+
125+
Greet user saying "Hello, World!", for a duration of 5 seconds.
126+
127+
## License
128+
129+
<!-- ... --->
130+
131+
## Author
132+
133+
<!-- ... --->
136134
\`\`\`
137135
138136
Created a simple calculator with addition and subtraction.
139137
140-
### Created file: \`src/examples/calculator.py\`
138+
### Created file: \`src/examples/calculator.js\`
141139
142-
\`\`\`python
143-
def add(a, b):
144-
return a + b
140+
\`\`\`javascript
141+
function add(a, b) {
142+
return a + b;
143+
}
145144
146-
def subtract(a, b):
147-
return a - b
145+
function subtract(a, b) {
146+
return a - b;
147+
}
148148
\`\`\`
149149
150-
### Deleted file: \`src/examples/weekdays.py\`
150+
### Deleted file: \`src/examples/weekdays.js\`
151151
152-
### Renamed file: \`src/examples/math_utils.py\` (old) \`src/examples/calculator.py\` (new)`
152+
### Renamed file: \`src/examples/math-tools.js\` (old) \`src/examples/calculator.js\` (new)`

0 commit comments

Comments
 (0)