mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
feat(core): Ensure all properties in hooks object are event names. (#16870)
This commit is contained in:
@@ -1841,7 +1841,7 @@ describe('Hooks configuration', () => {
|
||||
debugMode: false,
|
||||
model: 'test-model',
|
||||
cwd: '.',
|
||||
hooks: { disabled: ['initial-hook'] },
|
||||
disabledHooks: ['initial-hook'],
|
||||
};
|
||||
|
||||
it('updateDisabledHooks should update the disabled list', () => {
|
||||
|
||||
@@ -379,10 +379,9 @@ export interface ConfigParameters {
|
||||
enableHooks?: boolean;
|
||||
enableHooksUI?: boolean;
|
||||
experiments?: Experiments;
|
||||
hooks?: { [K in HookEventName]?: HookDefinition[] } & { disabled?: string[] };
|
||||
projectHooks?: { [K in HookEventName]?: HookDefinition[] } & {
|
||||
disabled?: string[];
|
||||
};
|
||||
hooks?: { [K in HookEventName]?: HookDefinition[] };
|
||||
disabledHooks?: string[];
|
||||
projectHooks?: { [K in HookEventName]?: HookDefinition[] };
|
||||
previewFeatures?: boolean;
|
||||
enableAgents?: boolean;
|
||||
enableEventDrivenScheduler?: boolean;
|
||||
@@ -680,10 +679,7 @@ export class Config {
|
||||
: (params.useWriteTodos ?? true);
|
||||
this.enableHooksUI = params.enableHooksUI ?? true;
|
||||
this.enableHooks = params.enableHooks ?? false;
|
||||
this.disabledHooks =
|
||||
(params.hooks && 'disabled' in params.hooks
|
||||
? params.hooks.disabled
|
||||
: undefined) ?? [];
|
||||
this.disabledHooks = params.disabledHooks ?? [];
|
||||
|
||||
this.codebaseInvestigatorSettings = {
|
||||
enabled: params.codebaseInvestigatorSettings?.enabled ?? true,
|
||||
@@ -724,8 +720,7 @@ export class Config {
|
||||
this.disableYoloMode = params.disableYoloMode ?? false;
|
||||
|
||||
if (params.hooks) {
|
||||
const { disabled: _, ...restOfHooks } = params.hooks;
|
||||
this.hooks = restOfHooks;
|
||||
this.hooks = params.hooks;
|
||||
}
|
||||
if (params.projectHooks) {
|
||||
this.projectHooks = params.projectHooks;
|
||||
@@ -1993,9 +1988,7 @@ export class Config {
|
||||
/**
|
||||
* Get project-specific hooks configuration
|
||||
*/
|
||||
getProjectHooks():
|
||||
| ({ [K in HookEventName]?: HookDefinition[] } & { disabled?: string[] })
|
||||
| undefined {
|
||||
getProjectHooks(): { [K in HookEventName]?: HookDefinition[] } | undefined {
|
||||
return this.projectHooks;
|
||||
}
|
||||
|
||||
|
||||
@@ -279,8 +279,8 @@ describe('HookSystem Integration', () => {
|
||||
],
|
||||
},
|
||||
],
|
||||
disabled: ['echo "disabled-hook"'], // Disable the second hook
|
||||
},
|
||||
disabledHooks: ['echo "disabled-hook"'], // Disable the second hook
|
||||
});
|
||||
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user