diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 30b76a0fb..3dab48f92 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,21 @@ +## [Version 0.11] - 2023-12-07 +- codiumai/pr-agent:0.11 +- codiumai/pr-agent:0.11-github_app +- codiumai/pr-agent:0.11-bitbucket-app +- codiumai/pr-agent:0.11-gitlab_webhook +- codiumai/pr-agent:0.11-github_polling +- codiumai/pr-agent:0.11-github_action + +### Added::Algo +- New section in `/describe` tool - [PR changes walkthrough](https://github.com/Codium-ai/pr-agent/pull/509) +- Improving PR Agent [prompts](https://github.com/Codium-ai/pr-agent/pull/501) +- Persistent tools (`/review`, `/describe`) now send an [update message](https://github.com/Codium-ai/pr-agent/pull/499) after finishing +- Add Amazon Bedrock [support](https://github.com/Codium-ai/pr-agent/pull/483) + +### Fixed +- Update [dependencies](https://github.com/Codium-ai/pr-agent/pull/503) in requirements.txt for Python 3.12 + + ## [Version 0.10] - 2023-11-15 - codiumai/pr-agent:0.10 - codiumai/pr-agent:0.10-github_app diff --git a/docs/DESCRIBE.md b/docs/DESCRIBE.md index 696014d54..777e13a91 100644 --- a/docs/DESCRIBE.md +++ b/docs/DESCRIBE.md @@ -1,6 +1,6 @@ # Describe Tool -The `describe` tool scans the PR code changes, and automatically generates PR description - title, type, summary, code walkthrough and labels. +The `describe` tool scans the PR code changes, and automatically generates PR description - title, type, summary, walkthrough and labels. It can be invoked manually by commenting on any PR: ``` /describe @@ -26,9 +26,14 @@ Under the section 'pr_description', the [configuration file](./../pr_agent/setti - `keep_original_user_title`: if set to true, the tool will keep the original PR title, and won't change it. Default is false. - `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...". + - To enable `custom labels`, apply the configuration changes described [here](./GENERATE_CUSTOM_LABELS.md#configuration-changes) + - `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. + +- `enable_semantic_files_types`: if set to true, "PR changes walkthrough" section will be generated. Default is true. ### Markers template diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 88baaac57..64acaab3a 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -269,7 +269,7 @@ def _prepare_pr_answer(self) -> Tuple[str, str]: for idx, (key, value) in enumerate(self.data.items()): if key == 'pr_files': value = self.file_label_dict - key_publish = "PR changes summary" + key_publish = "PR changes walkthrough" else: key_publish = key.rstrip(':').replace("_", " ").capitalize() pr_body += f"## {key_publish}\n" @@ -317,58 +317,66 @@ def process_pr_files_prediction(self, pr_body, value): return pr_body try: - pr_body += """\n| | Relevant Files """ - pr_body += "  " * 70 - pr_body += """|\n|-----------|-------------|\n""" + pr_body += "" + header = f"Relevant files" + delta = 65 + header += "  " * delta + pr_body += f"""""" + pr_body += """""" for semantic_label in value.keys(): s_label = semantic_label.strip("'").strip('"') - if self.git_provider.is_supported("gfm_markdown"): - # pr_body += f"
{semantic_label['label']}\n\n" - pr_body += f"| **{s_label}** |
files:
""" list_tuples = value[semantic_label] + pr_body += f"""""" + pr_body += """
{header}
{s_label.capitalize()}
{len(list_tuples)} files""" for filename, file_change_description in list_tuples: filename = filename.replace("'", "`") filename_publish = filename.split("/")[-1] - filename_publish = f"**{filename_publish}**" + filename_publish = f"{filename_publish}" + if len(filename_publish) < (delta - 5): + filename_publish += "  " * ((delta - 5) - len(filename_publish)) diff_plus_minus = "" diff_files = self.git_provider.diff_files for f in diff_files: if f.filename.lower() == filename.lower(): num_plus_lines = f.num_plus_lines num_minus_lines = f.num_minus_lines - diff_plus_minus += f" ( +{num_plus_lines}/-{num_minus_lines} )" + diff_plus_minus += f"+{num_plus_lines}/-{num_minus_lines}" break # try to add line numbers link to code suggestions + link = "" if hasattr(self.git_provider, 'get_line_link'): filename = filename.strip() link = self.git_provider.get_line_link(filename, relevant_line_start=-1) - if link: - diff_plus_minus = f"[{diff_plus_minus}]({link})" - diff_plus_minus = f" {diff_plus_minus}" - - if diff_plus_minus: - filename_publish += diff_plus_minus - if self.git_provider.is_supported("gfm_markdown"): - pr_body += f"
{filename_publish}" - file_change_description = self._insert_br_after_x_chars(file_change_description) - if diff_plus_minus: - pr_body += f"
    Changes summary:
    **{file_change_description}**
" - else: - pr_body += f"
    Changes summary:
    **{file_change_description}**
" - if self.git_provider.is_supported("gfm_markdown"): - pr_body += "|\n" + + file_change_description = self._insert_br_after_x_chars(file_change_description, x=(delta - 5)) + pr_body += f""" + + + + + +""" + pr_body += """
+
+ {filename_publish} +
    + {filename}

    + {file_change_description} +
+
+
{diff_plus_minus}
""" + except Exception as e: get_logger().error(f"Error processing pr files to markdown {self.pr_id}: {e}") pass return pr_body - def _insert_br_after_x_chars(self, text): + def _insert_br_after_x_chars(self, text, x=70): """ Insert
into a string after a word that increases its length above x characters. """ - x = 70 if len(text) < x: return text