sweepai / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.
https://sweep.dev
Other
7.46k stars 430 forks source link

Sweep: Make Sweep available on Bitbucket repositories #897

Closed contentfree closed 1 year ago

contentfree commented 1 year ago

Details

Ideally Sweep would work on any git repository and not just Github-hosted repositories.

Files to change

No response

sweep-nightly[bot] commented 1 year ago

Here's the PR! https://github.com/sweepai/sweep/pull/898.

⚡ Sweep Free Trial: I used GPT-4 to create this ticket. You have 5 GPT-4 tickets left. For more GPT-4 tickets, visit our payment portal.


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/sweepai/sweep/blob/400cde78d7b70ee189d9bc653940d75ad0b1bce5/sweepai/handlers/create_pr.py#L24-L265 https://github.com/sweepai/sweep/blob/400cde78d7b70ee189d9bc653940d75ad0b1bce5/docs/pages/index.mdx#L1-L69 https://github.com/sweepai/sweep/blob/400cde78d7b70ee189d9bc653940d75ad0b1bce5/sweepai/utils/config/server.py#L2-L93 https://github.com/sweepai/sweep/blob/400cde78d7b70ee189d9bc653940d75ad0b1bce5/docs/installation.md#L1-L74 https://github.com/sweepai/sweep/blob/400cde78d7b70ee189d9bc653940d75ad0b1bce5/docs/pages/blogs/giving-dev-tools.mdx#L1-L55

I also found the following external resources that might be helpful:

Summaries of links found in the content:


Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
sweepai/handlers/create_pr.py Abstract the GitHub-specific logic into a generic interface that can handle interactions with any Git hosting service. This includes operations like creating pull requests, fetching file contents, and handling webhooks.
sweepai/utils/config/server.py Modify the configuration handling to support Bitbucket-specific configurations such as API keys and webhook secrets.
sweepai/handlers/bitbucket_pr.py Implement the generic interface created in sweepai/handlers/create_pr.py for Bitbucket. This includes operations like creating pull requests, fetching file contents, and handling webhooks using Bitbucket's API.
sweepai/utils/config/bitbucket_server.py Create a new configuration file to handle Bitbucket-specific configurations such as API keys and webhook secrets.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:

Abstract GitHub-specific logic and add Bitbucket support sweep/abstract-github-logic-bitbucket-support

Description

This PR abstracts the GitHub-specific logic in sweepai/handlers/create_pr.py and modifies the configuration handling in sweepai/utils/config/server.py to add support for Bitbucket repositories.

Changes Made

  • Abstracted the GitHub-specific logic in sweepai/handlers/create_pr.py into a generic interface that can handle interactions with any Git hosting service.
  • Modified the configuration handling in sweepai/utils/config/server.py to support Bitbucket-specific configurations such as API keys and webhook secrets.
  • Created sweepai/handlers/bitbucket_pr.py to implement the generic interface for Bitbucket, including operations like creating pull requests, fetching file contents, and handling webhooks using Bitbucket's API.
  • Created sweepai/utils/config/bitbucket_server.py as a new configuration file to handle Bitbucket-specific configurations.

Summary

This PR makes Sweep available on Bitbucket repositories by abstracting the GitHub-specific logic and adding support for Bitbucket. It includes changes to the create_pr.py file to create a generic interface for interacting with any Git hosting service, and modifications to the server.py file to handle Bitbucket-specific configurations. Additionally, new files bitbucket_pr.py and bitbucket_server.py have been added to implement the Bitbucket functionality and configurations, respectively.

Please review and merge this PR to enable Sweep to work on any Git repository, not just GitHub-hosted repositories.


Step 4: ⌨️ Coding

I have finished coding the issue. I am now reviewing it for completeness.


Step 5: 🔁 Code Review

Success! 🚀


I'm a bot that handles simple bugs and feature requests but I might make mistakes. Please be kind! Join Our Discord

wwzeng1 commented 1 year ago

Hey @contentfree this is a great suggestion. We're really focused on supporting github at the moment though. Would you be willing to try it with GitHub and see if you like it first?

Supporting all git hosting is on our mind, but it's too early for that.