Automatically generate commit messages using ChatGPT.
npx commitgpt
or use -c
for conventional commits format.
npx commitgpt -c
On the first run you will be asked to enter your OpenAI session token.
- Go to https://chat.openai.com/chat and log in or sign up.
- Open console with
F12
. - Open
Application
>Cookies
. - Copy the value for
__Secure-next-auth.session-token
and paste it intoconfig.json.example
undersession_token
. You do not need to fill outAuthorization
- Save the modified file to
config.json
(In the current working directory)
- Runs
git diff --staged
- Sends the diff to ChatGPT and asks it to suggest commit messages
- Shows suggestions to the user
Some code and approaches were inspired by the awesome projects below:
- https://github.com/acheong08/ChatGPT
- https://github.com/transitive-bullshit/chatgpt-api
- https://github.com/wong2/chat-gpt-google-extension
Do you need API docs? Check out Redocly.