diff --git a/README.md b/README.md index af0b5af2..80c622e1 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ 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`)**: Automatically retrieves and presents [similar issues](https://github.com/Alibaba-MIIL/ASL/issues/107). - +\ +‣ **Add Documentation (`/add_docs`)**: Automatically adds [documentation](https://github.com/Codium-ai/pr-agent/pull/337#discussion_r1342111682) to un-documented functions/classes in the PR. 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. @@ -109,6 +110,7 @@ See the [usage guide](./Usage.md) for instructions how to run the different tool | | Reflect and Review | :white_check_mark: | :white_check_mark: | :white_check_mark: | | :white_check_mark: | :white_check_mark: | | | Update CHANGELOG.md | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | | | | Find similar issue | :white_check_mark: | | | | | | +| | Add Documentation | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | :white_check_mark: | | | | | | | | | | USAGE | CLI | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | App / webhook | :white_check_mark: | :white_check_mark: | | | | diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 0e9b6a3a..c807698b 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -47,7 +47,7 @@ rank_extended_suggestions = true max_number_of_calls = 5 final_clip_factor = 0.9 -[pr_add_docs_prompt] # /add_docs # +[pr_add_docs] # /add_docs # extra_instructions = "" docs_style = "Google Style" # "Google Style", "Numpy Style", "Sphinx Style", "PEP257", "reStructuredText" max_number_of_calls = 5 diff --git a/pr_agent/settings/pr_add_docs.toml b/pr_agent/settings/pr_add_docs.toml index 1cbe1fad..4988b7fa 100644 --- a/pr_agent/settings/pr_add_docs.toml +++ b/pr_agent/settings/pr_add_docs.toml @@ -93,9 +93,9 @@ Don't repeat the prompt in the answer, and avoid outputting the 'type' and 'desc user="""PR Info: -Title: '{{title}}' +Title: '{{ title }}' -Branch: '{{branch}}' +Branch: '{{ branch }}' Description: '{{description}}' diff --git a/pr_agent/tools/pr_add_docs.py b/pr_agent/tools/pr_add_docs.py index d40aaf79..fa78a92f 100644 --- a/pr_agent/tools/pr_add_docs.py +++ b/pr_agent/tools/pr_add_docs.py @@ -37,10 +37,10 @@ class PRAddDocs: "description": self.git_provider.get_pr_description(), "language": self.main_language, "diff": "", # empty diff for initial calculation - "extra_instructions": get_settings().pr_add_docs_prompt.extra_instructions, + "extra_instructions": get_settings().pr_add_docs.extra_instructions, "commit_messages_str": self.git_provider.get_commit_messages(), 'docs_for_language': get_docs_for_language(self.main_language, - get_settings().pr_add_docs_prompt.docs_style), + get_settings().pr_add_docs.docs_style), } self.token_handler = TokenHandler(self.git_provider.pr, self.vars, @@ -132,8 +132,8 @@ class PRAddDocs: is_successful = self.git_provider.publish_code_suggestions(docs) if not is_successful: logging.info("Failed to publish code docs, trying to publish each docs separately") - for documentation in docs: - self.git_provider.publish_code_suggestions([documentation]) + for doc_suggestion in docs: + self.git_provider.publish_code_suggestions([doc_suggestion]) def dedent_code(self, relevant_file, relevant_lines_start, new_code_snippet, doc_placement='after', add_original_line=False): @@ -170,7 +170,7 @@ class PRAddDocs: async def _prepare_prediction_extended(self, model: str) -> dict: logging.info('Getting PR diff...') patches_diff_list = get_pr_multi_diffs(self.git_provider, self.token_handler, model, - max_calls=get_settings().pr_add_docs_prompt.max_number_of_calls) + max_calls=get_settings().pr_add_docs.max_number_of_calls) logging.info('Getting multi AI predictions...') prediction_list = []