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.18k stars 329 forks source link

[Bug]: 'OCO_AI_PROVIDER' name is invalid #429

Open mauvehed opened 2 weeks ago

mauvehed commented 2 weeks ago

Opencommit Version

3.2.2

Node Version

21.7.3

NPM Version

10.5.0

What OS are you seeing the problem on?

Other Linux Distro

What happened?

Running oco produces the following error:

'OCO_AI_PROVIDER' name is invalid, it should be either 'OCO_OCO_AI_PROVIDER' or it doesn't exist.

Expected Behavior

That oco would execute as normal.

Current Behavior

It's producing the following error:

'OCO_AI_PROVIDER' name is invalid, it should be either 'OCO_OCO_AI_PROVIDER' or it doesn't exist.

Possible Solution

No response

Steps to Reproduce

No response

Relevant log output

│
└  'OCO_AI_PROVIDER' name is invalid, it should be either 'OCO_OCO_AI_PROVIDER' or it doesn't exist.

│
└  Manually fix the '.env' file or global '~/.opencommit' config file.
mauvehed commented 2 weeks ago

I am so baffled by this. I'd guess it's adding the extra OCO_ because it's not finding a specific variable, and so it just prefixes that missing variable with the OCO_.

di-sukharev commented 2 weeks ago

@mauvehed

did you set oco config set OCO_AI_PROVIDER=anthropic or oco config set OCO_AI_PROVIDER=openai and then oco config set OCO_API_KEY=<your_provider_key>?

di-sukharev commented 2 weeks ago

hope it helps, but the error is wrong, i will be fixing the error message later this week, no time now. you could prepare a PR if you find the bug and want to help fix it

mauvehed commented 2 weeks ago

@mauvehed

did you set oco config set OCO_AI_PROVIDER=anthropic or oco config set OCO_AI_PROVIDER=openai and then oco config set OCO_API_KEY=<your_provider_key>?

I manage my config manually. I don't ever run the "oco config set". I maintain all my dotfiles via central management so I just update directly. That shouldn't cause problems, right?

And because I'm an idiot and forgot to share it, here is my config

OCO_AI_PROVIDER=openai
OCO_API_KEY=<REDACTED>
OCO_OPENAI_MAX_TOKENS=3000
OCO_DESCRIPTION=true
OCO_EMOJI=undefined
OCO_MODEL=gpt-4o
OCO_LANGUAGE=en
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=$msg
OCO_PROMPT_MODULE=conventional-commit
OCO_WHY=true
OCO_GITPUSH=false
mauvehed commented 2 weeks ago

So, opencommit works. But oco is what fails.

di-sukharev commented 1 week ago

could you do node -v? i think you have opencommit installed globally, if so you have it in global node/v20/node_modules or node/v22/node_modules or your version. so make sure you have 3.2.2 version of opencommit in the node_modules of the node version you are currently using. lmk the output

di-sukharev commented 1 week ago

@mauvehed