Compare commits

...

8 Commits

Author SHA1 Message Date
ad121f8a50 Merge commit 'b8bcaf86f239661a24fc61ade5b953edfa64a3e3' into hl/flip_2_configs 2024-04-17 09:29:04 +03:00
2c397c28e5 backward compatibility 2024-04-17 09:19:26 +03:00
6c5d434dcd remove duplicate config 2024-04-17 09:17:17 +03:00
eb37038785 review final message 2024-04-17 08:50:55 +03:00
f6b5470a96 Merge commit 'a134a8bf6d44de526d6fcbba13c1f9813a5dea09' into hl/flip_2_configs
# Conflicts:
#	pr_agent/settings/configuration.toml
2024-04-16 22:18:29 +03:00
f123a6e069 clean 2024-04-16 22:08:19 +03:00
24240b168b invert 3 configurations, so the default is false 2024-04-16 22:05:12 +03:00
416c4cbf52 change and to or 2024-03-27 17:03:09 +02:00
6 changed files with 26 additions and 16 deletions

View File

@ -49,7 +49,7 @@ publish_labels = ...
!!! example "Possible configurations" !!! example "Possible configurations"
- `publish_labels`: if set to true, the tool will publish the labels to the PR. Default is true. - `disable_publish_labels`: if set to true, the tool will not publish the labels to the PR. Default is false.
- `publish_description_as_comment`: if set to true, the tool will publish the description as a comment to the PR. If false, it will overwrite the original description. Default is false. - `publish_description_as_comment`: if set to true, the tool will publish the description as a comment to the PR. If false, it will overwrite the original description. Default is false.
@ -57,7 +57,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. - `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 automatically generate a title for the PR. If false, it will keep the original title. Default is false.
- `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...". - `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...".
@ -65,7 +65,7 @@ publish_labels = ...
- `enable_pr_type`: if set to false, it will not show the `PR type` as a text value in the description content. Default is true. - `enable_pr_type`: if set to false, it will not show the `PR type` as a text value in the description content. Default is true.
- `final_update_message`: if set to true, it will add a comment message [`PR Description updated to latest commit...`](https://github.com/Codium-ai/pr-agent/pull/499#issuecomment-1837412176) after finishing calling `/describe`. Default is true. - `disable_final_update_message`: if set to true, the tool will skip adding a comment message [`PR Description updated to latest commit...`](https://github.com/Codium-ai/pr-agent/pull/499#issuecomment-1837412176) after finishing calling `/describe`. Default is false.
- `enable_semantic_files_types`: if set to true, "Changes walkthrough" section will be generated. Default is true. - `enable_semantic_files_types`: if set to true, "Changes walkthrough" section will be generated. Default is true.
- `collapsible_file_list`: if set to true, the file list in the "Changes walkthrough" section will be collapsible. If set to "adaptive", the file list will be collapsible only if there are more than 8 files. Default is "adaptive". - `collapsible_file_list`: if set to true, the file list in the "Changes walkthrough" section will be collapsible. If set to "adaptive", the file list will be collapsible only if there are more than 8 files. Default is "adaptive".

View File

@ -62,7 +62,7 @@ The configuration parameter `pr_commands` defines the list of tools that will be
``` ```
[github_app] [github_app]
pr_commands = [ 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.keep_original_user_title=true --pr_description.disable_final_update_message=true",
"/review --pr_reviewer.num_code_suggestions=0", "/review --pr_reviewer.num_code_suggestions=0",
"/improve", "/improve",
] ]
@ -103,7 +103,7 @@ The configuration parameter `push_commands` defines the list of tools that will
handle_push_trigger = true handle_push_trigger = true
push_commands = [ 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 --pr_description.keep_original_user_title=true",
"/review --pr_reviewer.num_code_suggestions=0 --pr_reviewer.final_update_message=false", "/review --pr_reviewer.num_code_suggestions=0 --pr_reviewer.disable_final_update_message=true",
] ]
``` ```
This means that when new code is pushed to the PR, the PR-Agent will run the `describe` and `review` tools, with the specified parameters. This means that when new code is pushed to the PR, the PR-Agent will run the `describe` and `review` tools, with the specified parameters.

View File

@ -229,7 +229,7 @@ class GithubProvider(GitProvider):
self.publish_comment(pr_comment) self.publish_comment(pr_comment)
def publish_comment(self, pr_comment: str, is_temporary: bool = False): def publish_comment(self, pr_comment: str, is_temporary: bool = False):
if is_temporary and not get_settings().config.publish_output_progress: if is_temporary or not get_settings().config.publish_output_progress:
get_logger().debug(f"Skipping publish_comment for temporary comment: {pr_comment}") get_logger().debug(f"Skipping publish_comment for temporary comment: {pr_comment}")
return return

