Send your entire codebase to gpt and get a changeset.
cd myproject
gptdiff 'add hover effects to the buttons'
Generates a prompt.txt file that you can copy and paste into a large context gpt to have a conversation with suggested changes. You can also invoke the API and try to directly apply the patch (this often doesn't work).
Requires Python. Clone this repo and run:
It requires tiktoken to count gpt4o tokens.
pip install tiktoken
Development install (no pip package yet)
python setup.py install
To call openai from the command line, you need to set the OPENAI_API_KEY
environment variable:
export OPENAI_API_KEY='your-openai-api-key'
OpenAI will not be called unless you specify --call
or --apply
Prevent files being appended to the prompt by adding them to .gitignore
or .gptignore
After installing the package, you can use the gptdiff
command in your terminal. cd into your codebase and run:
gptdiff '<user_prompt>'
any files that are included in .gitignore are ignored when generating prompt.txt.
You can specify additional files or directories to include in the prompt by adding them as arguments to the gptdiff
command. If no additional files or directories are specified, the tool will default to using the current working directory.
Example usage:
gptdiff 'make this change' src test
You can also call openai and automatically apply the generated git diff with the --apply
flag:
gptdiff '<user_prompt>' --apply
This often generates incorrect diffs that need to be manually merged.
The gptdiff
package depends on the argparse
and openai
packages.
This project is licensed under the terms of the MIT license.