Patchwork is a command-line interface. It can be used in your local terminal, IDE or as part of a CI/CD pipeline.

Step 1. Install patchedwork.

pip install patchwork

Step 2. Run patchwork with your preferred patchflow. To illustrate, we will use the AutoFix patchflow.

When the working directory is the git repository

patchwork AutoFix

When the argument is the git repository

patchedwork AutoFix --path=/path/to/my/git/repository

Step 3. If this is the first time running patchwork, you will need to configure your preferred LLM or link a Patched account.

Option 1. Using Patched

If you wish to use Patched for your LLM requests, you can begin by running the login command below.

patchwork login

This will redirect you to Patched portal to generate a token. Copy the token and paste it to the prompt. If this is not the first time running patched-cli an application directory should already exist under your user’s home directory (if you are using a Unix-based operating system) or AppData folder (if you are using a windows based operating system).

Alternatively you can set the environment variable PATCHED_ACCESS_TOKEN before running patchwork.

export PATCHED_ACCESS_TOKEN=your-patched-access-token-here

Option 2. Using your own LLM API Key

If you wish to use your own LLM API Key, you can configure by running the following commands.

patchwork --defaultAPI=OPENAI

This will use OpenAI for all LLM requests where possible. You will also need to set the environment variable OPENAI_API_KEY before running patchwork.

export OPENAI_API_KEY=your-openai-key-here