MCPcopy
hub / github.com/di-sukharev/opencommit / promptForMissingApiKey

Function promptForMissingApiKey

out/cli.cjs:86816–86841  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86814 if (provider === "test" /* TEST */) {
86815 return false;
86816 }
86817 const hasRequiredConfig = MODEL_REQUIRED_PROVIDERS.includes(
86818 provider
86819 ) ? Boolean(config8.OCO_MODEL) : Boolean(config8.OCO_API_KEY);
86820 return !hasGlobalConfig && !hasRequiredConfig;
86821}
86822async function promptForMissingApiKey() {
86823 const config8 = getConfig();
86824 const provider = config8.OCO_AI_PROVIDER || "openai" /* OPENAI */;
86825 if (NO_API_KEY_PROVIDERS.includes(provider)) {
86826 return true;
86827 }
86828 if (config8.OCO_API_KEY) {
86829 return true;
86830 }
86831 console.log(
86832 source_default.yellow(`
86833API key missing for ${provider}. Let's set it up.
86834`)
86835 );
86836 const apiKey = await getApiKey(provider);
86837 if (hD2(apiKey)) {
86838 return false;
86839 }
86840 const existingConfig = getGlobalConfig();
86841 setGlobalConfig({
86842 ...existingConfig,
86843 OCO_API_KEY: apiKey
86844 });

Callers 1

cli.cjsFile · 0.70

Calls 6

hD2Function · 0.85
includesMethod · 0.80
getConfigFunction · 0.70
getApiKeyFunction · 0.70
getGlobalConfigFunction · 0.70
setGlobalConfigFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…