diff --git a/README.md b/README.md index 82583b26..dc3fc99d 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ Making pull requests less painful with an AI agent CodiumAI `PR-Agent` is an open-source tool aiming to help developers review pull requests faster and more efficiently. It automatically analyzes the pull request and can provide several types of commands: -‣ **Auto Description [(`/describe`)](./docs/DESCRIBE.md)**: Automatically generating PR description - title, type, summary, code walkthrough and labels. +‣ **Auto Description ([`/describe`](./docs/DESCRIBE.md))**: Automatically generating PR description - title, type, summary, code walkthrough and labels. \ -‣ **Auto Review (`/review`)**: [Adjustable feedback](https://github.com/Codium-ai/pr-agent/pull/229#issuecomment-1695022908) about the PR main theme, type, relevant tests, security issues, score, and various suggestions for the PR content. +‣ **Auto Review ([`/review`](./docs/REVIEW.md))**: Adjustable feedback about the PR main theme, type, relevant tests, security issues, score, and various suggestions for the PR content. \ ‣ **Question Answering (`/ask ...`)**: Answering [free-text questions](https://github.com/Codium-ai/pr-agent/pull/229#issuecomment-1695021332) about the PR. \ @@ -27,7 +27,7 @@ CodiumAI `PR-Agent` is an open-source tool aiming to help developers review pull \ ‣ **Update Changelog (`/update_changelog`)**: Automatically updating the CHANGELOG.md file with the [PR changes](https://github.com/Codium-ai/pr-agent/pull/168#discussion_r1282077645). \ -‣ **Find similar issue [(`/similar_issue`)](./docs/SIMILAR_ISSUE.md)**: Automatically retrieves and presents similar issues +‣ **Find similar issue ([`/similar_issue`](./docs/SIMILAR_ISSUE.md))**: Automatically retrieves and presents similar issues See the [usage guide](./Usage.md) for instructions how to run the different tools from [CLI](./Usage.md#working-from-a-local-repo-cli), or by [online usage](./Usage.md#online-usage), as well as additional details on optional commands and configurations. diff --git a/docs/DESCRIBE.md b/docs/DESCRIBE.md index 91bb1653..cb9d726c 100644 --- a/docs/DESCRIBE.md +++ b/docs/DESCRIBE.md @@ -15,7 +15,7 @@ The `describe` tool can also be triggered automatically every time a new PR is o ### Configuration options -Under the section 'pr_description', the [configuration file](./../pr_agent/settings/configuration.toml) contains options to customize the 'describe' tool: +Under the section 'pr_description', the [configuration file](./../pr_agent/settings/configuration.toml#L28) contains options to customize the 'describe' tool: - `publish_labels`: if set to true, the tool will publish the labels to the PR. Default is true. diff --git a/docs/REVIEW.md b/docs/REVIEW.md new file mode 100644 index 00000000..14afe3dd --- /dev/null +++ b/docs/REVIEW.md @@ -0,0 +1,39 @@ +# Describe Tool + +The `review` tool scans the PR code changes, and automatically generates a PR review. +It can ba invoked manually by commenting on any PR: +``` +/review +``` + + + + + + +The `review` tool can also be triggered automatically every time a new PR is opened. See examples for automatic triggers for [GitHub App](https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#github-app-automatic-tools) and [GitHub Action](https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#working-with-github-action) + +### Configuration options + +Under the section 'pr_reviewer', the [configuration file](./../pr_agent/settings/configuration.toml#L16) contains options to customize the 'review' tool: + +- `require_focused_review`: if set to true, the tool will add a section - 'is the PR a focused one'. Default is false. +- `require_score_review`: if set to true, the tool will add a section that scores the PR. Default is false. +- `require_tests_review`: if set to true, the tool will add a section that checks if the PR contains tests. Default is true. +- `require_security_review`: if set to true, the tool will add a section that checks if the PR contains security issues. Default is true. +- `require_estimate_effort_to_review`: if set to true, the tool will add a section that estimates thed effort needed to review the PR. Default is true. +- `num_code_suggestions`: number of code suggestions provided by the 'review' tool. Default is 4. +- `inline_code_comments`: if set to true, the tool will publish the code suggestions as comments on the code diff. Default is false. +- `automatic_review`: if set to false, no automatic reviews will be done. Default is true. +- `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...". + +#### PR Reflection +By invoking: +``` +/reflect_and_review +``` +The module will first ask the author questions about the PR, and will guide the review based on his answers. + + + + \ No newline at end of file diff --git a/docs/SIMILAR_ISSUE.md b/docs/SIMILAR_ISSUE.md index a8289a35..2dc2ce7e 100644 --- a/docs/SIMILAR_ISSUE.md +++ b/docs/SIMILAR_ISSUE.md @@ -1,7 +1,8 @@ # Similar Issue Tool -The similar issue tool retrieves the most similar issues to the current issue: +The similar issue tool retrieves the most similar issues to the current issue. +It can ba invoked manually by commenting on any PR: ``` -/similar issue +/similar_issue ``` diff --git a/pics/reflection_answers.png b/pics/reflection_answers.png new file mode 100644 index 00000000..2a08e0ab Binary files /dev/null and b/pics/reflection_answers.png differ diff --git a/pics/reflection_insights.png b/pics/reflection_insights.png new file mode 100644 index 00000000..c8e06d08 Binary files /dev/null and b/pics/reflection_insights.png differ diff --git a/pics/reflection_questions.png b/pics/reflection_questions.png new file mode 100644 index 00000000..4512a8a9 Binary files /dev/null and b/pics/reflection_questions.png differ diff --git a/pics/review.png b/pics/review.png new file mode 100644 index 00000000..51262f97 Binary files /dev/null and b/pics/review.png differ diff --git a/pics/review_comment.png b/pics/review_comment.png new file mode 100644 index 00000000..e314dcc4 Binary files /dev/null and b/pics/review_comment.png differ diff --git a/pr_agent/agent/pr_agent.py b/pr_agent/agent/pr_agent.py index 07c34c51..11db4dec 100644 --- a/pr_agent/agent/pr_agent.py +++ b/pr_agent/agent/pr_agent.py @@ -67,8 +67,8 @@ class PRAgent: args = update_settings_from_args(args) action = action.lstrip("/").lower() - if action == "reflect_and_review" and not get_settings().pr_reviewer.ask_and_reflect: - action = "review" + if action == "reflect_and_review": + get_settings().pr_reviewer.ask_and_reflect = True if action == "answer": if notify: notify()