diff --git a/README.md b/README.md index 03a076faf..2bf293b74 100644 --- a/README.md +++ b/README.md @@ -99,40 +99,40 @@ If set to true, the tool will add a section that checks if the PR contains sever Supported commands per platform: -| | | GitHub | Gitlab | Bitbucket | Azure DevOps | -|-------|-------------------------------------------------------------------------------------------------------------------|:--------------------:|:--------------------:|:--------------------:|:--------------------:| -| TOOLS | Review | ✅ | ✅ | ✅ | ✅ | -| | ⮑ Incremental | ✅ | | | | +| | | GitHub | Gitlab | Bitbucket | Azure DevOps | +|-------|---------------------------------------------------------------------------------------------------------|:--------------------:|:--------------------:|:--------------------:|:--------------------:| +| TOOLS | Review | ✅ | ✅ | ✅ | ✅ | +| | ⮑ Incremental | ✅ | | | | | | ⮑ [SOC2 Compliance](https://pr-agent-docs.codium.ai/tools/review/#soc2-ticket-compliance) 💎 | ✅ | ✅ | ✅ | ✅ | -| | Describe | ✅ | ✅ | ✅ | ✅ | +| | Describe | ✅ | ✅ | ✅ | ✅ | | | ⮑ [Inline File Summary](https://pr-agent-docs.codium.ai/tools/describe#inline-file-summary) 💎 | ✅ | | | | -| | Improve | ✅ | ✅ | ✅ | ✅ | -| | ⮑ Extended | ✅ | ✅ | ✅ | ✅ | -| | Ask | ✅ | ✅ | ✅ | ✅ | +| | Improve | ✅ | ✅ | ✅ | ✅ | +| | ⮑ Extended | ✅ | ✅ | ✅ | ✅ | +| | Ask | ✅ | ✅ | ✅ | ✅ | | | ⮑ [Ask on code lines](https://pr-agent-docs.codium.ai/tools/ask#ask-lines) | ✅ | ✅ | | | -| | [Custom Suggestions](https://pr-agent-docs.codium.ai/tools/custom_suggestions/) 💎 | ✅ | ✅ | ✅ | ✅ | +| | [Custom Prompt](https://pr-agent-docs.codium.ai/tools/custom_prompt/) 💎 | ✅ | ✅ | ✅ | ✅ | | | [Test](https://pr-agent-docs.codium.ai/tools/test/) 💎 | ✅ | ✅ | | ✅ | -| | Reflect and Review | ✅ | ✅ | ✅ | ✅ | -| | Update CHANGELOG.md | ✅ | ✅ | ✅ | ✅ | -| | Find Similar Issue | ✅ | | | | +| | Reflect and Review | ✅ | ✅ | ✅ | ✅ | +| | Update CHANGELOG.md | ✅ | ✅ | ✅ | ✅ | +| | Find Similar Issue | ✅ | | | | | | [Add PR Documentation](https://pr-agent-docs.codium.ai/tools/documentation/) 💎 | ✅ | ✅ | | ✅ | | | [Custom Labels](https://pr-agent-docs.codium.ai/tools/custom_labels/) 💎 | ✅ | ✅ | | ✅ | | | [Analyze](https://pr-agent-docs.codium.ai/tools/analyze/) 💎 | ✅ | ✅ | | ✅ | | | [CI Feedback](https://pr-agent-docs.codium.ai/tools/ci_feedback/) 💎 | ✅ | | | | | | [Similar Code](https://pr-agent-docs.codium.ai/tools/similar_code/) 💎 | ✅ | | | | -| | | | | | | -| USAGE | CLI | ✅ | ✅ | ✅ | ✅ | -| | App / webhook | ✅ | ✅ | ✅ | ✅ | -| | Tagging bot | ✅ | | | | -| | Actions | ✅ | | ✅ | | -| | | | | | | -| CORE | PR compression | ✅ | ✅ | ✅ | ✅ | -| | Repo language prioritization | ✅ | ✅ | ✅ | ✅ | -| | Adaptive and token-aware file patch fitting | ✅ | ✅ | ✅ | ✅ | -| | Multiple models support | ✅ | ✅ | ✅ | ✅ | +| | | | | | | +| USAGE | CLI | ✅ | ✅ | ✅ | ✅ | +| | App / webhook | ✅ | ✅ | ✅ | ✅ | +| | Tagging bot | ✅ | | | | +| | Actions | ✅ | | ✅ | | +| | | | | | | +| CORE | PR compression | ✅ | ✅ | ✅ | ✅ | +| | Repo language prioritization | ✅ | ✅ | ✅ | ✅ | +| | Adaptive and token-aware file patch fitting | ✅ | ✅ | ✅ | ✅ | +| | Multiple models support | ✅ | ✅ | ✅ | ✅ | | | [Static code analysis](https://pr-agent-docs.codium.ai/core-abilities/#static-code-analysis) 💎 | ✅ | ✅ | ✅ | ✅ | | | [Global and wiki configurations](https://pr-agent-docs.codium.ai/usage-guide/configuration_options/) 💎 | ✅ | ✅ | ✅ | ✅ | -| | [PR interactive actions](https://www.codium.ai/images/pr_agent/pr-actions.mp4) 💎 | ✅ | | | | +| | [PR interactive actions](https://www.codium.ai/images/pr_agent/pr-actions.mp4) 💎 | ✅ | | | | - 💎 means this feature is available only in [PR-Agent Pro](https://www.codium.ai/pricing/) [//]: # (- Support for additional git providers is described in [here](./docs/Full_environments.md)) @@ -156,7 +156,7 @@ ___ \ ‣ **Analyze 💎 ([`/analyze`](https://pr-agent-docs.codium.ai/tools/analyze/))**: Identify code components that changed in the PR, and enables to interactively generate tests, docs, and code suggestions for each component. \ -‣ **Custom Suggestions 💎 ([`/custom_suggestions`](https://pr-agent-docs.codium.ai/tools/custom_suggestions/))**: Automatically generates custom suggestions for improving the PR code, based on specific guidelines defined by the user. +‣ **Custom Prompt 💎 ([`/custom_prompt`](https://pr-agent-docs.codium.ai/tools/custom_prompt/))**: Automatically generates custom suggestions for improving the PR code, based on specific guidelines defined by the user. \ ‣ **Generate Tests 💎 ([`/test component_name`](https://pr-agent-docs.codium.ai/tools/test/))**: Generates unit tests for a selected component, based on the PR code changes. \ diff --git a/docs/docs/index.md b/docs/docs/index.md index 060211059..a131bd517 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -12,35 +12,35 @@ CodiumAI PR-Agent is an open-source tool to help efficiently review and handle p ## PR-Agent Features PR-Agent offers extensive pull request functionalities across various git providers. -| | | GitHub | Gitlab | Bitbucket | Azure DevOps | -|-------|---------------------------------------------------------------------------------------------------------------------|:------:|:------:|:---------:|:------------:| -| TOOLS | Review | ✅ | ✅ | ✅ | ✅ | -| | ⮑ Incremental | ✅ | | | | -| | ⮑ [SOC2 Compliance](https://pr-agent-docs.codium.ai/tools/review/#soc2-ticket-compliance){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | -| | Ask | ✅ | ✅ | ✅ | ✅ | -| | Describe | ✅ | ✅ | ✅ | ✅ | -| | ⮑ [Inline file summary](https://pr-agent-docs.codium.ai/tools/describe/#inline-file-summary){:target="_blank"} 💎 | ✅ | ✅ | | ✅ | -| | Improve | ✅ | ✅ | ✅ | ✅ | -| | ⮑ Extended | ✅ | ✅ | ✅ | ✅ | -| | [Custom Suggestions](./tools/custom_suggestions.md){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | -| | Reflect and Review | ✅ | ✅ | ✅ | ✅ | -| | Update CHANGELOG.md | ✅ | ✅ | ✅ | ️ | -| | Find Similar Issue | ✅ | | | ️ | -| | [Add PR Documentation](./tools/documentation.md){:target="_blank"} 💎 | ✅ | ✅ | | ✅ | +| | | GitHub | Gitlab | Bitbucket | Azure DevOps | +|-------|-----------------------------------------------------------------------------------------------------------------------|:------:|:------:|:---------:|:------------:| +| TOOLS | Review | ✅ | ✅ | ✅ | ✅ | +| | ⮑ Incremental | ✅ | | | | +| | ⮑ [SOC2 Compliance](https://pr-agent-docs.codium.ai/tools/review/#soc2-ticket-compliance){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | Ask | ✅ | ✅ | ✅ | ✅ | +| | Describe | ✅ | ✅ | ✅ | ✅ | +| | ⮑ [Inline file summary](https://pr-agent-docs.codium.ai/tools/describe/#inline-file-summary){:target="_blank"} 💎 | ✅ | ✅ | | ✅ | +| | Improve | ✅ | ✅ | ✅ | ✅ | +| | ⮑ Extended | ✅ | ✅ | ✅ | ✅ | +| | [Custom Prompt](./tools/custom_prompt.md){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | Reflect and Review | ✅ | ✅ | ✅ | ✅ | +| | Update CHANGELOG.md | ✅ | ✅ | ✅ | ️ | +| | Find Similar Issue | ✅ | | | ️ | +| | [Add PR Documentation](./tools/documentation.md){:target="_blank"} 💎 | ✅ | ✅ | | ✅ | | | [Generate Custom Labels](./tools/describe.md#handle-custom-labels-from-the-repos-labels-page-💎){:target="_blank"} 💎 | ✅ | ✅ | | ✅ | -| | [Analyze PR Components](./tools/analyze.md){:target="_blank"} 💎 | ✅ | ✅ | | ✅ | -| | | | | | ️ | -| USAGE | CLI | ✅ | ✅ | ✅ | ✅ | -| | App / webhook | ✅ | ✅ | ✅ | ✅ | -| | Actions | ✅ | | | ️ | -| | | | | | -| CORE | PR compression | ✅ | ✅ | ✅ | ✅ | -| | Repo language prioritization | ✅ | ✅ | ✅ | ✅ | -| | Adaptive and token-aware file patch fitting | ✅ | ✅ | ✅ | ✅ | -| | Multiple models support | ✅ | ✅ | ✅ | ✅ | -| | Incremental PR review | ✅ | | | | -| | [Static code analysis](./tools/analyze.md/){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | -| | [Multiple configuration options](./usage-guide/configuration_options.md){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | [Analyze PR Components](./tools/analyze.md){:target="_blank"} 💎 | ✅ | ✅ | | ✅ | +| | | | | | ️ | +| USAGE | CLI | ✅ | ✅ | ✅ | ✅ | +| | App / webhook | ✅ | ✅ | ✅ | ✅ | +| | Actions | ✅ | | | ️ | +| | | | | | +| CORE | PR compression | ✅ | ✅ | ✅ | ✅ | +| | Repo language prioritization | ✅ | ✅ | ✅ | ✅ | +| | Adaptive and token-aware file patch fitting | ✅ | ✅ | ✅ | ✅ | +| | Multiple models support | ✅ | ✅ | ✅ | ✅ | +| | Incremental PR review | ✅ | | | | +| | [Static code analysis](./tools/analyze.md/){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | +| | [Multiple configuration options](./usage-guide/configuration_options.md){:target="_blank"} 💎 | ✅ | ✅ | ✅ | ✅ | 💎 marks a feature available only in [PR-Agent Pro](https://www.codium.ai/pricing/){:target="_blank"} @@ -91,7 +91,7 @@ Check out the [PR Compression strategy](core-abilities/index.md) page for more d 3. **Improved support** - PR-Agent Pro users will receive priority support, and will be able to request new features and capabilities. 4. **Extra features** -In addition to the benefits listed above, PR-Agent Pro will emphasize more customization, and the usage of static code analysis, in addition to LLM logic, to improve results. It has the following additional tools and features: - (Tool): [**Analyze PR components**](./tools/analyze.md/) - - (Tool): [**Custom Code Suggestions**](./tools/custom_suggestions.md/) + - (Tool): [**Custom Prompt Suggestions**](./tools/custom_prompt.md/) - (Tool): [**Tests**](./tools/test.md/) - (Tool): [**PR documentation**](./tools/documentation.md/) - (Tool): [**Improve Component**](https://pr-agent-docs.codium.ai/tools/improve_component/) diff --git a/docs/docs/tools/custom_suggestions.md b/docs/docs/tools/custom_prompt.md similarity index 66% rename from docs/docs/tools/custom_suggestions.md rename to docs/docs/tools/custom_prompt.md index 902a4d252..675bed695 100644 --- a/docs/docs/tools/custom_suggestions.md +++ b/docs/docs/tools/custom_prompt.md @@ -1,14 +1,14 @@ ## Overview -The `custom_suggestions` tool scans the PR code changes, and automatically generates suggestions for improving the PR code. -It shares similarities with the `improve` tool, but with one main difference: the `custom_suggestions` tool will **only propose suggestions that follow specific guidelines defined by the prompt** in: `pr_custom_suggestions.prompt` configuration. +The `custom_prompt` tool scans the PR code changes, and automatically generates suggestions for improving the PR code. +It shares similarities with the `improve` tool, but with one main difference: the `custom_prompt` tool will **only propose suggestions that follow specific guidelines defined by the prompt** in: `pr_custom_prompt.prompt` configuration. The tool can be triggered [automatically](../usage-guide/automations_and_usage.md#github-app-automatic-tools-when-a-new-pr-is-opened) every time a new PR is opened, or can be invoked manually by commenting on a PR. When commenting, use the following template: ``` -/custom_suggestions --pr_custom_suggestions.prompt=" -The suggestions should focus only on the following: +/custom_prompt --pr_custom_prompt.prompt=" +The code suggestions should focus only on the following: - ... - ... @@ -18,7 +18,7 @@ The suggestions should focus only on the following: With a [configuration file](../usage-guide/automations_and_usage.md#github-app), use the following template: ``` -[pr_custom_suggestions] +[pr_custom_prompt] prompt="""\ The suggestions should focus only on the following: -... @@ -34,9 +34,9 @@ You might benefit from several trial-and-error iterations, until you get the cor Here is an example of a possible prompt, defined in the configuration file: ``` -[pr_custom_suggestions] +[pr_custom_prompt] prompt="""\ -The suggestions should focus only on the following: +The code suggestions should focus only on the following: - look for edge cases when implementing a new function - make sure every variable has a meaningful name - make sure the code is efficient @@ -47,15 +47,12 @@ The suggestions should focus only on the following: Results obtained with the prompt above: -[//]: # (![Custom suggestions prompt](https://codium.ai/images/pr_agent/custom_suggestions_prompt.png){width=512}) - -[//]: # (→) -![Custom suggestions results](https://codium.ai/images/pr_agent/custom_suggestions_result.png){width=768} +![Custom prompt results](https://codium.ai/images/pr_agent/custom_suggestions_result.png){width=768} ## Configuration options `prompt`: the prompt for the tool. It should be a multi-line string. -`num_code_suggestions`: number of code suggestions provided by the 'custom_suggestions' tool. Default is 4. +`num_code_suggestions`: number of code suggestions provided by the 'custom_prompt' tool. Default is 4. `enable_help_text`: if set to true, the tool will display a help text in the comment. Default is true. \ No newline at end of file diff --git a/docs/docs/tools/improve.md b/docs/docs/tools/improve.md index 7906f426b..bf27b17e8 100644 --- a/docs/docs/tools/improve.md +++ b/docs/docs/tools/improve.md @@ -164,4 +164,4 @@ Hence, the total number of suggestions is proportional to the number of chunks, In addition, we recommend to use the `exra_instructions` field to guide the model to suggestions that are more relevant to the specific needs of the project.
-Consider also trying the [Custom Suggestions Tool](./custom_suggestions.md) 💎, that will **only** propose suggestions that follow specific guidelines defined by user. +Consider also trying the [Custom Prompt Tool](./custom_prompt.md) 💎, that will **only** propose code suggestions that follow specific guidelines defined by user. diff --git a/docs/docs/tools/index.md b/docs/docs/tools/index.md index 49c31a8fe..10aaf88ab 100644 --- a/docs/docs/tools/index.md +++ b/docs/docs/tools/index.md @@ -10,11 +10,11 @@ Here is a list of PR-Agent tools, each with a dedicated page that explains how t | **[Question Answering (`/ask ...`](./ask.md))** | Answering free-text questions about the PR, or on specific code lines | | **[Update Changelog (`/update_changelog`](./update_changelog.md))** | Automatically updating the CHANGELOG.md file with the PR changes | | **[Find Similar Issue (`/similar_issue`](./similar_issues.md))** | Automatically retrieves and presents similar issues | -| **[Help (`/help`](./help.md))** | Provides a list of all the available tools. Also enables to trigger them interactively (💎) | +| **[Help (`/help`](./help.md))** | Provides a list of all the available tools. Also enables to trigger them interactively (💎) | | **💎 [Add Documentation (`/add_docs`](./documentation.md))** | Generates documentation to methods/functions/classes that changed in the PR | | **💎 [Generate Custom Labels (`/generate_labels`](./custom_labels.md))** | Generates custom labels for the PR, based on specific guidelines defined by the user | | **💎 [Analyze (`/analyze`](./analyze.md))** | Identify code components that changed in the PR, and enables to interactively generate tests, docs, and code suggestions for each component | -| **💎 [Custom Suggestions (`/custom_suggestions`](./custom_suggestions.md))** | Automatically generates custom suggestions for improving the PR code, based on specific guidelines defined by the user | +| **💎 [Custom Prompt (`/custom_prompt`](./custom_prompt.md))** | Automatically generates custom suggestions for improving the PR code, based on specific guidelines defined by the user | | **💎 [Generate Tests (`/test component_name`](./test.md))** | Automatically generates unit tests for a selected component, based on the PR code changes | | **💎 [Improve Component (`/improve_component component_name`](./improve_component.md))** | Generates code suggestions for a specific code component that changed in the PR | | **💎 [CI Feedback (`/checks ci_job`](./ci_feedback.md))** | Automatically generates feedback and analysis for a failed CI job | diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 272d53949..bd6ecaa0e 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -33,7 +33,7 @@ nav: - 💎 Improve Component: 'tools/improve_component.md' - 💎 Documentation: 'tools/documentation.md' - 💎 Custom Labels: 'tools/custom_labels.md' - - 💎 Custom Suggestions: 'tools/custom_suggestions.md' + - 💎 Custom Prompt: 'tools/custom_prompt.md' - 💎 CI Feedback: 'tools/ci_feedback.md' - 💎 Similar Code: 'tools/similar_code.md' - Core Abilities: 'core-abilities/index.md' diff --git a/pr_agent/settings/pr_code_suggestions_prompts.toml b/pr_agent/settings/pr_code_suggestions_prompts.toml index f3a1089bb..bf8b4dc79 100644 --- a/pr_agent/settings/pr_code_suggestions_prompts.toml +++ b/pr_agent/settings/pr_code_suggestions_prompts.toml @@ -59,8 +59,8 @@ class CodeSuggestion(BaseModel): relevant_file: str = Field(description="the relevant file full path") language: str = Field(description="the code language of the relevant file") suggestion_content: str = Field(description="an actionable suggestion for meaningfully improving the new code introduced in the PR") - existing_code: str = Field(description="a short code snippet from a '__new hunk__' section to illustrate the relevant existing code. Don't show the line numbers.") - improved_code: str = Field(description="a short code snippet to illustrate the improved code, after applying the suggestion.") + existing_code: str = Field(description="a short code snippet, demonstrating the relevant code lines from a '__new hunk__' section. It must without line numbers. Use abbreviations if needed") + improved_code: str = Field(description="a new code snippet, that can be used to replace the relevant 'existing_code' lines in '__new hunk__' code after applying the suggestion") one_sentence_summary:str = Field(description="a short summary of the suggestion action, in a single sentence. Focus on the 'what'. Be general, and avoid method or variable names.") relevant_lines_start: int = Field(description="The relevant line number, from a '__new hunk__' section, where the suggestion starts (inclusive). Should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above") relevant_lines_end: int = Field(description="The relevant line number, from a '__new hunk__' section, where the suggestion ends (inclusive). Should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above") diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index e6b8c2172..a3f0abd15 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -196,7 +196,7 @@ async def _get_prediction(self, model: str, patches_diff: str) -> dict: suggestion["score"] = 7 suggestion["score_why"] = "" else: - get_logger().error(f"Could not self-reflect on suggestions. using default score 7") + # get_logger().error(f"Could not self-reflect on suggestions. using default score 7") for i, suggestion in enumerate(data["code_suggestions"]): suggestion["score"] = 7 suggestion["score_why"] = "" diff --git a/pr_agent/tools/pr_help_message.py b/pr_agent/tools/pr_help_message.py index 9f76434da..f0563bf6d 100644 --- a/pr_agent/tools/pr_help_message.py +++ b/pr_agent/tools/pr_help_message.py @@ -35,7 +35,7 @@ async def run(self): tool_names.append(f"[ASK]({base_path}/ask/)") tool_names.append(f"[GENERATE CUSTOM LABELS]({base_path}/custom_labels/) 💎") tool_names.append(f"[CI FEEDBACK]({base_path}/ci_feedback/) 💎") - tool_names.append(f"[CUSTOM SUGGESTIONS]({base_path}/custom_suggestions/) 💎") + tool_names.append(f"[CUSTOM PROMPT]({base_path}/custom_prompt/) 💎") tool_names.append(f"[SIMILAR ISSUE]({base_path}/similar_issues/)") descriptions = [] @@ -50,7 +50,7 @@ async def run(self): descriptions.append("Answering free-text questions about the PR") descriptions.append("Generates custom labels for the PR, based on specific guidelines defined by the user") descriptions.append("Generates feedback and analysis for a failed CI job") - descriptions.append("Generates custom suggestions for improving the PR code, based only on specific guidelines defined by the user") + descriptions.append("Generates custom suggestions for improving the PR code, derived only from a specific guidelines prompt defined by the user") descriptions.append("Automatically retrieves and presents similar issues") commands =[] @@ -65,7 +65,7 @@ async def run(self): commands.append("`/ask`") commands.append("`/generate_labels`") commands.append("`/checks`") - commands.append("`/custom_suggestions`") + commands.append("`/custom_prompt`") commands.append("`/similar_issue`") checkbox_list = [] @@ -86,7 +86,7 @@ async def run(self): checkbox_list.append("[*]") checkbox_list.append("[*]") - if isinstance(self.git_provider, GithubProvider): + if isinstance(self.git_provider, GithubProvider) and not get_settings().config.get('disable_checkboxes', False): pr_comment += f"" for i in range(len(tool_names)): pr_comment += f"\n\n\n"
ToolDescriptionTrigger Interactively :gem:
\n\n{tool_names[i]}{descriptions[i]}\n\n{checkbox_list[i]}\n