opencommit
opencommit copied to clipboard
[Bug]: Hook needs env vars set even when using ollama
trafficstars
Opencommit Version
3.0.17
Node Version
18.18.2
NPM Version
9.8.1
What OS are you seeing the problem on?
Other Linux Distro
What happened?
I used oco hook set to install the prepare commit msg hook and tried to run git commit, which produced the following error message:
┌ opencommit
│
└ ✖ Error: No OPEN_AI_API or OCO_ANTHROPIC_API_KEY or OCO_AZURE_API_KEY exists. Set your key in ~/.opencommit
Simply running oco does work as expected but I'd like to be able to edit the commit message.
This is my .opencommit config:
OCO_DESCRIPTION=false
OCO_EMOJI=false
OCO_LANGUAGE=en
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=$msg
OCO_PROMPT_MODULE=conventional-commit
OCO_AI_PROVIDER=ollama
OCO_GITPUSH=false
OCO_ONE_LINE_COMMIT=false
OCO_TEST_MOCK_TYPE=commit-message
Expected Behavior
Generates a commit message and opens my $EDITOR to allow me to modify the message before commiting.
Current Behavior
Commit gets interrupted with the message above.
Possible Solution
Unify config handling between hook and regular command mode.
Steps to Reproduce
- Set provider to ollama with
oco config set OCO_AI_PROVIDER=ollama - Clean up config file according to https://github.com/di-sukharev/opencommit/issues/352#issuecomment-2186908034
- Install git hook with
oco hook set - Run
git commit
Relevant log output
No response