di-sukharev / opencommit

just a GPT wrapper for git — generate commit messages by an LLM in 1 sec — works best with Claude 3.5 — supports local models too
https://www.npmjs.com/package/opencommit
MIT License
6.17k stars 329 forks source link

[Feature]: Add ability to inform Opencommit of purpose of changes #135

Open robellegate opened 1 year ago

robellegate commented 1 year ago

Description

I would like to request a feature that allows users to inform Opencommit of the purpose of a commit. This will enable Opencommit to generate more descriptive and specific commit messages based on the user's input. For example, running oc "fix violation of Markdownlint rule MD034" would result in a suggested commit of:

":rotating_light: lint(idea-intake.md): fix bare urls violation" "This commit wraps the email address in angle brackets to adhere to the markdownlint rule MD034, which disallows the use of bare URLs. The change resolves the linting error and ensures better compatibility with various markdown parsers."

Suggested Solution

To implement this feature, Opencommit can be extended to accept an optional argument that describes the purpose of the commit. The input can be parsed to extract relevant information (e.g., lint rule violations) and used to generate a commit message that reflects the user's input.

Alternatives

An alternative solution could be to allow users to inform Opencommit of the purpose during interactive usage of oc, without requiring an extra argument. This can be achieved by prompting the user to provide a description of the commit's purpose after they are presented with the generated commit message. Opencommit can then use this input to re-generate a more informative and context-specific commit message. This approach keeps the command-line interface clean while still enabling users to provide additional information for generating better commit messages.

Additional Context

The primary goal of this feature is to make commit messages more informative and relevant by allowing users to provide context-specific information. By generating commit messages that accurately describe the purpose of a commit, it will be easier for project maintainers and contributors to understand the changes made in each commit, ultimately improving the overall quality and maintainability of the project.

robellegate commented 1 year ago

This could possibly be implemented via #70, but with the addition of re-generating the commit message based on user feedback.

di-sukharev commented 1 year ago

@robellegate thanks for that! do you want to make a PR? I would play instead with the few-shot examples in the prompt, maybe it can be solved more UX friendly.

if not — I dont think #70 is the way to go, cause we have oco hook set which allows you to edit messages in your IDE of choice when running git commit (with no -m flag) or any alias you have

if there is no easier way — we could do something like this:

  1. create a config ASK_PURPOSE=boolean, default false
  2. if ASK_PURPOSE=true => before going to openAI api for the message we prompt user for sharing the purpose
sebastienfi commented 1 year ago

Then it would ask the purpose for every commit... I'd rather have something that's set per-commit.

robellegate commented 1 year ago

That's why I thought an optional argument would be the best solution. However, I could also see this working with improved UI/UX with an edit option that opens up a conversational chat where the changes the user wants made to the commit message are done via chat instead of direct editing of the commit message.

Sent from Yahoo Mail on Android

On Thu, Jun 15, 2023 at 0:45, Sébastien @.***> wrote:

Then it would ask the purpose for every commit... I'd rather have something that's set per-commit.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

sebastienfi commented 1 year ago

That's why I thought an optional argument would be the best solution. However, I could also see this working with improved UI/UX with an edit option that opens up a conversational chat where the changes the user wants made to the commit message are done via chat instead of direct editing of the commit message.

It seems a better option. That doesn't seem complex to implement given cleye documentation, @robellegate would you like to push a PR?

github-actions[bot] commented 1 year ago

Stale issue message