chore: Extract '.gemini' to GEMINI_DIR constant (#10540)

Co-authored-by: Richie Foreman <richie.foreman@gmail.com>
This commit is contained in:
Dongin Kim(Terry)
2025-10-14 02:31:39 +09:00
committed by GitHub
parent 7beaa368a9
commit 518caae62e
36 changed files with 181 additions and 157 deletions

View File

@@ -25,6 +25,7 @@ import os from 'node:os';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import dotenv from 'dotenv';
import { GEMINI_DIR } from '@google/gemini-cli-core';
const argv = yargs(hideBin(process.argv)).option('q', {
alias: 'quiet',
@@ -35,7 +36,7 @@ const argv = yargs(hideBin(process.argv)).option('q', {
let geminiSandbox = process.env.GEMINI_SANDBOX;
if (!geminiSandbox) {
const userSettingsFile = join(os.homedir(), '.gemini', 'settings.json');
const userSettingsFile = join(os.homedir(), GEMINI_DIR, 'settings.json');
if (existsSync(userSettingsFile)) {
const settings = JSON.parse(
stripJsonComments(readFileSync(userSettingsFile, 'utf-8')),
@@ -49,7 +50,7 @@ if (!geminiSandbox) {
if (!geminiSandbox) {
let currentDir = process.cwd();
while (true) {
const geminiEnv = join(currentDir, '.gemini', '.env');
const geminiEnv = join(currentDir, GEMINI_DIR, '.env');
const regularEnv = join(currentDir, '.env');
if (existsSync(geminiEnv)) {
dotenv.config({ path: geminiEnv, quiet: true });