From 2f4e40860ded05a7227399b3ba64e32d18cdb53c Mon Sep 17 00:00:00 2001 From: mrT23 Date: Wed, 17 Apr 2024 16:29:12 +0300 Subject: [PATCH] Replace `keep_original_user_title` with `generate_ai_title` for PR description customization and update documentation accordingly --- docs/docs/tools/describe.md | 11 +++++------ docs/docs/usage-guide/automations_and_usage.md | 11 +++++------ docs/docs/usage-guide/configuration_options.md | 2 +- pr_agent/servers/help.py | 5 ++--- pr_agent/settings/configuration.toml | 8 ++++---- pr_agent/tools/pr_description.py | 2 +- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/docs/docs/tools/describe.md b/docs/docs/tools/describe.md index 62a7eb34..80e2adb4 100644 --- a/docs/docs/tools/describe.md +++ b/docs/docs/tools/describe.md @@ -56,7 +56,7 @@ publish_labels = ... - `add_original_user_description`: if set to true, the tool will add the original user description to the generated description. Default is true. - - `keep_original_user_title`: if set to true, the tool will keep the original PR title, and won't change it. Default is true. + - `generate_ai_title`: if set to true, the tool will also generate an AI title for the PR. Default is false. - `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...". @@ -168,18 +168,17 @@ The description should be comprehensive and detailed, indicating when to add the !!! tip "Automation" - When you first install PR-Agent app, the [default mode](../usage-guide/automations_and_usage.md#github-app) for the describe tool is: ``` - pr_commands = ["/describe --pr_description.add_original_user_description=true" - "--pr_description.keep_original_user_title=true", ...] + pr_commands = ["/describe --pr_description.add_original_user_description=true ..."] ``` - meaning the `describe` tool will run automatically on every PR, will keep the original title, and will add the original user description above the generated description. + meaning the `describe` tool will run automatically on every PR, and will add the original user description above the generated description.
This default settings aim to strike a good balance between automation and control: - If you want more automation, just give the PR a title, and the tool will auto-write a full description; If you want more control, you can add a detailed description, and the tool will add the complementary description below it. - For maximal automation, you can change the default mode to: ``` pr_commands = ["/describe --pr_description.add_original_user_description=false" - "--pr_description.keep_original_user_title=true", ...] + " --pr_description.generate_ai_tile=true", ...] ``` - so the title will be auto-generated as well. + so the title of the PR will be auto-generated as well. - Markers are an alternative way to control the generated description, to give maximal control to the user. If you set: ``` pr_commands = ["/describe --pr_description.use_description_markers=true", ...] diff --git a/docs/docs/usage-guide/automations_and_usage.md b/docs/docs/usage-guide/automations_and_usage.md index d7a009e0..a69c0851 100644 --- a/docs/docs/usage-guide/automations_and_usage.md +++ b/docs/docs/usage-guide/automations_and_usage.md @@ -62,20 +62,19 @@ The configuration parameter `pr_commands` defines the list of tools that will be ``` [github_app] pr_commands = [ - "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true --pr_description.final_update_message=false", + "/describe --pr_description.add_original_user_description=true --pr_description.final_update_message=false", "/review --pr_reviewer.num_code_suggestions=0", "/improve", ] ``` This means that when a new PR is opened/reopened or marked as ready for review, PR-Agent will run the `describe`, `review` and `improve` tools. -For the `describe` tool, for example, the `add_original_user_description` and `keep_original_user_title` parameters will be set to true. +For the `describe` tool, for example, the `add_original_user_description` parameter will be set to true. You can override the default tool parameters by using one the three options for a [configuration file](https://codium-ai.github.io/Docs-PR-Agent/usage-guide/#configuration-options): **wiki**, **local**, or **global**. For example, if your local `.pr_agent.toml` file contains: ``` [pr_description] add_original_user_description = false -keep_original_user_title = false ``` When a new PR is opened, PR-Agent will run the `describe` tool with the above parameters. @@ -102,7 +101,7 @@ The configuration parameter `push_commands` defines the list of tools that will [github_app] handle_push_trigger = true push_commands = [ - "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", + "/describe --pr_description.add_original_user_description=true", "/review --pr_reviewer.num_code_suggestions=0 --pr_reviewer.final_update_message=false", ] ``` @@ -142,7 +141,7 @@ After setting up a GitLab webhook, to control which commands will run automatica ``` [gitlab] pr_commands = [ - "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", + "/describe --pr_description.add_original_user_description=true", "/review --pr_reviewer.num_code_suggestions=0", "/improve", ] @@ -202,7 +201,7 @@ To control which commands will run automatically when a new PR is opened, you ca ``` [azure_devops_server] pr_commands = [ - "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", + "/describe --pr_description.add_original_user_description=true", "/review --pr_reviewer.num_code_suggestions=0", "/improve", ] diff --git a/docs/docs/usage-guide/configuration_options.md b/docs/docs/usage-guide/configuration_options.md index ee908b76..54a37a86 100644 --- a/docs/docs/usage-guide/configuration_options.md +++ b/docs/docs/usage-guide/configuration_options.md @@ -23,7 +23,7 @@ An example content: ``` [pr_description] -keep_original_user_title=false +generate_ai_title=true ``` PR-Agent will know to remove the triple-quotes when reading the configuration content. diff --git a/pr_agent/servers/help.py b/pr_agent/servers/help.py index d76f70a4..b37cedc3 100644 --- a/pr_agent/servers/help.py +++ b/pr_agent/servers/help.py @@ -68,10 +68,9 @@ some_config2=... output += """\ - When you first install the app, the [default mode](https://pr-agent-docs.codium.ai/usage-guide/automations_and_usage/#github-app-automatic-tools-when-a-new-pr-is-opened) for the describe tool is: ``` -pr_commands = ["/describe --pr_description.add_original_user_description=true" - "--pr_description.keep_original_user_title=true", ...] +pr_commands = ["/describe --pr_description.add_original_user_description=true ..."] ``` -meaning the `describe` tool will run automatically on every PR, will keep the original title, and will add the original user description above the generated description. +meaning the `describe` tool will run automatically on every PR, and will add the original user description above the generated description. - Markers are an alternative way to control the generated description, to give maximal control to the user. If you set: ``` diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 01646ff4..bd85b0fe 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -53,7 +53,7 @@ maximal_review_effort=5 [pr_description] # /describe # publish_labels=true add_original_user_description=true -keep_original_user_title=true +generate_ai_title=false use_bullet_points=true extra_instructions = "" enable_pr_type=true @@ -148,7 +148,7 @@ override_deployment_type = true # settings for "pull_request" event handle_pr_actions = ['opened', 'reopened', 'ready_for_review'] pr_commands = [ - "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", + "/describe --pr_description.add_original_user_description=true", "/review --pr_reviewer.num_code_suggestions=0", "/improve", ] @@ -160,7 +160,7 @@ push_trigger_wait_for_initial_review = true push_trigger_pending_tasks_backlog = true push_trigger_pending_tasks_ttl = 300 push_commands = [ - "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", + "/describe --pr_description.add_original_user_description=true", "/review --pr_reviewer.num_code_suggestions=0", ] ignore_pr_title = [] @@ -169,7 +169,7 @@ ignore_bot_pr = true [gitlab] url = "https://gitlab.com" # URL to the gitlab service pr_commands = [ - "/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true", + "/describe --pr_description.add_original_user_description=true", "/review --pr_reviewer.num_code_suggestions=0", "/improve", ] diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 8526642f..fa662464 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -301,7 +301,7 @@ class PRDescription: # Remove the 'PR Title' key from the dictionary ai_title = self.data.pop('title', self.vars["title"]) - if get_settings().pr_description.keep_original_user_title: + if (not get_settings().pr_description.generate_ai_title): # Assign the original PR title to the 'title' variable title = self.vars["title"] else: