romanhotsiy / commitgpt Goto Github PK
View Code? Open in Web Editor NEWAutomatically generate commit messages using ChatGPT
Automatically generate commit messages using ChatGPT
I need help. When installing and running "npx commitgpt", I'm getting the following error:
status: 401,
statusText: 'Unauthorized',
headers: {...
Really by default, commit messages should appear in the imperative: instead of "Added logging", the subject should read "Add logging". See:
https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/
https://cbea.ms/git-commit/
https://reflectoring.io/meaningful-commit-messages/
https://www.gitkraken.com/learn/git/best-practices/git-commit-message
And many similar. The -c
flag seems to already do that (unless it happened randomly during my tests), but many (most ?) people use simple, capitalized imperative subjects outside of conventional commits
- basically, like the existing default, but with the imperative mood.
Could be a new mode, a flag, or simply a change to the default behaviour.
Otherwise: wow, this is so neat! Thank you!
I'm using that tool on Win git bash.
Got this error:
√ Pick a message · Update route to use IP
error: pathspec 'route' did not match any file(s) known to git
error: pathspec 'to' did not match any file(s) known to git
error: pathspec 'use' did not match any file(s) known to git
error: pathspec 'IP'' did not match any file(s) known to git
Aborted.
Error: Command failed: git commit -m 'Update route to use IP'
at checkExecSyncError (node:child_process:841:11)
at execSync (node:child_process:912:15)
at file:///XXXXXXXXXXXXXXXX/commitgpt/dist/index.js:122:25
at step (file://XXXXXXXXXXXXXX/commitgpt/dist/index.js:33:23)
at Object.next (file:///xxxxxxxxxxxxxxxxxxxx/commitgpt/dist/index.js:14:53)
at fulfilled (file:///XXXXXXXXXXXXXXXXXXXX/commitgpt/dist/index.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 12552,
stdout: null,
stderr: null
}
Just a couple of suggestions to fix in the README.md.
config.ts
, the config file that is being looked at is ~/{HOME_DIR}/.commit-gpt.json
. There isn't any mention of a config.json
mentioned in the code base like it says in the READMEsessionKey
not the snake case version session_key
git diff --cached
which I just learned is no different than git diff --staged
. However, maybe consider updating so it matches?All nitpicks as I was having trouble getting this working without digging into the code to figure out what was expected.
For point 1 and 2, I know that if the config file doesn't exist, the it'll prompt to paste in the session key. This may be a separate issue but my terminals hung when trying to paste it in. I didn't want to create a separate issue yet until I confirmed it's not an issue I'm only experiencing.
When available in the branch name, what about referencing the Jira ticket number in the commit message as well?
Since we want to use gpt-4, how about adding a type implementation that uses createChatCompletion?
Something that many companies use to track commits related to a Jira ticket would also be helpful. For example, our commit messages looks like this,
APT-1234: Commit message
Here is APT-1234 is the ticket number.
Thanks in advance,
Jinesh
// ...
data: {
error: {
message: 'The model `text-davinci-003` has been deprecated, learn more here: https://platform.openai.com/docs/deprecations',
type: 'invalid_request_error',
param: null,
code: 'model_not_found'
}
}
Github shows an automatic link to create PR on push. Would be amazing to pre-populate PR message with ChatGPT
Hi,
In the example in the readme you have :
suggest 10 commit messages based on the following diff:
{{diff}}
commit messages should:
- follow conventional commits
- message format should be: <type>[scope]: <description>
examples:
- fix(authentication): add password regex pattern
- feat(storage): add new test cases
The format should be <type>(scope): <description>
with parentheses instead of brackets.
I've tried running the app for the first time now,
I copied the value of __Secure-next-auth.session-token
and pasted into the terminal and I get an error message:
Invalid token. Please try again.
I think it happens since OpenAI has added cloudflare to protect their services
Using version 1.0.5
You may want to add a bit of intent to the commit message that comes out.
How about adding an interactive mode to accomplish this?
With config:
{
"model": "gpt-3.5-turbo",
"temperature": 0.5,
"maxTokens": 2048
}
I get the following error message:
data: {
error: {
message: 'This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?',
type: 'invalid_request_error',
param: 'model',
code: null
}
}
I'm using this tool in WSL2.
Got the some error:
✔ Pick a message · feat: implement dijkstra's algorithm
/bin/sh: 1: Syntax error: Unterminated quoted string
Aborted.
Error: Command failed: git commit -m 'feat: implement dijkstra\'s algorithm'
at checkExecSyncError (node:child_process:828:11)
at execSync (node:child_process:899:15)
at file:///home/jimmyhealer/.npm/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:122:25
at step (file:///home/jimmyhealer/.npm/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:33:23)
at Object.next (file:///home/jimmyhealer/.npm/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:14:53)
at fulfilled (file:///home/jimmyhealer/.npm/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
status: 2,
signal: null,
output: [ null, null, null ],
pid: 2295,
stdout: null,
stderr: null
}
Error: Command failed: git commit -m 'feat: implement dijkstra\'s algorithm'
This command fails because the backslash does not successfully escape the character.
Every time I try. I follow the instructions to the letter, no idea why it isn't working. Anything I can do to help debug, please let me know.
Thanks!
I can use the plugin just fine, but after restarting my PyCharm, the plugin would lose my OpenAI token in the settings. I can adjust other settings just fine and they will stay saved, but the OpenAI token has to be entered on every new launch of PyCharm. Have tried reinstalling the plugin and it's the same issue.
yesterday Im using commitgpt and success get the recommendations commit, but today i can't get recommendation because the error:
> npx commitgpt -c
Error: Failed to fetch - Unauthorized
Using this cli tool for the first time, posting the session token doesn't work.
expected the access token to be accepted
I get a "invalid token" message.
Darwin 21.6.0
Hi,
I've copied the content of the readme.md in chat GPT 4 asking him:
Can you understand where I should write this command? npx commitgpt
:D
Here its answer (I guess he is right but it would be great if you could clarify those instructions inside the readme. Most of people, and even dev, have no idea what npx is for example):
You should write the command npx commitgpt in your terminal or command prompt. Here's how you can do it:
Open a terminal (on macOS or Linux) or command prompt (on Windows).
Navigate to the directory where your Git repository is located. You can use the cd command followed by the directory path. For example:
cd path/to/your/git/repo
Run the npx commitgpt command:
npx commitgpt
This command will execute the commitgpt tool, which will automatically generate commit messages for your staged changes using
ChatGPT.
Note that you need to have Node.js and npm installed on your system to use the npx command.
Sometimes something is wrong with the session token in a way that it's able to get the access token but requests are blocked.
Would be convenient to have ability to re-login: #15
Hopefully this is not needed when OpenAI adds official support.
Pasting the auth token into commitgpt returns the message: "Invalid token. Please try again."
I did an equivalent curl
request and the response is:
curl -H "__Secure-next-auth.session-token=$TOKEN" "https://chat.openai.com/api/auth/session"
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='content-type'/><style type='text/css'>body { font-family:Arial; margin-left:40px; }img { border:0 none; }#content { margin-left: auto; margin-right: auto }#message h2 { font-size: 20px; font-weight: normal; color: #000000; margin: 34px 0px 0px 0px }#message p { font-size: 13px; color: #000000; margin: 7px 0px 0px 0px }#errorref { font-size: 11px; color: #737373; margin-top: 41px }</style><title>Microsoft</title></head><body><div id='content'><div id='message'><h2>The request is blocked.</h2></div><div id='errorref'><span>0YvqOYwAAAAAiMEPW7daTQ7ok4jSan+1sRlJBMzFFREdFMDkxNwBlNjZiOGIwMy0wNzkzLTQ0MDktOTc3My0yZTYxMmU3MWExZTM=</span></div></div></body></html>%
Does the Commit message need to include the filenames included in the commit?
I have ran commitgpt a few times for this commit and none of the suggestions include the filename.
But it looks as if the filename is required in the commit message.
√ Pick a message · Update password reset duration to 60 minutes
error: pathspec 'password' did not match any file(s) known to git
error: pathspec 'reset' did not match any file(s) known to git
error: pathspec 'duration' did not match any file(s) known to git
error: pathspec 'to' did not match any file(s) known to git
error: pathspec '60' did not match any file(s) known to git
error: pathspec 'minutes'' did not match any file(s) known to git
Aborted.
Error: Command failed: git commit -m 'Update password reset duration to 60 minutes'
at checkExecSyncError (node:child_process:871:11)
at execSync (node:child_process:943:15)
at file:///C:/Users/xxxxxx/AppData/Local/npm-cache/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:122:25
at step (file:///C:/Users/xxxxxx/AppData/Local/npm-cache/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:33:23)
at Object.next (file:///C:/Users/xxxxxx/AppData/Local/npm-cache/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:14:53)
at fulfilled (file:///C:/Users/xxxxxx/AppData/Local/npm-cache/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 22868,
stdout: null,
stderr: null
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.