feat: Add --yolo mode that automatically accepts all tools executions (#695)

Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Tolik Malibroda
2025-06-02 22:05:45 +02:00
committed by GitHub
parent 42bedbc3d3
commit 0795e55f0e
15 changed files with 364 additions and 156 deletions

View File

@@ -22,6 +22,12 @@ import { ReadManyFilesTool } from '../tools/read-many-files.js';
import { MemoryTool, setGeminiMdFilename } from '../tools/memoryTool.js';
import { WebSearchTool } from '../tools/web-search.js';
export enum ApprovalMode {
DEFAULT = 'default',
AUTO_EDIT = 'autoEdit',
YOLO = 'yolo',
}
export class MCPServerConfig {
constructor(
// For stdio transport
@@ -53,7 +59,7 @@ export interface ConfigParameters {
userAgent: string;
userMemory?: string;
geminiMdFileCount?: number;
alwaysSkipModificationConfirmation?: boolean;
approvalMode?: ApprovalMode;
vertexai?: boolean;
showMemoryUsage?: boolean;
contextFileName?: string;
@@ -76,7 +82,7 @@ export class Config {
private readonly userAgent: string;
private userMemory: string;
private geminiMdFileCount: number;
private alwaysSkipModificationConfirmation: boolean;
private approvalMode: ApprovalMode;
private readonly vertexai: boolean | undefined;
private readonly showMemoryUsage: boolean;
@@ -96,8 +102,7 @@ export class Config {
this.userAgent = params.userAgent;
this.userMemory = params.userMemory ?? '';
this.geminiMdFileCount = params.geminiMdFileCount ?? 0;
this.alwaysSkipModificationConfirmation =
params.alwaysSkipModificationConfirmation ?? false;
this.approvalMode = params.approvalMode ?? ApprovalMode.DEFAULT;
this.vertexai = params.vertexai;
this.showMemoryUsage = params.showMemoryUsage ?? false;
@@ -179,12 +184,12 @@ export class Config {
this.geminiMdFileCount = count;
}
getAlwaysSkipModificationConfirmation(): boolean {
return this.alwaysSkipModificationConfirmation;
getApprovalMode(): ApprovalMode {
return this.approvalMode;
}
setAlwaysSkipModificationConfirmation(skip: boolean): void {
this.alwaysSkipModificationConfirmation = skip;
setApprovalMode(mode: ApprovalMode): void {
this.approvalMode = mode;
}
getVertexAI(): boolean | undefined {