Revolutionizing Pull Request Collaboration: CodiumAI PR-Agent VS GitHub Copilot For Pull Requests
Tags: codiumai, ai, git, productivity
Published: 2023-12-12 07:49:53

In the dynamic world of software development, tools that enhance productivity and streamline workflows are highly sought after, AI-powered tools have surfaced to enhance the efficiency and 10x the productivity of developers. Among these tools, CodiumAI's PR-Agent and GitHub Copilot stand out, offering distinct approaches to enhancing code quality and developer productivity.

### <u>AI for 10x Productivity</u>

Before getting into the specifics of CodiumAI's PR-Agent and GitHub Copilot, it's important to acknowledge the transformative impact of AI on productivity. These tools leverage artificial intelligence to not only facilitate code review processes but also to significantly amplify the productivity of developers, allowing them to achieve more in less time.

_This article will focus specifically on the Git solution provided by PR-Agent and GitHub Copilot solution for pull requests._

---

## <u>A Closer Look at PR-Agent by CodiumAI</u>

### 1. Overview

PR-Agent, an open-source AI-powered tool by CodiumAI, aims at automating pull request analysis, feedback, and suggestions. Its development focus includes identifying potential code problems, improving code quality, and facilitating collaborative feedback from other developers.

### 2. Versatile Git Compatibility

From auto-generating descriptions to suggesting code improvements and answering free-text questions, PR-Agent seamlessly functions within Git and various integrated development environments (IDEs).

Notably, PR-Agent extends its support to all Git platforms, ensuring its adaptability to different version control systems. Some prominent Git platforms that PR-Agent seamlessly integrates with includes but are not limited to GitHub, GitLab, Bitbucket, CodeCommit, Azure Devops etc.

### 3. Quick Setup Procedure

For the quickest setup of PR-Agent on your repositories, I recommend running it as a GitHub Action. The installation guide can be found [here](https://github.com/Codium-ai/pr-agent/blob/main/INSTALL.md#run-as-a-github-action).

If you're planning to use PR-Agent on both public and private repositories, consider running it as a GitHub App. The installation guide for GitHub App setup is available [here](https://github.com/Codium-ai/pr-agent/blob/main/INSTALL.md#run-as-a-github-app).

Choose the option that best fits your repository needs, and follow the provided guides for a seamless PR-Agent setup.

### 4. Commands and Usage

PR-Agent prides itself on offering a comprehensive set of commands designed to empower developers in various aspects of pull request management, each serving a unique purpose in the code review and improvement process. Here's a detailed look at some key commands:

![CodiumAI PR-Agent Commands](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8438tmazr161stxj70bn.png)

_If you've installed Codium PR-Agent on a private repository, you can utilize commands like `/describe`. On the other hand, for public repositories, simply mention the name `@CodiumAI-Agent` in your Git provider environment, then request actions such as `/review` or `/describe`._

### 5. Use Case

In a recent scenario involving the Alxfolio project, a portfolio-generating site utilizing the GitHub API for fetching user data, I opened a pull request. Within this pull request, my focus was on enhancing the `get_user` function. The refactoring process involved code improvements, also, I globalized the GitHub API URL for better maintainability.

![My Pull Request](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/brrnisx2s7fgdtqkzf2a.gif)

After submitting the pull request, the PR-Agent, set up as a GitHub Action, automatically conducted checks on the changes. As a result, it stands ready to accept commands from me, paving the way for a streamlined process for further review and interaction. The PR-Agent's automated checks help ensure the integrity of the pull request and enhance collaboration within the development workflow.

![GitHub Action checks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fu1btax3zklyjg5gt8a7.gif)

- <u>**Auto Description (/describe):**</u>

**Public Repo**
```
@CodiumAI-Agent /describe
```
**Private Repo**
```
/describe
```
I generated a description for my pull request by commenting the `/describe` command on the pull request. This command efficiently generates a concise yet comprehensive PR description. It encompasses crucial details such as title, type, summary, code walkthrough, and labels.

![Describe command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0l20k5x58h3mro26bltv.gif)

- <u>**Auto Review (/review):**</u>

**Public Repo**
```
@CodiumAI-Agent /review
```
**Private Repo**
```
/review
```
By commenting the `/review` command, I received adjustable feedback covering key aspects, including the PR's main theme, type, relevant tests, security considerations, and diverse suggestions for enhancing the overall content.

![CodiumAI PR-Agent review](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wyevdypkde98qnugmzux.gif)

- <u>**Question Answering (/ask ...):**</u>

**Public Repo**
```
@CodiumAI-Agent /ask "something"
```
**Private Repo**
```
/ask "something"
```
In the ongoing interaction with the Alxfolio project's pull request with PR-Agent, I leveraged the `/ask` command to seek insights. Specifically, I inquired about “The primary purpose of the get_user function”. The `/ask` command excels in addressing free-text questions related to the PR. It provided me with valuable information and clarifications about the code and its broader context, contributing to a more nuanced understanding of the changes introduced.

![CodiumAI PR-Agent ask](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dqqms8i1is8xo14638bu.gif)

- <u>**Code Refactoring (/improve):**</u>

**Public Repo**
```
@CodiumAI-Agent /improve
```
**Private Repo**
```
/improve
```
I applied the `/improve` command and it played a crucial role in suggesting opportunities for enhancing not only the `get_user` function but also other supporting functions within the `functions.py` file.

The `/improve` command is designed to identify areas for refactoring, focusing on aspects such as code quality, readability, and maintainability. Following these suggestions, I am prepared to commit these changes, ensuring that the codebase benefits from optimized practices.

![CodiumAI PR-Agent improve](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fsiwaxw30xj94c54oz3r.gif)

- <u>**Code Documentation (/add_docs):**</u>

**Public Repo**
```
@CodiumAI-Agent /add_docs
```
**Private Repo**
```
/add_docs
```
I used the `/add_docs` command to streamline the documentation process and it performed an automatic scan of my code, identifying undocumented functions and code blocks within the pull request. The command adds documentation to previously un-documented functions and classes. The automated detection and addition of documentation enhance the overall clarity and understanding of the codebase.

With the suggested documentation in place, I have the option to commit these changes, ensuring that the pull request not only introduces code enhancements but also maintains comprehensive and well-documented code practices.

![CodiumAI PR-Agent add_docs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zc9jbmzo104p6i32y06c.gif)

_You can refer to [PR-Agent on Github](https://github.com/Codium-ai/pr-agent) to see more Commands._


### 6. Open-source Nature

One notable strength of PR-Agent lies in its open-source nature, inviting transparency and community collaboration. Developers have the freedom to inspect and modify the tool, fostering a culture of shared innovation and continuous improvement.

---

## <u>Exploring GitHub Copilot For Pull Requests</u>

### 1. Overview

GitHub Copilot, a collaboration between GitHub and OpenAI, is another powerhouse in the AI-driven development landscape. GitHub Copilot for pull requests focuses on generating summaries with specific commands. Developers can initiate this feature during PR creation, by editing the pull request description post-creation, or by commenting in the pull request thread. The main commands include showcasing all types of content, generating a one-paragraph summary, creating a detailed list of changes, or even crafting a poetic description.

### 2. Marker Tags for Description Expansion

Copilot's output for pull request summaries consists of a concise three-sentence prose overview, providing a high-level understanding of the changes. Additionally, it generates 3–5 bulleted changes listed with links to the respective lines of code they refer to.
In addition to pull request summaries, Copilot introduces marker tags for enhancing pull request descriptions. Developers can use markers like `copilot:all`, `copilot:summary`, and `copilot:walkthrough` to guide Copilot in expanding descriptions into summaries of changes.

![Copilot for pr](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fzpr3fo43gpci6frxwws.gif)

### 3. GitHub Integration

One of Copilot's key strengths lies in its seamless integration with GitHub and various code repositories. Operating directly within popular code editors like Visual Studio Code, it ensures developers have immediate access to its suggestions during the coding process.

### 4. Proprietary Nature

Unlike PR-Agent's open-source model, GitHub Copilot follows a proprietary approach. While this may restrict access to some extent, it also reflects a dedication to delivering polished features and an enhanced user experience.

---

## <u>Comparative Analysis Between CodiumAI's PR-Agent and GitHub Copilot For Pull Requests</u>

### 1. Specialization vs. Generalization

PR-Agent specializes in comprehensive pull request reviews with a myriad of tools and commands, covering various aspects of the review process. On the other hand, GitHub Copilot, while powerful, is more focused on generating descriptions and summaries in response to specific commands.

### 2. Usability and Integration

Both PR-Agent and Copilot emphasize seamless integration into developer workflows. PR-Agent's compatibility with multiple Git platforms and IDEs, including GitHub, GitLab, Bitbucket, CodeCommit, Azure DevOps, etc, positions it as a tool suitable for a broad audience, regardless of the chosen development environment. Copilot, while seamlessly integrating with GitHub, its compatibility is limited exclusively to the GitHub platform. 

### 3. Extensive Commands vs. Specific Descriptions

PR-Agent provides an extensive array of commands for nuanced interactions, ranging from code improvements to answering questions. In contrast, Copilot's commands are tailored specifically to generate pull request descriptions and summaries.

### 4. Flexibility and Customization

PR-Agent's open-source nature and versatile commands provide developers with flexibility. GitHub Copilot, with its proprietary model, GitHub Copilot, in the context of pull requests, streamlines its focus on providing concise, AI-generated descriptions.

### 5. Command Variety

PR-Agent supports a diverse range of commands, each serving a specific purpose in code review and improvement. Developers can utilize commands such as `/describe`, `/review`, `/ask`, `/refactor`, `/generate`, `/summarize`, `/test`, `/debug`, `/optimize`, and `/document`, enabling a comprehensive set of functionalities.

In contrast, GitHub Copilot for pull requests has a more singular focus, primarily offering concise AI-generated descriptions using markers such as `copilot:all`, `copilot:summary`, and `copilot:walkthrough`. While this streamlines its functionality for pull requests, it lacks the command variety found in PR-Agent.

### 6. Community Involvement

PR-Agent, being open-source, fosters community involvement. Developers can contribute to its development, report issues, and participate in enhancing its capabilities. GitHub Copilot, being a proprietary tool, operates without the same level of community engagement in terms of direct contributions to its codebase.

### 7. Cost and Accessibility

PR-Agent is free to use, being an open-source tool, making it accessible to developers without any cost barriers. On the other hand, GitHub Copilot follows a subscription-based model, costing $10 USD per month or $100 USD per year, potentially limiting its accessibility, especially for individual developers or small teams.

---

## <u>Conclusion</u>

In conclusion, the comparison between PR-Agent and GitHub Copilot reveals distinct approaches to pull request summaries. PR-Agent distinguishes itself with a feature-rich arsenal of commands, a variety of tools, and compatibility across a broad spectrum of Git platforms, making it a comprehensive solution for robust pull request reviews. On the contrary, GitHub Copilot excels in its specialized role, focusing on generating descriptions and summaries through specific commands.

It's worth noting that PR-Agent is freely available, making it a cost-effective choice, while GitHub Copilot comes with associated costs. Personally, I find the comprehensive and free nature of CodiumAI's PR-Agent solution for GitHub to be a compelling factor, further solidifying its appeal for developers seeking a versatile and budget-friendly tool for pull request management. As these tools evolve, they continue to be instrumental in driving innovation, efficiency, and collaboration within the dynamic landscape of software development. Developers are encouraged to explore and harness the strengths of both tools, with PR-Agent emerging as a robust and accessible choice for GitHub repositories.

## <u>References</u>
- [CodiumAI PR-Agent Git Plugin](https://www.codium.ai/products/git-plugin/)
- [CodiumAI PR-Agent Open-Source Code](https://github.com/Codium-ai/pr-agent)
- [GitHub Copilot for Pull Requests](https://githubnext.com/projects/copilot-for-pull-requests)
- [Copilot Pull Request Summaries](https://docs.github.com/en/copilot/github-copilot-enterprise/copilot-pull-request-summaries/about-copilot-pull-request-summaries)