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

Commit 61cb95f

Browse files
authored
refactor instructions (#242)
<!-- This is an auto-generated comment: release notes by openai --> ### Summary by OpenAI Release Notes: - Documentation: Modified code review instructions and introduced a new format for line number annotations in `src/prompts.ts`. > "Code review made better, with instructions clearer, > Annotations new, to make errors rarer." <!-- end of auto-generated comment: release notes by openai -->
1 parent d4e14ab commit 61cb95f

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

dist/index.js

Lines changed: 16 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/prompts.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ Instructions:
150150
- The format for changes provided above consists of multiple change
151151
sections, each containing a new hunk (annotated with line numbers),
152152
an old hunk, and optionally, existing comment chains. Note that the
153-
old hunk code has been replaced by the new hunk.
154-
- Your task is to review new hunks line by line, ONLY pointing out
153+
old hunk code has been replaced by the new hunk. The line number
154+
annotation on each line in the new hunk is of the format
155+
\`<line_number><colon><whitespace>\`.
156+
- Your task is to review ONLY the new hunks line by line, ONLY pointing out
155157
substantive issues within line number ranges. Provide the exact line
156158
number range (inclusive) for each issue. Focus on identifying specific
157159
issues and avoid summarizing changes or providing general feedback.
@@ -169,17 +171,23 @@ Instructions:
169171
code snippets. Do not annotate code snippets with line numbers.
170172
- If needed, provide replacement suggestions using fenced code blocks with the
171173
\`suggestion\` language identifier. The line number range must map exactly
172-
to the range that needs to be replaced within a new hunk. Replacement
173-
suggestions should be complete and correctly formatted units for direct
174-
committing in the GitHub UI. Each suggestion must be provided as a separate
174+
to the range (inclusive) that needs to be replaced within a new hunk. For
175+
instance, if 2 lines of code in a hunk need to be replaced with 15 lines
176+
of code, the line number range must be those exact 2 lines. If an entire
177+
hunk need to be replaced with new code, then the line number range must
178+
be the entire hunk.
179+
- Replacement suggestions should be complete, correctly formatted and without
180+
the line number annotations. Each suggestion must be provided as a separate
175181
review section with relevant line number ranges.
176182
- If needed, suggest new code using the correct language identifier in the
177183
fenced code blocks. These snippets may be added to a different file,
178184
such as test cases. Multiple new code snippets are allowed within a single
179185
review section.
180-
- If no substantive issues are detected or the implementation looks good,
181-
respond with "LGTM!" and nothing else for the respective line range in a
182-
review section.
186+
- If there are no substantive issues detected at a line range and/or the
187+
implementation looks good, you must respond with the comment "LGTM!" and
188+
nothing else for the respective line range in a review section.
189+
- Reflect on your comments and line number ranges before sending the final
190+
response to ensure accuracy of line number ranges and replacement snippets.
183191
184192
Response format expected:
185193
<start_line_number>-<end_line_number>:

0 commit comments

Comments
 (0)