View File

@ -36,7 +36,7 @@ ask_and_reflect=false
#automatic_review=true #automatic_review=true
persistent_comment=true persistent_comment=true
extra_instructions = "" extra_instructions = ""
final_update_message = true disable_final_update_message = false
# review labels # review labels
enable_review_labels_security=true enable_review_labels_security=true
enable_review_labels_effort=true enable_review_labels_effort=true
@ -51,13 +51,13 @@ maximal_review_effort=5
[pr_description] # /describe # [pr_description] # /describe #
publish_labels=true disable_publish_labels=false
add_original_user_description=true add_original_user_description=true
keep_original_user_title=true generate_ai_title=false
use_bullet_points=true use_bullet_points=true
extra_instructions = "" extra_instructions = ""
enable_pr_type=true enable_pr_type=true
final_update_message = true disable_final_update_message = false
enable_help_text=false enable_help_text=false
enable_help_comment=true enable_help_comment=true
# describe as comment # describe as comment

View File

@ -95,7 +95,10 @@ class PRDescription:
self.file_label_dict = self._prepare_file_labels() self.file_label_dict = self._prepare_file_labels()
pr_labels, pr_file_changes = [], [] pr_labels, pr_file_changes = [], []
if get_settings().pr_description.publish_labels: # backward compatibility support
publish_label = get_settings().pr_reviewer.get("publish_labels", True) \
and not get_settings().pr_description.disable_publish_labels
if publish_label:
pr_labels = self._prepare_labels() pr_labels = self._prepare_labels()
if get_settings().pr_description.use_description_markers: if get_settings().pr_description.use_description_markers:
@ -118,7 +121,7 @@ class PRDescription:
if get_settings().config.publish_output: if get_settings().config.publish_output:
# publish labels # publish labels
if get_settings().pr_description.publish_labels and self.git_provider.is_supported("get_labels"): if publish_label and self.git_provider.is_supported("get_labels"):
original_labels = self.git_provider.get_pr_labels(update=True) original_labels = self.git_provider.get_pr_labels(update=True)
get_logger().debug(f"original labels", artifact=original_labels) get_logger().debug(f"original labels", artifact=original_labels)
user_labels = get_user_labels(original_labels) user_labels = get_user_labels(original_labels)
@ -143,8 +146,10 @@ class PRDescription:
else: else:
self.git_provider.publish_description(pr_title, pr_body) self.git_provider.publish_description(pr_title, pr_body)
# publish final update message # publish final update message - with backward compatibility support
if (get_settings().pr_description.final_update_message): publish_update_message = get_settings().pr_reviewer.get("final_update_message", True)\
and not get_settings().pr_description.disable_final_update_message
if (publish_update_message):
latest_commit_url = self.git_provider.get_latest_commit_url() latest_commit_url = self.git_provider.get_latest_commit_url()
if latest_commit_url: if latest_commit_url:
pr_url = self.git_provider.get_pr_url() pr_url = self.git_provider.get_pr_url()
@ -301,7 +306,10 @@ class PRDescription:
# Remove the 'PR Title' key from the dictionary # Remove the 'PR Title' key from the dictionary
ai_title = self.data.pop('title', self.vars["title"]) ai_title = self.data.pop('title', self.vars["title"])
if get_settings().pr_description.keep_original_user_title: # get config - with backward compatibility
keep_user_title = get_settings().pr_reviewer.get("keep_original_user_title", True) \
and not get_settings().pr_description.generate_ai_title
if keep_user_title:
# Assign the original PR title to the 'title' variable # Assign the original PR title to the 'title' variable
title = self.vars["title"] title = self.vars["title"]
else: else:

View File

@ -135,7 +135,9 @@ class PRReviewer:
if get_settings().config.publish_output: if get_settings().config.publish_output:
# publish the review # publish the review
if get_settings().pr_reviewer.persistent_comment and not self.incremental.is_incremental: if get_settings().pr_reviewer.persistent_comment and not self.incremental.is_incremental:
final_update_message = get_settings().pr_reviewer.final_update_message # get config with backward compatibility
final_update_message = get_settings().pr_reviewer.get("final_update_message", True)\
and not get_settings().pr_reviewer.disable_final_update_message
self.git_provider.publish_persistent_comment(pr_review, self.git_provider.publish_persistent_comment(pr_review,
initial_header="## PR Review", initial_header="## PR Review",
update_header=True, update_header=True,