feat(hooks): enable hooks system by default (#17247)

This commit is contained in:
Abhi
2026-01-21 17:40:31 -05:00
committed by GitHub
parent 3cca8ec0f0
commit 61040d0eb8
8 changed files with 7 additions and 12 deletions

View File

@@ -909,7 +909,7 @@ their corresponding top-level category object in your `settings.json` file.
- **`hooksConfig.enabled`** (boolean): - **`hooksConfig.enabled`** (boolean):
- **Description:** Canonical toggle for the hooks system. When disabled, no - **Description:** Canonical toggle for the hooks system. When disabled, no
hooks will be executed. hooks will be executed.
- **Default:** `false` - **Default:** `true`
- **`hooksConfig.disabled`** (array): - **`hooksConfig.disabled`** (array):
- **Description:** List of hook names (commands) that should be disabled. - **Description:** List of hook names (commands) that should be disabled.

View File

@@ -511,8 +511,5 @@ describe('migrate command', () => {
expect(debugLoggerLogSpy).toHaveBeenCalledWith( expect(debugLoggerLogSpy).toHaveBeenCalledWith(
'\nMigration complete! Please review the migrated hooks in .gemini/settings.json', '\nMigration complete! Please review the migrated hooks in .gemini/settings.json',
); );
expect(debugLoggerLogSpy).toHaveBeenCalledWith(
'Note: Set hooksConfig.enabled to true in your settings to enable the hook system.',
);
}); });
}); });

View File

@@ -244,9 +244,6 @@ export async function handleMigrateFromClaude() {
debugLogger.log( debugLogger.log(
'\nMigration complete! Please review the migrated hooks in .gemini/settings.json', '\nMigration complete! Please review the migrated hooks in .gemini/settings.json',
); );
debugLogger.log(
'Note: Set hooksConfig.enabled to true in your settings to enable the hook system.',
);
} catch (error) { } catch (error) {
debugLogger.error(`Error saving migrated hooks: ${getErrorMessage(error)}`); debugLogger.error(`Error saving migrated hooks: ${getErrorMessage(error)}`);
} }

View File

@@ -778,7 +778,7 @@ export async function loadCliConfig(
// TODO: loading of hooks based on workspace trust // TODO: loading of hooks based on workspace trust
enableHooks: enableHooks:
(settings.tools?.enableHooks ?? true) && (settings.tools?.enableHooks ?? true) &&
(settings.hooksConfig?.enabled ?? false), (settings.hooksConfig?.enabled ?? true),
enableHooksUI: settings.tools?.enableHooks ?? true, enableHooksUI: settings.tools?.enableHooks ?? true,
hooks: settings.hooks || {}, hooks: settings.hooks || {},
disabledHooks: settings.hooksConfig?.disabled || [], disabledHooks: settings.hooksConfig?.disabled || [],

View File

@@ -872,6 +872,7 @@ describe('extension tests', () => {
); );
const settings = loadSettings(tempWorkspaceDir).merged; const settings = loadSettings(tempWorkspaceDir).merged;
settings.hooksConfig.enabled = false;
extensionManager = new ExtensionManager({ extensionManager = new ExtensionManager({
workspaceDir: tempWorkspaceDir, workspaceDir: tempWorkspaceDir,

View File

@@ -1646,7 +1646,7 @@ const SETTINGS_SCHEMA = {
label: 'Enable Hooks', label: 'Enable Hooks',
category: 'Advanced', category: 'Advanced',
requiresRestart: false, requiresRestart: false,
default: false, default: true,
description: description:
'Canonical toggle for the hooks system. When disabled, no hooks will be executed.', 'Canonical toggle for the hooks system. When disabled, no hooks will be executed.',
showInDialog: false, showInDialog: false,

View File

@@ -685,7 +685,7 @@ export class Config {
? false ? false
: (params.useWriteTodos ?? true); : (params.useWriteTodos ?? true);
this.enableHooksUI = params.enableHooksUI ?? true; this.enableHooksUI = params.enableHooksUI ?? true;
this.enableHooks = params.enableHooks ?? false; this.enableHooks = params.enableHooks ?? true;
this.disabledHooks = params.disabledHooks ?? []; this.disabledHooks = params.disabledHooks ?? [];
this.codebaseInvestigatorSettings = { this.codebaseInvestigatorSettings = {

View File

@@ -1574,8 +1574,8 @@
"enabled": { "enabled": {
"title": "Enable Hooks", "title": "Enable Hooks",
"description": "Canonical toggle for the hooks system. When disabled, no hooks will be executed.", "description": "Canonical toggle for the hooks system. When disabled, no hooks will be executed.",
"markdownDescription": "Canonical toggle for the hooks system. When disabled, no hooks will be executed.\n\n- Category: `Advanced`\n- Requires restart: `no`\n- Default: `false`", "markdownDescription": "Canonical toggle for the hooks system. When disabled, no hooks will be executed.\n\n- Category: `Advanced`\n- Requires restart: `no`\n- Default: `true`",
"default": false, "default": true,
"type": "boolean" "type": "boolean"
}, },
"disabled": { "disabled": {