This script requires Deno to run. If you don't have Deno installed, you can install it by following the instructions on the official Deno website.
You will also need an OpenAI API key to use this script. You can sign up for an account and get an API key on the OpenAI website.
deno install --global -A -fn commit jsr:@garn/commit
commit [OPTIONS]
--add
: Runsgit add .
before creating the commit message.--push
: Runsgit push
after creating the commit.--skipEdit
: Skips the editing of the commit message before creating the commit.--noCommit
: Skips the creation of the commit. Just prints the commit message.--model <model>
: Specifies the model to use for generating the commit message. The default isgpt-4o
.--config
: Ask for the OpenAI API key and save it.--apiKey <apiKey>
: Specifies the OpenAI API key to use. This will override the value set in theOPENAI_API_KEY
environment variable.--baseURL <baseURL>
: Specifies the base URL to use for the OpenAI API. This will override the default base URL.--debug
: Enables debug mode, which will print additional information to the console.--maxWords <maxWords>
: Specifies the maximum number of words to call the api. The default is 6000. Is useful to no incur in extra charges.--ollama
: Uses thellama3
model and sets the base URL to 'http://localhost:11434/v1'.--help
: Prints the help message.
OPENAI_API_KEY
: Your OpenAI API key. This is required to interact with the OpenAI API.
Here's an example of how you can use commit
:
OPENAI_API_KEY=your_api_key_here commit --add --push
This will add all changes, create a commit with a message generated by the OpenAI API, and push the changes to the current branch.