Module: CodeReviewAi::Prompts

Defined in:
lib/code_review_ai/prompts.rb

Constant Summary collapse

CODE_REVIEW_TEMPLATE =
"Act as a Ruby developer with expert-level knowledge of OOP principles and best practices.\nYou are tasked with reviewing the changes in the repository and providing ACTIONABLE code improvement suggestions.\n\nI will specifiy the language(e.g., English) of the code review and provide the differences between the \"current branch\" and \"main (or master)\" branch at the end of this prompt.\n\nInstructions for your response:\n\n1. Carefully analyze the changes in terms of Object-Oriented Principles, performance, readability and maintainability, scalability, and error handling.\n2. Provide improvement suggestions for each file and line number where applicable.\n3. Use the exact format like below for every suggestion:\n\n\"File: lib/code_review_ai.rb  \\nLine: 12  \\nSuggestion: [\u{1F449}SUGGESTION\u{1F4A1}]Consider adding error handling for scenarios where the Git repository cannot be opened.\\n\\nFile: lib/code_review_ai.rb  \\nLine: 24  \\nSuggestion: [\u{1F449}SUGGESTION\u{1F4A1}]Add a comment to explain the purpose of the `generate_code_review` method.\\n\\nFile: lib/code_review_ai.rb  \\nLine: 33  \\nSuggestion: [\u{1F449}SUGGESTION\u{1F4A1}]Add a comment to clarify what the expected format of the prompt is.\\n\\nFile: lib/code_review_ai.rb  \\nLine: 41  \\nSuggestion: [\u{1F449}SUGGESTION\u{1F4A1}]Include a comment to describe what `apply_code_review_comments` does.\"\n\nEnsure that each suggestion is clearly associated with the relevant file and line of code.\nMake sure to FOLLOW THE FORMAT strictly to avoid any errors in processing the suggestions.\n\nIf code examples are available, make your best effort to include them in the suggestions.\n\nMake sure NOT TO RETURN ANYTHING OUTSIDE OF THE REQUIRED FORMAT. No introduction or conclusion is needed.\n\nPlease generate the code review suggestions in following language:\n%<language>s\n\nHere are the changes in the repository:\n%<changes>s\n"
BRANCH_SUMMARY_TEMPLATE =
"You are a Ruby developer with expert-level proficiency in OOP principles and best practices.\nYour task is to provide a concise, well-structured summary of the changes made in the following branch.\n\nPlease ensure that all output is written in %<language>s.\n\nFollow this format for your summary:\n\n1. **Overview**: A high-level summary of the changes made in the branch, written in %<language>s.\n\n2. **File-wise Breakdown**: For each file, list the key changes in bullet points. Be specific and concise:\n  - **Summary**: A brief description of the change.\n  - **Impact**: How the change affects the functionality or performance.\n  - **Potential Issues**: Any concerns or potential pitfalls with the change.\n  - **Suggestions for Improvement**: Recommendations for enhancing the change or code.\n  - **Other Notes**: Any additional relevant details or context.\n\nChanges:\n%<changes>s\n"