aicommits icon indicating copy to clipboard operation
aicommits copied to clipboard

Git hook mode

Open privatenumber opened this issue 2 years ago • 1 comments

Thinking about introducing a second mode to address all the Git integration issues:

Git hook mode

By running aicommits install-hook, a prepare-commit-msg hook will be installed to the current Git project.

The hook will be called whenever the user runs git commit without a message. I'm still exploring this, but ideally there's a way to specify "AI mode". For example: git commit -F ai or git commit -t ai.

The hook will basically do the same thing this script does now: send the diff to OpenAI to get a message. However, there will only be a simple loading state and perhaps a selector prompt if multiple suggestions are returned.

To specify how many suggestions should be generated, we need to look into whether we can pass in a flag (or env vars?), but if not, we'd have to rely on the ~/.aicommits config file.

With Git hook mode, we'll be able to integrate Git completely and support power users.

CLI mode

CLI mode is what we have now. Even though Git hook mode should be able to handle all use-cases, I think there's value in preserving the aicommits command for a more user-friendly experience.

privatenumber avatar Feb 17 '23 03:02 privatenumber

Worth exploring as long as we keep CLI mode the default.

Nutlope avatar Feb 17 '23 05:02 Nutlope

Closed via #95

privatenumber avatar Feb 22 '23 05:02 privatenumber