-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ✨ add conventional commits, and gitmoji cli flags #163
Conversation
…ource code, paving the way for adding Gitmoji in a similar way.
…adds support for using Gitmoji and Conventional Commits in the CLI by introducing two new flags
This commit fixes a bug where an unnecessary whitespace was added in the commit message prompt in aicommits.ts file. The code was cleaned up by removing the whitespace to make the prompt more visually appealing.
This commit increases the timeout for https request from 10s to 20s to account for longer response times.
Very nice :D I think passing it with just arguments without true and false is nice. If you look at https://github.com/folke/devmoji they put gitmoji after the conventional commit. Probably because conventional commits can be grouped by convention type and having the emoji in front of the message probably makes that harder.
I think it is a good idea to get the gitmoji from the official api. From a user perspective, I think Gitmoji users are used to selecting a Gitmoji from a list, when they are committing. Perhaps we can give 3 - 4 Gitmoji suggestions (with the AI Model) that most relate to the commit message, for the user to choose from. I also think we should mark Gitmoji and Conventional as |
Thank you for the explanation, I was wondering why you had I say it would be best to push as experimental and add documentation. |
I also wonder if you ran the tests after all your changes. a lot of them are now failing. Also I created some tests that should correspond to a certain conventional commit type. I also saw that you removed the extra context for conventional commit types. That was there on purpose for GPT to be more accurate on selecting the types.
|
|
Strange, I ran I needed to temporarily remove the conventional commit types to experiment with a different prompt since it was very long. I will add it back. |
There are 16 tests now, so maybe some of them didn't run on your machine :) |
Do you receive Currently I do not see all the 16 tests. Do I copy your |
I do see them in this PR diff. I am using a Macbook.
|
Understood, I am going to switch to a Linux system. |
This commit updates the .editorconfig file to use single quotes for strings by adding the `quote_type` property and setting it to `single`. This improves the consistency of the codebase and makes it easier to read and maintain.
This commit adds a new function to retrieve gitmojis by calling an external API with a fetch request. The function returns an array of objects with the properties `emoji` and `description`.
This commit updates the httpsPost timeout to 30 seconds and adds a new gitmoji to the prompt. The prompt now includes a new "🧐" gitmoji to signify data exploration/inspection.
@thijslimmen I will keep working on this later, or tomorrow. I re-added the extra context for conventional commit types. Added the gitmoji api, and changed the prompt. |
The commit message generation function had an extra '}' in the title, which was causing a syntax error. This has been fixed by removing the extra character.
Update the function getCommitTitleFormatPrompt in openai.ts to include a required gitmoji in the commit title.
Update the README file with information about the --generate flag, --gitmoji flag, --conventional flag, combine flags, and configure default flags
I am really happy about the current PR. I will improve on unit testing this evening (GMT+1). Shall we then think about releasing it? 🚀 |
Update wording of the conventional commit descriptions to be grammatically correct.
type: Boolean, | ||
description: '(Experimental) Enable the use of Gitmoji', | ||
alias: 'm', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This alias overlaps with -m
in git commit
Reading this commit above:
/**
* Since this is a wrapper around git commit
,
* flags should not overlap with it
* https://git-scm.com/docs/git-commit
*/
I agree. Although before that I would like to work on adding the I am in the GMT -4/UTC -4 time zone. |
In my opinion we should complete this with GPT3.5. Also GPT4 is not publicly available and heavily throttled, so for now it is a nice to have which we can implement in a new PR |
Understood. Agreed. |
Rename the test files for better code organization and maintainability.
Add a new test case in the openai.spec.ts file to test the generateCommitMessage function. The test generates the git diff message and logs it for testing purposes.
57860f9
to
a86fbbf
Compare
…sting a React application 🔬 The git diff contains changes related to testing a React application. The conventional commit type should be "test".
Update test timeout to 20 seconds in vitest.config.ts
@NorkzYT I've done the following things.
You should run, tests are really fast 💯 :
I do see some things that are not working too often:
I think the above happens, because the prompt is getting bigger and the subtle context is lost. We have to find a way to add some weight to certain things to make sure it is always applied. We could also use a Semantic kernal pattern which validates the output and does some retrying until a certain condition is meet. |
Thanks for submitting the PR! I appreciate the effort you've put into making these changes. While some of them are quite beneficial, a few may require further discussion before we can proceed. To smoothen the review process, would you mind dividing up the changes into smaller PRs? For each PR, please provide a brief explanation of the issue you're addressing, as this will offer context for review. |
@privatenumber Sure! I will create some smaller PRs. I think that will help you review the changes |
@thijslimmen Great work mate! I will look into the prompt issue to find a way to weigh the prompt to increase accuracy of both the issues you mentioned. |
I think with splitting this PR we will find the issues eventually. I already saw that with the way we did the new prompt, the original prompting was broken. I am now making a PR for just conventional commits. This will make reviewing and adding features in the feature even better |
Understood, and agreed. |
Sounds good! Just so we're on the same page, smaller PRs ideally consist of 1~3 files. That should streamline review to deploy and help get your contributions in faster. Additionally, it would be helpful if you could separate any large or non-essential changes, such as refactors, into a separate PR. This way, we can ensure that high-priority features are not delayed by lower-priority modifications. Thanks again, your contribution is greatly appreciated! |
I continued in PR #168 The Source code is now +- 4 files (including config files). Only code is updated that is related to supporting conventional commits. I did improve a lot on the testing strategy, because it was really hard to test my changes. These changes are a bit bigger, but these should make reviewing easier. I hope this helps :) |
@Nutlope you can close this PR. It will remain as reference for future changes like Gitmoji and Commit Title + Description |
Built on-top of the current PR of #160.
Commands to use after forking repo and switching to this PR:
New flag information:
Flag for conventional commits:
Entire flag =
--conventional
Alias =
-c
Flag for gitmoji:
Entire flag =
--gitmoji
Alias =
-m
These are listed as Booleans in the code, although I could not figure out how to allow the use of
true
or `false.To use conventional commits and gitmoji, run the following command:
Example output 1:
Command:
node ./dist/cli.mjs
Example output 2:
Command:
node ./dist/cli.mjs -c
Example output 3:
Command:
node ./dist/cli.mjs -c -m
Currently, the way that the prompt uses gitmoji's is insufficient, thus I will work on a way to retrieve the gitmoji's from the official api, and parse the prompt.