Skip to content
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

Fix initial prompt and commit message #14

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

dararish
Copy link

The initial prompt is now more specific about not including "This commit" in the description, and adds a newline between the subject and description.

…mmit message

The initial prompt is now more specific about not including "This
commit" in the description, and adds a newline between the subject and
description.
@dararish dararish changed the title style(generateCommitMessageFromGitDiff.ts): fix initial prompt and commit message Fix initial prompt and commit message Mar 14, 2023
@@ -51,7 +51,7 @@ const INIT_MESSAGES_PROMPT: Array<ChatCompletionRequestMessage> = [
// prettier-ignore
content: `${config?.emoji ? '🐛 ' : ''}fix(server.ts): change port variable case from lowercase port to uppercase PORT
${config?.emoji ? '✨ ' : ''}feat(server.ts): add support for process.env.PORT environment variable
${config?.description ? 'The port variable is now named PORT, which improves consistency with the naming conventions as PORT is a constant. Support for an environment variable allows the application to be more flexible as it can now run on any available port specified via the process.env.PORT environment variable.' : ''}`
${config?.description ? '\nThe port variable is now named PORT, which improves consistency with the naming conventions as PORT is a constant. Support for an environment variable allows the application to be more flexible as it can now run on any available port specified via the process.env.PORT environment variable.' : ''}`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this \n will make 2+ lines look like this:

feat(file): smth
fix(file): smth

<description of the above 'feat' and 'fix' goes here>

chore: smth

<description of the 'chore' goes here>

so it would be hard to tell what describes what :)

i'd remove the \n, so it looks like that:

feat(file): smth
fix(file): smth
<description of the above 'feat' and 'fix' goes here>

chore: smth
<description of the 'chore' goes here>

but i may be wrong here, could you share a screenshot of your result pls?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean. The reason I did that was for git log --oneline to work properly; maybe there's a different solution I'm overlooking.

image
In the picture above, commit message for a24f994 was created with the base version of the script, the other two were created with my modifications. Still trying to figure out why 5a58b0b only says test: without a prefix.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is not always a prefix, it's up to gpt :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add dots to the commit messages if description is set, lines 52 and 53?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dararish so, how about just adding dots to the end of commit messages?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@di-sukharev I'm attempting to get it to add the period. Modified the example & prompt, but it still generates the commit message without a period. Do you have a working example I could play with?

Copy link
Author

@dararish dararish Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, adding the period makes it clearer where the "title" ends, but it still shows the whole description with the --oneline flag, which is not desirable when trying to get a quick overview of changes. I will try to refine the prompt in order to make it clear that only the first line(which should be a succinct summary?) should be followed by 2 newlines, but I suspect we might need to add another example.

I just realized that my git diff output is customized and is quite different than the provided example, so that could explain some subpar results. Unfortunately I won't have much time to play around with this until Sunday, feel free to merge the other change until we can figure out a way to move forward with this.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dararish thanks bro!

i wonder why you are bothered with the description being shown in the log --oneline, description is actually a part of the commit which goes into git commit :)

src/generateCommitMessageFromGitDiff.ts Outdated Show resolved Hide resolved
Co-authored-by: Sukharev <57486732+di-sukharev@users.noreply.github.com>
@di-sukharev di-sukharev changed the base branch from master to dev March 17, 2023 06:04
@di-sukharev
Copy link
Owner

@dararish i've changed base branch to dev, could you solve the conflict pls :)

@github-actions
Copy link

Stale pull request message

@di-sukharev
Copy link
Owner

please pull latest dev and run npm run build to solve conflicts @dararish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants