diff --git a/.github/workflows/docs-ci.yaml b/.github/workflows/docs-ci.yaml
index 1648fd44..b260039e 100644
--- a/.github/workflows/docs-ci.yaml
+++ b/.github/workflows/docs-ci.yaml
@@ -29,4 +29,5 @@ jobs:
mkdocs-material-
- run: pip install mkdocs-material
- run: pip install "mkdocs-material[imaging]"
+ - run: pip install mkdocs-glightbox
- run: mkdocs gh-deploy -f docs/mkdocs.yml --force
diff --git a/README.md b/README.md
index 0f107870..1ac8b7da 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
-Making pull requests less painful with an AI agent
+CodiumAI PR-Agent aims to help efficiently review and handle pull requests, by providing AI feedbacks and suggestions
[](https://github.com/Codium-ai/pr-agent/blob/main/LICENSE)
@@ -21,12 +21,19 @@ Making pull requests less painful with an AI agent
+### [Documentation](https://pr-agent-docs.codium.ai/)
+- See the [Installation Guide](https://pr-agent-docs.codium.ai/installation/) for instructions on installing PR-Agent on different platforms.
+
+- See the [Usage Guide](https://pr-agent-docs.codium.ai/usage-guide/) for instructions on running PR-Agent tools via different interfaces, such as CLI, PR Comments, or by automatically triggering them when a new PR is opened.
+
+- See the [Tools Guide](https://pr-agent-docs.codium.ai/tools/) for a detailed description of the different tools, and the available configurations for each tool.
+
+
## Table of Contents
- [News and Updates](#news-and-updates)
- [Overview](#overview)
- [Example results](#example-results)
- [Try it now](#try-it-now)
-- [Installation](#installation)
- [PR-Agent Pro ๐](#pr-agent-pro-)
- [How it works](#how-it-works)
- [Why use PR-Agent?](#why-use-pr-agent)
@@ -63,14 +70,6 @@ If set to true, the tool will add a section that checks if the PR contains sever
## Overview
+{width=768}
## YAML Prompting
TBD
diff --git a/docs/docs/css/custom.css b/docs/docs/css/custom.css
index 2f963ccd..8b0879a0 100644
--- a/docs/docs/css/custom.css
+++ b/docs/docs/css/custom.css
@@ -16,3 +16,12 @@
font-size: 20px;
margin-left: 0px !important;
}
+
+.md-content img {
+ border-width: 1px;
+ border-style: solid;
+ border-color: black;
+ outline-width: 1px;
+ outline-style: solid;
+ outline-color: darkgray;
+ }
diff --git a/docs/docs/index.md b/docs/docs/index.md
index ed02e502..80b62e11 100644
--- a/docs/docs/index.md
+++ b/docs/docs/index.md
@@ -19,20 +19,19 @@ PR-Agent offers extensive pull request functionalities across various git provid
| | โฎ [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"} ๐ | โ
| โ
| โ
| โ
|
+| | โฎ [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"} ๐ | โ
| โ
| โ
| โ
|
+| | [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"} ๐ | โ
| โ
| โ
| โ
|
+| | [Analyze PR Components](./tools/analyze.md){:target="_blank"} ๐ | โ
| โ
| | โ
|
| | | | | | ๏ธ |
| USAGE | CLI | โ
| โ
| โ
| โ
|
-| | App / webhook | โ
| โ
| | โ
|
-| | Tagging bot | โ
| | | โ
|
+| | App / webhook | โ
| โ
| โ
| โ
|
| | Actions | โ
| | | ๏ธ |
| | | | | |
| CORE | PR compression | โ
| โ
| โ
| โ
|
@@ -46,86 +45,34 @@ PR-Agent offers extensive pull request functionalities across various git provid
๐ marks a feature available only in [PR-Agent Pro](https://www.codium.ai/pricing/){:target="_blank"}
-## Example results
-
-
-
-
-
-
-
-
-
-
-
-
-
)
-
-[//]: # (
)
-
-[//]: # (
)
-
-[//]: # (
)
-
-[//]: # (
)
-
-[//]: # (
)
-
-[//]: # (
-
+{width=468}
Each user who wants to use PR-Agent pro needs to buy a seat.
Initially, CodiumAI offers a two-week trial period at no cost, after which continued access requires each user to secure a personal seat.
@@ -27,7 +25,9 @@ Since GitLab platform does not support apps, installing PR-Agent Pro for GitLab
Acquire a personal, project or group level access token. Enable the โapiโ scope in order to allow PR-Agent to read pull requests, comment and respond to requests.
-
+
+
+
-
-
-
-
-
+An example result:
+{width=750}
**Notes**
-- Language that are currently supported: Python, Java, C++, JavaScript, TypeScript.
\ No newline at end of file
+- Language that are currently supported: Python, Java, C++, JavaScript, TypeScript, C#.
\ No newline at end of file
diff --git a/docs/docs/tools/ask.md b/docs/docs/tools/ask.md
index e6e02160..453807fd 100644
--- a/docs/docs/tools/ask.md
+++ b/docs/docs/tools/ask.md
@@ -7,9 +7,9 @@ It can be invoked manually by commenting on any PR:
```
For example:
-
+{width=768}
-
+{width=768}
## Ask lines
@@ -18,6 +18,6 @@ You can run `/ask` on specific lines of code in the PR from the PR's diff view.
- To select multiple lines, click on the '+' sign of the first line and then hold and drag to select the rest of the lines.
- write `/ask "..."` in the comment box and press `Add single comment` button.
-
+{width=768}
Note that the tool does not have "memory" of previous questions, and answers each question independently.
diff --git a/docs/docs/tools/ci_feedback.md b/docs/docs/tools/ci_feedback.md
index 2949f138..998fef56 100644
--- a/docs/docs/tools/ci_feedback.md
+++ b/docs/docs/tools/ci_feedback.md
@@ -8,13 +8,10 @@ The tool analyzes the failed checks and provides several feedbacks:
- Failure summary
- Relevant error logs
-
-
-
+{width=768}
+
→
-
-
-
+{width=768}
___
diff --git a/docs/docs/tools/custom_labels.md b/docs/docs/tools/custom_labels.md
index d8dbb1a1..29f1a9e2 100644
--- a/docs/docs/tools/custom_labels.md
+++ b/docs/docs/tools/custom_labels.md
@@ -9,11 +9,11 @@ For example:
If we wish to add detect changes to SQL queries in a given PR, we can add the following custom label along with its description:
-
+{width=768}
When running the `generate_labels` tool on a PR that includes changes in SQL queries, it will automatically suggest the custom label:
-
+{width=768}
Note that in addition to the dedicated tool `generate_labels`, the custom labels will also be used by the `describe` tool.
@@ -36,7 +36,8 @@ b. Add/edit the custom labels. It should be formatted as follows:
* Label name: The name of the custom label.
* Description: Start the description of with prefix `pr_agent:`, for example: `pr_agent: Description of when AI should suggest this label`.
+
+{width=880}
c. Now the custom labels will be included in the `generate_labels` tool.
diff --git a/docs/docs/tools/custom_suggestions.md b/docs/docs/tools/custom_suggestions.md
index 0b19ecef..85720c11 100644
--- a/docs/docs/tools/custom_suggestions.md
+++ b/docs/docs/tools/custom_suggestions.md
@@ -43,10 +43,9 @@ The instructions above are just an example. We want to emphasize that the prompt
Results obtained with the prompt above:
-
-
-
-
+{width=512}
+→
+{width=768}
## Configuration options
diff --git a/docs/docs/tools/describe.md b/docs/docs/tools/describe.md
index cf7ccdfb..50d2af0a 100644
--- a/docs/docs/tools/describe.md
+++ b/docs/docs/tools/describe.md
@@ -5,19 +5,12 @@ The tool can be triggered automatically every time a new PR is [opened](../usage
```
/describe
```
+
For example:
-
-
-
-
-
+{width=512}
-
-
-
-
-
+{width=512}
@@ -35,6 +28,8 @@ To edit [configurations](https://github.com/Codium-ai/pr-agent/blob/main/pr_agen
- `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_persistent`: if set to true and `publish_description_as_comment` is true, the tool will publish the description as a persistent comment to the PR. 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.
@@ -57,55 +52,23 @@ This feature enables you to copy the `changes walkthrough` table to the "Files c
To copy the `changes walkthrough` table to the "Files changed" tab, you can click on the checkbox that appears PR Description status message below the main PR Description:
-
-
-
-
-
+{width=512}
If you prefer to have the file summaries appear in the "Files changed" tab on every PR, change the `pr_description.inline_file_summary` parameter in the configuration file, possible values are:
- `'table'`: File changes walkthrough table will be displayed on the top of the "Files changed" tab, in addition to the "Conversation" tab.
-
-
-
-
-
+{width=512}
- `true`: A collapsable file comment with changes title and a changes summary for each file in the PR.
-
-
-
-
-
+{width=512}
- `false` (`default`): File changes walkthrough will be added only to the "Conversation" tab.
**Note**: that this feature is currently available only for GitHub.
-### Handle custom labels from the Repo's labels page ๐
-
-You can control the custom labels that will be suggested by the `describe` tool, from the repo's labels page:
-
-* GitHub : go to `https://github.com/{owner}/{repo}/labels` (or click on the "Labels" tab in the issues or PRs page)
-* GitLab : go to `https://gitlab.com/{owner}/{repo}/-/labels` (or click on "Manage" -> "Labels" on the left menu)
-
-Now add/edit the custom labels. they should be formatted as follows:
-
-* Label name: The name of the custom label.
-* Description: Start the description of with prefix `pr_agent:`, for example: `pr_agent: Description of when AI should suggest this label`.
-
-
-
-
### Markers template
To enable markers, set `pr_description.use_description_markers=true`.
@@ -126,25 +89,55 @@ pr_agent:walkthrough
```
The marker `pr_agent:type` will be replaced with the PR type, `pr_agent:summary` will be replaced with the PR summary, and `pr_agent:walkthrough` will be replaced with the PR walkthrough.
-
-
-
-
-
+{width=512}
→
-
-
-
-
-
+{width=512}
+
**Configuration params**:
- `use_description_markers`: if set to true, the tool will use markers template. It replaces every marker of the form `pr_agent:marker_name` with the relevant content. Default is false.
- `include_generated_by_header`: if set to true, the tool will add a dedicated header: 'Generated by PR Agent at ...' to any automatic content. Default is true.
+## Custom labels
+
+The default labels of the describe tool are quite generic, since they are meant to be used in any repo: [`Bug fix`, `Tests`, `Enhancement`, `Documentation`, `Other`].
+
+You can define custom labels that are relevant for your repo and use cases.
+Custom labels can be defined in a [configuration file](https://pr-agent-docs.codium.ai/tools/custom_labels/#configuration-options), or directly in the repo's [labels page](#handle-custom-labels-from-the-repos-labels-page).
+
+Examples for custom labels:
+
+ - `Main topic:performance` - pr_agent:The main topic of this PR is performance
+ - `New endpoint` - pr_agent:A new endpoint was added in this PR
+ - `SQL query` - pr_agent:A new SQL query was added in this PR
+ - `Dockerfile changes` - pr_agent:The PR contains changes in the Dockerfile
+ - ...
+
+The list above is eclectic, and aims to give an idea of different possibilities. Define custom labels that are relevant for your repo and use cases.
+Note that Labels are not mutually exclusive, so you can add multiple label categories.
+
+{width=768}
-
+{width=768}
-
+{width=768}
## Configuration options
- `docs_style`: The exact style of the documentation (for python docstring). you can choose between: `google`, `numpy`, `sphinx`, `restructuredtext`, `plain`. Default is `sphinx`.
@@ -19,6 +19,6 @@ For example:
**Notes**
-- Language that are currently fully supported: Python, Java, C++, JavaScript, TypeScript.
+- Language that are currently fully supported: Python, Java, C++, JavaScript, TypeScript, C#.
- For languages that are not fully supported, the tool will suggest documentation only for new components in the PR.
- A previous version of the tool, that offered support only for new components, was deprecated.
\ No newline at end of file
diff --git a/docs/docs/tools/help.md b/docs/docs/tools/help.md
new file mode 100644
index 00000000..5cfc1e81
--- /dev/null
+++ b/docs/docs/tools/help.md
@@ -0,0 +1,17 @@
+## Overview
+The `help` tool provides a list of all the available tools and their descriptions.
+For PR-Agent Pro users, it also enables to trigger each tool by checking the relevant box.
+
+It can be invoked manually by commenting on any PR:
+```
+/help
+```
+
+## Example usage
+An example [result](https://github.com/Codium-ai/pr-agent/pull/546#issuecomment-1868524805):
+
+{width=750}
+
+→
+
+{width=750}
diff --git a/docs/docs/tools/improve.md b/docs/docs/tools/improve.md
index f5808139..b62fd649 100644
--- a/docs/docs/tools/improve.md
+++ b/docs/docs/tools/improve.md
@@ -9,20 +9,12 @@ The tool can be triggered automatically every time a new PR is [opened](../usage
The code suggestions can be presented as a single comment (via `pr_code_suggestions.summarize=true`):
-
-
-
-
-
-
+{width=512}
Or as a separate commitable code comment for each suggestion:
-
-
-
-
-
+{width=512}
+
Note that a single comment has a significantly smaller PR footprint. We recommend this mode for most cases.
Also note that collapsible are not supported in _Bitbucket_. Hence, the suggestions are presented there as code comments.
@@ -80,7 +72,7 @@ To edit [configurations](https://github.com/Codium-ai/pr-agent/blob/main/pr_agen
Examples for extra instructions:
```
[pr_code_suggestions] # /improve #
- extra_instructions="""
+ extra_instructions="""\
Emphasize the following aspects:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
diff --git a/docs/docs/tools/improve_component.md b/docs/docs/tools/improve_component.md
new file mode 100644
index 00000000..321114b4
--- /dev/null
+++ b/docs/docs/tools/improve_component.md
@@ -0,0 +1,24 @@
+## Overview
+The `improve_component` tool generates code suggestions for a specific code component that changed in the PR.
+it can be invoked manually by commenting on any PR:
+```
+/improve_component component_name
+```
+
+To get a list of the components that changed in the PR and choose the relevant component interactively, use the [`analyze`](./analyze.md) tool.
+
+
+Example result:
+
+{width=768}
+
+{width=768}
+
+**Notes**
+- Language that are currently supported by the tool: Python, Java, C++, JavaScript, TypeScript, C#.
+
+## Configuration options
+- `num_code_suggestions`: number of code suggestions to provide. Default is 4
+- `extra_instructions`: Optional extra instructions to the tool. For example: "focus on ...".
+- `file`: in case there are several components with the same name, you can specify the relevant file.
+- `class_name`: in case there are several methods with the same name in the same file, you can specify the relevant class name.
\ No newline at end of file
diff --git a/docs/docs/tools/index.md b/docs/docs/tools/index.md
index bcd9ed9d..49c31a8f 100644
--- a/docs/docs/tools/index.md
+++ b/docs/docs/tools/index.md
@@ -2,19 +2,21 @@
Here is a list of PR-Agent tools, each with a dedicated page that explains how to use it:
-| Tool | Description |
-|-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
-| **[PR Description (`/describe`](./describe.md))** | Automatically generating PR description - title, type, summary, code walkthrough and labels |
-| **[PR Review (`/review`](./review.md))** | Adjustable feedback about the PR, possible issues, security concerns, review effort and more |
-| **[Code Suggestions (`/improve`](./improve.md))** | Code suggestions for improving the PR |
-| **[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 |
-| **๐ [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 |
-| **๐ [Generate Tests (`/test component_name`](./test.md))** | Automatically generates unit tests for a selected component, based on the PR code changes |
-| **๐ [CI Feedback (`/checks ci_job`](./ci_feedback.md))** | Automatically generates feedback and analysis for a failed CI job |
+| Tool | Description |
+|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
+| **[PR Description (`/describe`](./describe.md))** | Automatically generating PR description - title, type, summary, code walkthrough and labels |
+| **[PR Review (`/review`](./review.md))** | Adjustable feedback about the PR, possible issues, security concerns, review effort and more |
+| **[Code Suggestions (`/improve`](./improve.md))** | Code suggestions for improving the PR |
+| **[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 (๐) |
+| **๐ [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 |
+| **๐ [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 |
Note that the tools marked with ๐ are available only for PR-Agent Pro users.
\ No newline at end of file
diff --git a/docs/docs/tools/review.md b/docs/docs/tools/review.md
index a8bd5a66..c5681bb4 100644
--- a/docs/docs/tools/review.md
+++ b/docs/docs/tools/review.md
@@ -6,17 +6,9 @@ The tool can be triggered automatically every time a new PR is [opened](../usage
```
For example:
-
-
-
-
-
+{width=512}
-
-
-
-
-
+{width=512}
## Configuration options
@@ -70,11 +62,7 @@ For invoking the incremental mode, the following command can be used:
```
Note that the incremental mode is only available for GitHub.
-
-
-
-
-
+{width=512}
### PR Reflection
@@ -84,23 +72,11 @@ By invoking:
```
The tool will first ask the author questions about the PR, and will guide the review based on their answers.
-
-
-
-
-
+{width=512}
-
-
-
-
-
+{width=512}
-
-
-
-
-
+{width=512}
## Usage Tips
@@ -148,8 +124,8 @@ The tool will first ask the author questions about the PR, and will guide the re
Examples for extra instructions:
```
- [pr_reviewer] # /review #
- extra_instructions="""
+ [pr_reviewer]
+ extra_instructions="""\
In the code feedback section, emphasize the following:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
diff --git a/docs/docs/tools/similar_code.md b/docs/docs/tools/similar_code.md
index a35111d7..5f2af5c8 100644
--- a/docs/docs/tools/similar_code.md
+++ b/docs/docs/tools/similar_code.md
@@ -5,7 +5,8 @@ For example:
`Global Search` for a method called `chat_completion`:
-
+{width=768}
+
PR-Agent will examine the code component and will extract the most relevant keywords to search for similar code:
@@ -16,11 +17,12 @@ PR-Agent will examine the code component and will extract the most relevant keyw
Search result link example:
-
+{width=768}
+
`Organization Search`:
-
+{width=768}
## How to use
@@ -47,11 +49,11 @@ It can be invoked automatically from the analyze table, can be accessed by:
/analyze
```
Choose the components you want to find similar code for, and click on the `similar` checkbox.
-
+{width=768}
If you are looking to search for similar code in the organization's codebase, you can click on the `Organization` checkbox, and it will invoke a new search command just for the organization's codebase.
-
+{width=768}
## Configuration options
diff --git a/docs/docs/tools/similar_issues.md b/docs/docs/tools/similar_issues.md
index 3d492c0a..239b4e90 100644
--- a/docs/docs/tools/similar_issues.md
+++ b/docs/docs/tools/similar_issues.md
@@ -6,11 +6,11 @@ It can be invoked manually by commenting on any PR:
```
For example:
-
+{width=768}
-
+{width=768}
-
+{width=768}
Note that to perform retrieval, the `similar_issue` tool indexes all the repo previous issues (once).
diff --git a/docs/docs/tools/test.md b/docs/docs/tools/test.md
index a45f6faf..52e447ce 100644
--- a/docs/docs/tools/test.md
+++ b/docs/docs/tools/test.md
@@ -5,19 +5,19 @@ It can be invoked manually by commenting on any PR:
/test component_name
```
where 'component_name' is the name of a specific component in the PR.
-To get a list of the components that changed in the PR, use the [`analyze`](./analyze.md) tool.
+To get a list of the components that changed in the PR and choose the relevant component interactively, use the [`analyze`](./analyze.md) tool.
An example [result](https://github.com/Codium-ai/pr-agent/pull/598#issuecomment-1913679429):
-
+{width=704}
-
+{width=768}
-
+{width=768}
**Notes**
-- Language that are currently supported by the tool: Python, Java, C++, JavaScript, TypeScript.
+- Language that are currently supported by the tool: Python, Java, C++, JavaScript, TypeScript, C#.
## Configuration options
diff --git a/docs/docs/tools/update_changelog.md b/docs/docs/tools/update_changelog.md
index 4c423a3e..4f4de235 100644
--- a/docs/docs/tools/update_changelog.md
+++ b/docs/docs/tools/update_changelog.md
@@ -6,10 +6,9 @@ It can be invoked manually by commenting on any PR:
```
For example:
-
-
-
+{width=768}
+{width=768}
## Configuration options
diff --git a/docs/docs/usage-guide/additional_configurations.md b/docs/docs/usage-guide/additional_configurations.md
index 1a756252..e1128817 100644
--- a/docs/docs/usage-guide/additional_configurations.md
+++ b/docs/docs/usage-guide/additional_configurations.md
@@ -7,10 +7,10 @@ To ignore files or directories, edit the **[ignore.toml](https://github.com/Codi
- `IGNORE.GLOB`
- `IGNORE.REGEX`
-For example, to ignore python files in a PR with online usage, comment on a PR:
+For example, to ignore Python files in a PR with online usage, comment on a PR:
`/review --ignore.glob=['*.py']`
-To ignore python files in all PRs, set in a configuration file:
+To ignore Python files in all PRs, set in a configuration file:
```
[ignore]
glob = ['*.py']
@@ -26,13 +26,13 @@ All PR-Agent tools have a parameter called `extra_instructions`, that enables to
## Working with large PRs
The default mode of CodiumAI is to have a single call per tool, using GPT-4, which has a token limit of 8000 tokens.
-This mode provide a very good speed-quality-cost tradeoff, and can handle most PRs successfully.
+This mode provides a very good speed-quality-cost tradeoff, and can handle most PRs successfully.
When the PR is above the token limit, it employs a [PR Compression strategy](../core-abilities/index.md).
-However, for very large PRs, or in case you want to emphasize quality over speed and cost, there are 2 possible solutions:
+However, for very large PRs, or in case you want to emphasize quality over speed and cost, there are two possible solutions:
1) [Use a model](https://codium-ai.github.io/Docs-PR-Agent/usage-guide/#changing-a-model) with larger context, like GPT-32K, or claude-100K. This solution will be applicable for all the tools.
2) For the `/improve` tool, there is an ['extended' mode](https://codium-ai.github.io/Docs-PR-Agent/tools/#improve) (`/improve --extended`),
-which divides the PR to chunks, and process each chunk separately. With this mode, regardless of the model, no compression will be done (but for large PRs, multiple model calls may occur)
+which divides the PR to chunks, and processes each chunk separately. With this mode, regardless of the model, no compression will be done (but for large PRs, multiple model calls may occur)
## Changing a model
@@ -79,6 +79,7 @@ MAX_TOKENS={
[config] # in configuration.toml
model = "ollama/llama2"
+model_turbo = "ollama/llama2"
[ollama] # in .secrets.toml
api_base = ... # the base url for your huggingface inference endpoint
@@ -101,6 +102,7 @@ MAX_TOKENS={
}
[config] # in configuration.toml
model = "huggingface/meta-llama/Llama-2-7b-chat-hf"
+model_turbo = "huggingface/meta-llama/Llama-2-7b-chat-hf"
[huggingface] # in .secrets.toml
key = ... # your huggingface api key
@@ -114,13 +116,14 @@ To use Llama2 model with Replicate, for example, set:
```
[config] # in configuration.toml
model = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1"
+model_turbo = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1"
[replicate] # in .secrets.toml
key = ...
```
(you can obtain a Llama2 key from [here](https://replicate.com/replicate/llama-2-70b-chat/api))
-Also review the [AiHandler](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/algo/ai_handler.py) file for instruction how to set keys for other models.
+Also, review the [AiHandler](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/algo/ai_handler.py) file for instructions on how to set keys for other models.
### Vertex AI
@@ -129,6 +132,7 @@ To use Google's Vertex AI platform and its associated models (chat-bison/codecha
```
[config] # in configuration.toml
model = "vertex_ai/codechat-bison"
+model_turbo = "vertex_ai/codechat-bison"
fallback_models="vertex_ai/codechat-bison"
[vertexai] # in .secrets.toml
@@ -183,7 +187,7 @@ AWS session is automatically authenticated from your environment, but you can al
## Patch Extra Lines
-By default, around any change in your PR, git patch provides 3 lines of context above and below the change.
+By default, around any change in your PR, git patch provides three lines of context above and below the change.
```
@@ -12,5 +12,5 @@ def func1():
code line that already existed in the file...
diff --git a/docs/docs/usage-guide/automations_and_usage.md b/docs/docs/usage-guide/automations_and_usage.md
index 15b52402..14992611 100644
--- a/docs/docs/usage-guide/automations_and_usage.md
+++ b/docs/docs/usage-guide/automations_and_usage.md
@@ -50,6 +50,10 @@ Any configuration value in [configuration file](https://github.com/Codium-ai/pr-
## GitHub App
+!!! note "Configurations for PR-Agent Pro"
+ PR-Agent Pro for GitHub is an App, hosted by CodiumAI. So all the instructions below are relevant also for PR-Agent Pro users.
+ Same goes for [GitLab webhook](#gitlab-webhook) and [BitBucket App](#bitbucket-app) sections.
+
### GitHub app automatic tools when a new PR is opened
The [github_app](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L108) section defines GitHub app specific configurations.
@@ -59,7 +63,7 @@ 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",
- "/review --pr_reviewer.num_code_suggestions=0 --pr_reviewer.final_update_message=false",
+ "/review --pr_reviewer.num_code_suggestions=0",
"/improve",
]
```
@@ -99,13 +103,13 @@ The configuration parameter `push_commands` defines the list of tools that will
handle_push_trigger = true
push_commands = [
"/describe --pr_description.add_original_user_description=true --pr_description.keep_original_user_title=true",
- "/review --pr_reviewer.num_code_suggestions=0",
+ "/review --pr_reviewer.num_code_suggestions=0 --pr_reviewer.final_update_message=false",
]
```
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.
## GitHub Action
-`GitHub Action` is a different way to trigger PR-Agent tools, and uses a different configuration mechanism than `GitHub App`.
+`GitHub Action` is a different way to trigger PR-Agent tools, and uses a different configuration mechanism than `GitHub App`.
+{width=512}
Click [here](https://codium.ai/images/pr_agent/wiki_configuration_pr_agent.mp4) to see a short instructional video. We recommend surrounding the configuration content with triple-quotes, to allow better presentation when displayed in the wiki as markdown.
An example content:
```
-[pr_description] # /describe #
+[pr_description]
keep_original_user_title=false
```
diff --git a/docs/docs/usage-guide/index.md b/docs/docs/usage-guide/index.md
index e784d1b0..ce714c70 100644
--- a/docs/docs/usage-guide/index.md
+++ b/docs/docs/usage-guide/index.md
@@ -1,8 +1,10 @@
# Usage guide
+This page provides a detailed guide on how to use PR-Agent. It includes information on how to adjust PR-Agent configurations, define which tools will run automatically, manage mail notifications, and other advanced configurations.
+
+
- [Introduction](./introduction.md)
- [Configuration Options](./configuration_options.md)
-- [Managing Mail Notifications](./mail_notifications.md)
- [Usage and Automation](./automations_and_usage.md)
- [Local Repo (CLI)](./automations_and_usage.md#local-repo-cli)
- [Online Usage](./automations_and_usage.md#online-usage)
@@ -11,6 +13,7 @@
- [GitLab Webhook](./automations_and_usage.md#gitlab-webhook)
- [BitBucket App](./automations_and_usage.md#bitbucket-app)
- [Azure DevOps Provider](./automations_and_usage.md#azure-devops-provider)
+- [Managing Mail Notifications](./mail_notifications.md)
- [Additional Configurations Walkthrough](./additional_configurations.md)
- [Ignoring files from analysis](./additional_configurations.md#ignoring-files-from-analysis)
- [Extra instructions](./additional_configurations.md#extra-instructions)
diff --git a/docs/docs/usage-guide/mail_notifications.md b/docs/docs/usage-guide/mail_notifications.md
index 1e5b2e8a..f25c7eaa 100644
--- a/docs/docs/usage-guide/mail_notifications.md
+++ b/docs/docs/usage-guide/mail_notifications.md
@@ -2,8 +2,17 @@
Unfortunately, it is not possible in GitHub to disable mail notifications from a specific user.
If you are subscribed to notifications for a repo with PR-Agent, we recommend turning off notifications for PR comments, to avoid lengthy emails:
-
+{width=512}
As an alternative, you can filter in your mail provider the notifications specifically from the PR-Agent bot, [see how](https://www.quora.com/How-can-you-filter-emails-for-specific-people-in-Gmail#:~:text=On%20the%20Filters%20and%20Blocked,the%20body%20of%20the%20email).
-
\ No newline at end of file
+{width=512}
+
+
+Another option to reduce the mail overload, yet still receive notifications on PR-Agent tools, is to disable the help collapsible section in PR-Agent bot comments.
+This can done by setting `enable_help_text=false` for the relevant tool in the configuration file.
+For example, to disable the help text for the `pr_reviewer` tool, set:
+```
+[pr_reviewer]
+enable_help_text = false
+```
\ No newline at end of file
diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml
index c3e10abd..717f42bf 100644
--- a/docs/mkdocs.yml
+++ b/docs/mkdocs.yml
@@ -14,7 +14,7 @@ nav:
- 'usage-guide/index.md'
- Introduction: 'usage-guide/introduction.md'
- Configuration Options: 'usage-guide/configuration_options.md'
- - Managing email notifications: 'usage-guide/mail_notifications.md'
+ - Managing Mail Notifications: 'usage-guide/mail_notifications.md'
- Usage and Automation: 'usage-guide/automations_and_usage.md'
- Additional Configurations: 'usage-guide/additional_configurations.md'
- Tools:
@@ -25,8 +25,10 @@ nav:
- Ask: 'tools/ask.md'
- Update Changelog: 'tools/update_changelog.md'
- Similar Issues: 'tools/similar_issues.md'
+ - Help: 'tools/help.md'
- ๐ Analyze: 'tools/analyze.md'
- ๐ Test: 'tools/test.md'
+ - ๐ Improve Component: 'tools/improve_component.md'
- ๐ Documentation: 'tools/documentation.md'
- ๐ Custom Labels: 'tools/custom_labels.md'
- ๐ Custom Suggestions: 'tools/custom_suggestions.md'
@@ -77,6 +79,7 @@ theme:
plugins:
- social
- search
+ - glightbox
extra:
generator: false
@@ -94,7 +97,7 @@ extra:
- icon: fontawesome/brands/instagram
link: https://www.instagram.com/codiumai/
analytics:
- provider: google
+ provider: custom
property: ${{ secrets.GOOGLE_ANALYTICS_ID }}
extra_css:
@@ -112,10 +115,11 @@ markdown_extensions:
- pymdownx.details
- pymdownx.superfences
- pymdownx.mark
+ - md_in_html
- attr_list
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
- emoji_generator: !!python/name:materialx.emoji.to_svg
+ emoji_generator: !!python/name:material.extensions.emoji.to_svg
- toc:
title: On this page
toc_depth: 3
diff --git a/docs/overrides/main.html b/docs/overrides/main.html
new file mode 100644
index 00000000..93a67950
--- /dev/null
+++ b/docs/overrides/main.html
@@ -0,0 +1,10 @@
+{% extends "base.html" %}
+
+{% block scripts %}
+ {{ super() }}
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/docs/overrides/partials/integrations/analytics/custom.html b/docs/overrides/partials/integrations/analytics/custom.html
new file mode 100644
index 00000000..9a0785d2
--- /dev/null
+++ b/docs/overrides/partials/integrations/analytics/custom.html
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py
index 19968be5..1357db29 100644
--- a/pr_agent/algo/__init__.py
+++ b/pr_agent/algo/__init__.py
@@ -11,6 +11,8 @@ MAX_TOKENS = {
'gpt-4-1106-preview': 128000, # 128K, but may be limited by config.max_model_tokens
'gpt-4-0125-preview': 128000, # 128K, but may be limited by config.max_model_tokens
'gpt-4-turbo-preview': 128000, # 128K, but may be limited by config.max_model_tokens
+ 'gpt-4-turbo-2024-04-09': 128000, # 128K, but may be limited by config.max_model_tokens
+ 'gpt-4-turbo': 128000, # 128K, but may be limited by config.max_model_tokens
'claude-instant-1': 100000,
'claude-2': 100000,
'command-nightly': 4096,
diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py
index ce4d1db0..d07542f6 100644
--- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py
+++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py
@@ -61,6 +61,9 @@ class LiteLLMAIHandler(BaseAiHandler):
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model:
litellm.api_base = get_settings().huggingface.api_base
self.api_base = get_settings().huggingface.api_base
+ if get_settings().get("OLLAMA.API_BASE", None) :
+ litellm.api_base = get_settings().ollama.api_base
+ self.api_base = get_settings().ollama.api_base
if get_settings().get("HUGGINGFACE.REPITITION_PENALTY", None):
self.repetition_penalty = float(get_settings().huggingface.repetition_penalty)
if get_settings().get("VERTEXAI.VERTEX_PROJECT", None):
@@ -150,4 +153,4 @@ class LiteLLMAIHandler(BaseAiHandler):
if get_settings().config.verbosity_level >= 2:
get_logger().info(f"\nAI response:\n{resp}")
- return resp, finish_reason
\ No newline at end of file
+ return resp, finish_reason
diff --git a/pr_agent/algo/token_handler.py b/pr_agent/algo/token_handler.py
index d7eff9d7..9cc3b41f 100644
--- a/pr_agent/algo/token_handler.py
+++ b/pr_agent/algo/token_handler.py
@@ -1,12 +1,25 @@
from jinja2 import Environment, StrictUndefined
from tiktoken import encoding_for_model, get_encoding
-
from pr_agent.config_loader import get_settings
+from threading import Lock
-def get_token_encoder():
- return encoding_for_model(get_settings().config.model) if "gpt" in get_settings().config.model else get_encoding(
- "cl100k_base")
+class TokenEncoder:
+ _encoder_instance = None
+ _model = None
+ _lock = Lock() # Create a lock object
+
+ @classmethod
+ def get_token_encoder(cls):
+ model = get_settings().config.model
+ if cls._encoder_instance is None or model != cls._model: # Check without acquiring the lock for performance
+ with cls._lock: # Lock acquisition to ensure thread safety
+ if cls._encoder_instance is None or model != cls._model:
+ cls._model = model
+ cls._encoder_instance = encoding_for_model(cls._model) if "gpt" in cls._model else get_encoding(
+ "cl100k_base")
+ return cls._encoder_instance
+
class TokenHandler:
"""
@@ -31,7 +44,7 @@ class TokenHandler:
- system: The system string.
- user: The user string.
"""
- self.encoder = get_token_encoder()
+ self.encoder = TokenEncoder.get_token_encoder()
if pr is not None:
self.prompt_tokens = self._get_system_user_tokens(pr, self.encoder, vars, system, user)
diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py
index a1aaf50a..a3fd82bd 100644
--- a/pr_agent/algo/utils.py
+++ b/pr_agent/algo/utils.py
@@ -13,7 +13,7 @@ import yaml
from starlette_context import context
from pr_agent.algo import MAX_TOKENS
-from pr_agent.algo.token_handler import get_token_encoder
+from pr_agent.algo.token_handler import TokenEncoder
from pr_agent.config_loader import get_settings, global_settings
from pr_agent.algo.types import FilePatchInfo
from pr_agent.log import get_logger
@@ -567,7 +567,7 @@ def clip_tokens(text: str, max_tokens: int, add_three_dots=True) -> str:
return text
try:
- encoder = get_token_encoder()
+ encoder = TokenEncoder.get_token_encoder()
num_input_tokens = len(encoder.encode(text))
if num_input_tokens <= max_tokens:
return text
@@ -576,7 +576,7 @@ def clip_tokens(text: str, max_tokens: int, add_three_dots=True) -> str:
num_output_chars = int(chars_per_token * max_tokens)
clipped_text = text[:num_output_chars]
if add_three_dots:
- clipped_text += "...(truncated)"
+ clipped_text += "\n...(truncated)"
return clipped_text
except Exception as e:
get_logger().warning(f"Failed to clip tokens: {e}")
diff --git a/pr_agent/git_providers/codecommit_provider.py b/pr_agent/git_providers/codecommit_provider.py
index f035351d..41de6bb3 100644
--- a/pr_agent/git_providers/codecommit_provider.py
+++ b/pr_agent/git_providers/codecommit_provider.py
@@ -10,7 +10,7 @@ from ..algo.utils import load_large_diff
from .git_provider import GitProvider
from ..config_loader import get_settings
from ..log import get_logger
-
+from pr_agent.algo.language_handler import is_valid_file
class PullRequestCCMimic:
"""
diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py
index de54ec3f..574e28cf 100644
--- a/pr_agent/git_providers/github_provider.py
+++ b/pr_agent/git_providers/github_provider.py
@@ -745,22 +745,4 @@ class GithubProvider(GitProvider):
return False
def calc_pr_statistics(self, pull_request_data: dict):
- try:
- out = {}
- from datetime import datetime
- created_at = pull_request_data['created_at']
- closed_at = pull_request_data['closed_at']
- closed_at_datetime = datetime.strptime(closed_at, "%Y-%m-%dT%H:%M:%SZ")
- created_at_datetime = datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%SZ")
- difference = closed_at_datetime - created_at_datetime
- out['hours'] = difference.total_seconds() / 3600
- out['commits'] = pull_request_data['commits']
- out['comments'] = pull_request_data['comments']
- out['review_comments'] = pull_request_data['review_comments']
- out['changed_files'] = pull_request_data['changed_files']
- out['additions'] = pull_request_data['additions']
- out['deletions'] = pull_request_data['deletions']
- except Exception as e:
- get_logger().exception(f"Failed to calculate PR statistics, error: {e}")
- return {}
- return out
+ return {}
diff --git a/pr_agent/servers/github_action_runner.py b/pr_agent/servers/github_action_runner.py
index ad16958e..53b54a29 100644
--- a/pr_agent/servers/github_action_runner.py
+++ b/pr_agent/servers/github_action_runner.py
@@ -103,6 +103,8 @@ async def run_action():
await PRReviewer(pr_url).run()
if auto_improve is None or is_true(auto_improve):
await PRCodeSuggestions(pr_url).run()
+ else:
+ get_logger().info(f"Skipping action: {action}")
# Handle issue comment event
elif GITHUB_EVENT_NAME == "issue_comment" or GITHUB_EVENT_NAME == "pull_request_review_comment":
diff --git a/pr_agent/servers/help.py b/pr_agent/servers/help.py
index 364088ec..9e85887d 100644
--- a/pr_agent/servers/help.py
+++ b/pr_agent/servers/help.py
@@ -128,7 +128,7 @@ Be specific, clear, and concise in the instructions. With extra instructions, yo
Examples for extra instructions:
```
[pr_description]
-extra_instructions="""
+extra_instructions="""\
- The PR title should be in the format: '| Tool | Description | Invoke Interactively :gem: |
|---|
| Tool | Description | Trigger Interactively :gem: |
|---|---|---|
| \n\n{tool_names[i]} | \n{descriptions[i]} | \n\n\n{checkbox_list[i]}\n |
| \n\n{tool_names[i]} | \n{descriptions[i]} | \n\n\n{checkbox_list[i]}\n |
| Tool | Command | Description |
|---|
| Tool | Command | Description |
|---|---|---|
| \n\n{tool_names[i]} | {commands[i]} | {descriptions[i]} |
| \n\n{tool_names[i]} | {commands[i]} | {descriptions[i]} |