Sweep: AI-powered junior dev
Bug Reports & Feature Requests โถย Code Changes
Sweep is an AI junior developer that transforms bug reports & feature requests into code changes.
Describe bugs, small features, and refactors like you would to a junior developer, and Sweep:
- ๐ reads your codebase
- ๐ plans the changes
- โกwrites a pull request with codeโก
See highlights at https://docs.sweep.dev/about/examples (opens in a new tab).
๐ Install Sweep
Setting up Sweep is as simple as adding the GitHub bot to a repo, then creating an issue for the bot to address. We support all languages that GPT4 supports, such as Python, Typescript, Rust, Go, Java, C# and C++.
- Add the Sweep GitHub app (opens in a new tab) to your desired repos
- Create new issue in your repo, like
"Sweep: Handle this feature on my backlog ...."
. If there's an existing issue, label it with the purple "Sweep" label.
๐ก How to Use Sweep
You can use Sweep to create pull requests - a set of code changes that can be independently tested and merged. Sweep can do this in a couple of ways.
Creating Pull Requests to handle an Issue
First, you can assign Sweep a task like squashing an old bug in your backlog. To do this, create or use an existing GitHub issue. This issue should be detailed enough for a junior engineer (Sweep) to find the correct files and make the appropriate code changes.
Assigning Sweep to an Existing Issue
To have Sweep create a PR for an existing issue, label the issue with the purple "Sweep" label (added to your repository when Sweep is installed).
Assigning Sweep to a New Issue
To have Sweep create a PR for a new issue, create a new issue with the title "Sweep: [title of issue]"
.
Best Practices for Creating Issues
For harder problems, try to provide the same information a human would need.
-
Title:
โSweep: create a new search query filtering agent that will be used in ticket_utils.pyโ
-
Description:
โWe have keyword search in lexical_search.py, and weโd like to filter out unnecessary keywords using an agent and a prompt. Use the file name_agent.py as a referenceโ
For simpler problems, providing a single line and a reference file should suffice.
-
Title:
โSweep: Add docstrings to main/api.pyโ
-
Description:
โUse the file main/github_utils.py as a referenceโ
Improving Sweep's PRs
Sweep wonโt always get it right, as language models arenโt as reliable for as weโd like them to be.
Sweep has a couple of ways to deal with this though:
Running your GitHub Actions
Sweep defines and runs GitHub actions for you. After the PR is created, Sweep will work asynchronously until it fixes your CI. At this point, you can either try to fix it yourself or wait until Sweep completes it.
Having Sweep edit an existing PR
If you want Sweep to make an edit to it's previous change, you can leave a comment on it's PR. Sweep supports two types of comments - slow and fast.
Fast Comments
You can create a fast comment by making a review comment. This comment will only modify the file thatโs been commented on.
Slow Comments
You can create a slow comment by making an issue comment. This comment can perform codebase wide changes, and will spin up a new dashboard.
Merge Conflict Resolution
When you create a pull request, Sweep will automatically resolve merge conflicts via a new pull request. The new pull request will contain the same changes as the original pull request, but with the merge conflicts resolved.
๐ค Contributing
Contributions are welcome and greatly appreciated! For detailed guidelines on how to contribute, please see the CONTRIBUTING.md file. For more detailed docs, see ๐ Quickstart (opens in a new tab).
๐ Story
We were frustrated by small issues, like simple bug fixes, annoying refactors, and small features. Each task required us to open our IDE to fix simple bugs. So we decided to leverage the capabilities of ChatGPT to address this directly in GitHub.
Contributors
and, of course, Sweep!