Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit c82bf43

Browse files
authored
clarify that old hunk was replaced (#180)
<!-- This is an auto-generated comment: release notes by openai --> ### Summary by OpenAI Release Notes: - Refactor: Update code review instructions and response format for clarity and consistency. > "Code review made easy, > Instructions clear, response format breezy. > Bugs and issues, we'll catch them all, > Thanks to this PR, we stand tall." <!-- end of auto-generated comment: release notes by openai -->
1 parent 5850c25 commit c82bf43

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ inputs:
118118
$description
119119
```
120120
121-
Content of file `$filename`:
121+
Content of file `$filename` prior to changes:
122122
```
123123
$file_content
124124
```
@@ -181,7 +181,7 @@ inputs:
181181
$summary
182182
```
183183
184-
Content of file `$filename` for context:
184+
Content of `$filename` prior to changes for context:
185185
```
186186
$file_content
187187
```
@@ -209,7 +209,7 @@ inputs:
209209
$summary
210210
```
211211
212-
Content of file:
212+
Content of file prior to changes:
213213
```
214214
$file_content
215215
```

src/review.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ export const codeReview = async (
146146
continue
147147
}
148148
const hunks_str = `
149-
---new_hunk_for_review---
149+
---new_hunk---
150150
\`\`\`
151151
${hunks.new_hunk}
152152
\`\`\`
153153
154-
---old_hunk_for_context---
154+
---old_hunk---
155155
\`\`\`
156156
${hunks.old_hunk}
157157
\`\`\`
@@ -387,17 +387,17 @@ ${
387387
// Pack instructions
388388
ins.patches += `
389389
Format for changes:
390-
---new_hunk_for_review---
390+
---new_hunk---
391391
\`\`\`
392392
<new hunk annotated with line numbers>
393393
\`\`\`
394394
395-
---old_hunk_for_context---
395+
---old_hunk---
396396
\`\`\`
397397
<old hunk that was replaced by the new hunk above>
398398
\`\`\`
399399
400-
---comment_chains_for_context---
400+
---comment_chains---
401401
\`\`\`
402402
<comment chains>
403403
\`\`\`
@@ -406,9 +406,11 @@ Format for changes:
406406
...
407407
408408
The above format for changes consists of multiple change sections.
409-
Each change section consists of a new hunk (annotated with line numbers),
410-
an old hunk (that was replaced with new hunk) and optionally, comment
411-
chains for context.
409+
Each change section consists of a new hunk (annotated with line numbers)
410+
and an old hunk. Note that the code in old_hunk does not exist anymore
411+
as it was replaced by the new hunk. The old_hunk is only included for
412+
context. The new hunk is the code that you should review. Optionally,
413+
existing review comment chains are included for additional context.
412414
413415
Important instructions:
414416
- Your task is to do a line by line review of new hunks and point out
@@ -434,7 +436,7 @@ Important instructions:
434436
- If needed, provide a replacement suggestion using fenced code blocks
435437
with the \`suggestion\` as the language identifier. The line number range
436438
in the review section must map exactly to the line number range (inclusive)
437-
that need to be replaced within a new_hunk_for_review.
439+
that need to be replaced within a new_hunk.
438440
For instance, if 2 lines of code in a hunk need to be replaced with 15 lines
439441
of code, the line number range must be those exact 2 lines. If an entire hunk
440442
need to be replaced with new code, then the line number range must be the
@@ -474,15 +476,15 @@ Response format expected:
474476
...
475477
476478
Example changes:
477-
---new_hunk_for_review---
479+
---new_hunk---
478480
1: def add(x, y):
479481
2: z = x+y
480482
3: retrn z
481483
4:
482484
5: def multiply(x, y):
483485
6: return x * y
484486
485-
---old_hunk_for_context---
487+
---old_hunk---
486488
def add(x, y):
487489
return x + y
488490
@@ -577,7 +579,7 @@ ${patch}
577579
`
578580
if (comment_chain !== '') {
579581
ins.patches += `
580-
---comment_chains_for_review---
582+
---comment_chains---
581583
\`\`\`
582584
${comment_chain}
583585
\`\`\`

0 commit comments

Comments
 (0)