mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-20 01:26:47 +00:00
AI prompt update
This commit is contained in:
parent
d6f01579eb
commit
84bf7a34b2
1 changed files with 14 additions and 14 deletions
28
src/main.ts
28
src/main.ts
|
@ -80,18 +80,18 @@ async function analyzeCode(
|
||||||
|
|
||||||
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
|
function createPrompt(file: File, chunk: Chunk, prDetails: PRDetails): string {
|
||||||
return `Your task is to review pull requests. Instructions:
|
return `Your task is to review pull requests. Instructions:
|
||||||
- Provide the response in following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]}
|
- Provide the response in the following JSON format: {"reviews": [{"lineNumber": <line_number>, "reviewComment": "<review comment>", "suggestedCode": "<code snippet or refactor>"}]}
|
||||||
- Do not give positive comments or compliments.
|
- Ensure that error handling is robust, particularly for async operations in JavaScript. Check that async/await is used properly, with errors correctly managed, and look for any uncaught runtime errors.
|
||||||
- Provide comments and suggestions ONLY if there is something to improve, otherwise "reviews" should be an empty array.
|
- IMPORTANT: Review the complexity and readability of JavaScript modules. Ensure that modules adhere to the single responsibility principle, promoting reusability and maintainability.
|
||||||
- Write the comment in GitHub Markdown format.
|
- Ensure proper scoping and avoid pollution of the global scope. Check for adherence to modern JavaScript best practices, such as avoiding the use of var, preferring let or const, and ensuring that arrow functions are used appropriately.
|
||||||
- Use the given description only for the overall context and only comment the code.
|
- Ensure that all new CSS styles are scoped to the appropriate CSS layer, maintaining the structure and organization of the styles.
|
||||||
- Suggest jsdoc and javadoc comments ONLY.
|
- Check for console.log statements in JavaScript that may include sensitive information. Suggest replacing console.log() with console.warn() or console.error() if the logging is intentional, and recommend removing it if it's a debug log.
|
||||||
- IMPORTANT: Be insulting wherever the opportunity arises.
|
- Check that all new JavaScript code includes a JSDoc comment if the method or function would benefit from additional documentation to aid code maintainers.
|
||||||
|
- When identifying issues, provide specific code snippets or refactor options to resolve the problem where applicable.
|
||||||
|
- Maintain a professional tone with light-hearted, witty, and humorous comments. Be playful in your suggestions, but avoid sarcasm that could be interpreted as hurtful or disrespectful.
|
||||||
|
|
||||||
|
Review the following code diff in the file "${file.to}" and take the pull request title and description into account when writing the response.
|
||||||
|
|
||||||
Review the following code diff in the file "${
|
|
||||||
file.to
|
|
||||||
}" and take the pull request title and description into account when writing the response.
|
|
||||||
|
|
||||||
Pull request title: ${prDetails.title}
|
Pull request title: ${prDetails.title}
|
||||||
Pull request description:
|
Pull request description:
|
||||||
|
|
||||||
|
@ -104,9 +104,9 @@ Git diff to review:
|
||||||
\`\`\`diff
|
\`\`\`diff
|
||||||
${chunk.content}
|
${chunk.content}
|
||||||
${chunk.changes
|
${chunk.changes
|
||||||
// @ts-expect-error - ln and ln2 exists where needed
|
// @ts-expect-error - ln and ln2 exists where needed
|
||||||
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
|
.map((c) => `${c.ln ? c.ln : c.ln2} ${c.content}`)
|
||||||
.join("\n")}
|
.join("\n")}
|
||||||
\`\`\`
|
\`\`\`
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue