378: fix hook env (#402)

* fix(prepare-commit-msg-hook): update error handling to provide clearer instructions for setting API keys and improve user guidance

* build
This commit is contained in:
GPT10
2024-09-03 13:14:45 +03:00
committed by GitHub
parent 69b3c00a52
commit 1d19ddd9e2
3 changed files with 7021 additions and 7932 deletions

View File

@@ -44,9 +44,10 @@ export const prepareCommitMessageHook = async (
!config.OCO_ANTHROPIC_API_KEY &&
!config.OCO_AZURE_API_KEY
) {
throw new Error(
'No OPEN_AI_API or OCO_ANTHROPIC_API_KEY or OCO_AZURE_API_KEY exists. Set your key in ~/.opencommit'
outro(
'No OCO_OPENAI_API_KEY or OCO_ANTHROPIC_API_KEY or OCO_AZURE_API_KEY exists. Set your key via `oco config set <key>=<value>, e.g. `oco config set OCO_OPENAI_API_KEY=<value>`. For more info see https://github.com/di-sukharev/opencommit'
);
return;
}
const spin = spinner();