I think you can partially accomplish automatic custom commit messages with a button click using the following:
- A markdown file describing your commit instructions with a prompt on a repo
- The doc crawling feature of cursor
- The
@Commit (Diff of Working State
or@PR (Diff with Main Branch
contexts.
You can even support custom flags of your own. Here is what I do which combines some cool tricks I learned in this forum and the things I figured out by myself after spending quite some time with cursor.
- Create a repo or a gist(private repo also works) to store your prompt(s)(mine is here dotfiles/ai-stuff/cursor/prompts/create-commit/system.md at main · dgokcin/dotfiles (github.com)
- Add the URL of the markdown prompt as a doc to cursor (
Cursor -> Settings -> Cursor Settings -> Features -> Docs -> Add new doc
) - Name it as
@create-commit
or something similar
When you wanna commit just use cursor chat to call your commit prompt with the diff context.
@create-commit @Commit (Diff of Working State)
or
git diff | pbcopy
in your terminal and than @create-commit <paste-with-command-v>
in cursor chat (as mentioned above, there is no context for the staged changes in cursor yet)
If you manage the force the prompt to output the git commit under a markdown codeblock with bash
as the language in your prompt(claude-3.5-sonnet seems quite consistent for me as well as figuring out the changes the way I want) than this makes it runnable in yor shell creating a run button, on top right corner.
This may be a little bit overkill for some if you are used to the copilot extension but I find this method quite extendable and practical.