Sync upstream Gemini-CLI v0.8.2 (#838)

This commit is contained in:
tanzhenxin
2025-10-23 09:27:04 +08:00
committed by GitHub
parent 096fabb5d6
commit eb95c131be
644 changed files with 70389 additions and 23709 deletions

View File

@@ -0,0 +1,36 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
type AuthType,
type Config,
getErrorMessage,
} from '@qwen-code/qwen-code-core';
/**
* Handles the initial authentication flow.
* @param config The application config.
* @param authType The selected auth type.
* @returns An error message if authentication fails, otherwise null.
*/
export async function performInitialAuth(
config: Config,
authType: AuthType | undefined,
): Promise<string | null> {
if (!authType) {
return null;
}
try {
await config.refreshAuth(authType);
// The console.log is intentionally left out here.
// We can add a dedicated startup message later if needed.
} catch (e) {
return `Failed to login. Message: ${getErrorMessage(e)}`;
}
return null;
}