mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-25 12:34:38 -07:00
feat(cli): disable folder trust in headless mode (#18407)
This commit is contained in:
@@ -8,6 +8,7 @@ import readline from 'node:readline';
|
||||
import { CoreEvent, coreEvents } from './events.js';
|
||||
import { FatalAuthenticationError } from './errors.js';
|
||||
import { createWorkingStdio, writeToStdout } from './stdio.js';
|
||||
import { isHeadlessMode } from './headless.js';
|
||||
|
||||
/**
|
||||
* Requests consent from the user for OAuth login.
|
||||
@@ -17,7 +18,7 @@ export async function getConsentForOauth(prompt: string): Promise<boolean> {
|
||||
const finalPrompt = prompt + ' Opening authentication page in your browser. ';
|
||||
|
||||
if (coreEvents.listenerCount(CoreEvent.ConsentRequest) === 0) {
|
||||
if (!process.stdin.isTTY) {
|
||||
if (isHeadlessMode()) {
|
||||
throw new FatalAuthenticationError(
|
||||
'Interactive consent could not be obtained.\n' +
|
||||
'Please run Gemini CLI in an interactive terminal to authenticate, or use NO_BROWSER=true for manual authentication.',
|
||||
|
||||
Reference in New Issue
Block a user