summaryrefslogtreecommitdiff
path: root/packages/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src')
-rw-r--r--packages/cli/src/config/config.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/packages/cli/src/config/config.ts b/packages/cli/src/config/config.ts
index 3ee03c82..e5ae8cd9 100644
--- a/packages/cli/src/config/config.ts
+++ b/packages/cli/src/config/config.ts
@@ -234,6 +234,7 @@ async function createContentGeneratorConfig(
const googleCloudProject = process.env.GOOGLE_CLOUD_PROJECT;
const googleCloudLocation = process.env.GOOGLE_CLOUD_LOCATION;
+ const hasCodeAssist = process.env.GEMINI_CODE_ASSIST === 'true';
const hasGeminiApiKey = !!geminiApiKey;
const hasGoogleApiKey = !!googleApiKey;
const hasVertexProjectLocationConfig =
@@ -244,12 +245,18 @@ async function createContentGeneratorConfig(
'Both GEMINI_API_KEY and GOOGLE_API_KEY are set. Using GOOGLE_API_KEY.',
);
}
- if (!hasGeminiApiKey && !hasGoogleApiKey && !hasVertexProjectLocationConfig) {
+ if (
+ !hasCodeAssist &&
+ !hasGeminiApiKey &&
+ !hasGoogleApiKey &&
+ !hasVertexProjectLocationConfig
+ ) {
logger.error(
'No valid API authentication configuration found. Please set ONE of the following combinations in your environment variables or .env file:\n' +
- '1. GEMINI_API_KEY (for Gemini API access).\n' +
- '2. GOOGLE_API_KEY (for Gemini API or Vertex AI Express Mode access).\n' +
- '3. GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION (for Vertex AI access).\n\n' +
+ '1. GEMINI_CODE_ASSIST=true (for Code Assist access).\n' +
+ '2. GEMINI_API_KEY (for Gemini API access).\n' +
+ '3. GOOGLE_API_KEY (for Gemini API or Vertex AI Express Mode access).\n' +
+ '4. GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION (for Vertex AI access).\n\n' +
'For Gemini API keys, visit: https://ai.google.dev/gemini-api/docs/api-key\n' +
'For Vertex AI authentication, visit: https://cloud.google.com/vertex-ai/docs/start/authentication\n' +
'The GOOGLE_GENAI_USE_VERTEXAI environment variable can also be set to true/false to influence service selection when ambiguity exists.',
@@ -261,7 +268,7 @@ async function createContentGeneratorConfig(
model: argv.model || DEFAULT_GEMINI_MODEL,
apiKey: googleApiKey || geminiApiKey || '',
vertexai: hasGeminiApiKey ? false : undefined,
- codeAssist: !!process.env.GEMINI_CODE_ASSIST,
+ codeAssist: hasCodeAssist,
};
if (config.apiKey) {