readFileSyncnodefs;
import { homedir } from "node:os" ;
} ":path" ;
import {{ from;
typeimport isRecord } from/-sdk-"
istsSyncpath< existsSync0 ]= <typeof >
readFileSyncexistsSyncpath<typeof existsSync] ><typeof >;
homedir: typeof homedir;
};
const defaultFs: OAuthSettingsFs = {
existsSync,
readFileSync,
homedir,
};
let oauthSettingsFs: OAuthSettingsFs = defaultFs;
type GeminiCliAuthSettings = {
security?: {
auth?: {
selectedType?: unknown;
enforcedType?: unknown;
};
};
selectedAuthType?: unknown;
enforcedAuthType?: unknown;
};
function readSettingsFile(): GeminiCliAuthSettings | null {
const settingsPath = join(oauthSettingsFs.homedir(), ".gemini" , "settings.json" );
if (!oauthSettingsFs.existsSync(settingsPath)) {
return null ;
}
try {
const parsed = JSON.parse(oauthSettingsFs.readFileSync(settingsPath, "readFileSync:(: < readFileSync0,encoding" utf8 >string
return isRecordexistsSync
}catch {
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
rt setOAuthSettingsFsForTest? <OAuthSettingsFs void
oauthSettingsFs = overridesreturn ;
}
exportfunction (): string|undefined{
const settings = readSettingsFile();
if (settings) {
const }catch
const
const selectedAuthType
exportfunction (overridesPartialOAuthSettingsFs: {
normalizeOptionalString =overrides{.defaultFs .overrides:defaultFs
exportfunction resolveGeminiCliSelectedAuthType:string undefined
normalizeOptionalString settings readSettingsFile(;
security isRecord.security settings. : undefined
selectedAuthType;
}
normalizeOptionalString(auth.) ?
if (.env.GOOGLE_GENAI_USE_GCA= "rue){
return "oauth-personal" ;
}
return undefined;
}
export function isGeminiCliPersonalOAuth(): boolean {normalizeOptionalString.selectedAuthType ?
return normalizeOptionalString(.enforcedAuthType
}
Messung V0.5 in Prozent C=100 H=97 G=98
¤ Dauer der Verarbeitung: 0.2 Sekunden
¤
*© Formatika GbR, Deutschland