feat(hooks): Hook Configuration Schema and Types (#9074)

Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
This commit is contained in:
Edilmo Palencia
2025-11-02 11:49:16 -08:00
committed by GitHub
parent 02518d2927
commit c0495ce2f9
5 changed files with 217 additions and 2 deletions
+24
View File
@@ -14,6 +14,8 @@ import type {
BugCommandSettings,
TelemetrySettings,
AuthType,
HookDefinition,
HookEventName,
} from '@google/gemini-cli-core';
import {
DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
@@ -878,6 +880,16 @@ const SETTINGS_SCHEMA = {
'Enable policy-based tool confirmation via message bus integration. When enabled, tools will automatically respect policy engine decisions (ALLOW/DENY/ASK_USER) without requiring individual tool implementations.',
showInDialog: true,
},
enableHooks: {
type: 'boolean',
label: 'Enable Hooks System',
category: 'Advanced',
requiresRestart: true,
default: false,
description:
'Enable the hooks system for intercepting and customizing Gemini CLI behavior. When enabled, hooks configured in settings will execute at appropriate lifecycle events (BeforeTool, AfterTool, BeforeModel, etc.). Requires MessageBus integration.',
showInDialog: false,
},
},
},
@@ -1199,6 +1211,18 @@ const SETTINGS_SCHEMA = {
},
},
},
hooks: {
type: 'object',
label: 'Hooks',
category: 'Advanced',
requiresRestart: false,
default: {} as { [K in HookEventName]?: HookDefinition[] },
description:
'Hook configurations for intercepting and customizing agent behavior.',
showInDialog: false,
mergeStrategy: MergeStrategy.SHALLOW_MERGE,
},
} as const satisfies SettingsSchema;
export type SettingsSchemaType = typeof SETTINGS_SCHEMA;