mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 10:10:56 -07:00
fix(hooks): support 'ask' decision for BeforeTool hooks (#21146)
This commit is contained in:
committed by
GitHub
parent
d3766875f8
commit
d1dc4902fd
@@ -11,7 +11,6 @@ import os from 'node:os';
|
||||
import * as Diff from 'diff';
|
||||
import { WRITE_FILE_TOOL_NAME, WRITE_FILE_DISPLAY_NAME } from './tool-names.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { ApprovalMode } from '../policy/types.js';
|
||||
|
||||
import {
|
||||
BaseDeclarativeTool,
|
||||
@@ -156,7 +155,16 @@ class WriteFileToolInvocation extends BaseToolInvocation<
|
||||
toolName?: string,
|
||||
displayName?: string,
|
||||
) {
|
||||
super(params, messageBus, toolName, displayName);
|
||||
super(
|
||||
params,
|
||||
messageBus,
|
||||
toolName,
|
||||
displayName,
|
||||
undefined,
|
||||
undefined,
|
||||
true,
|
||||
() => this.config.getApprovalMode(),
|
||||
);
|
||||
this.resolvedPath = path.resolve(
|
||||
this.config.getTargetDir(),
|
||||
this.params.file_path,
|
||||
@@ -186,10 +194,6 @@ class WriteFileToolInvocation extends BaseToolInvocation<
|
||||
protected override async getConfirmationDetails(
|
||||
abortSignal: AbortSignal,
|
||||
): Promise<ToolCallConfirmationDetails | false> {
|
||||
if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const correctedContentResult = await getCorrectedFileContent(
|
||||
this.config,
|
||||
this.resolvedPath,
|
||||
|
||||
Reference in New Issue
Block a user