feat(hooks): add support for friendly names and descriptions (#15174)

This commit is contained in:
Abhi
2025-12-18 11:09:24 -05:00
committed by GitHub
parent 7da060c149
commit 54466a3ea8
14 changed files with 300 additions and 17 deletions
@@ -309,6 +309,24 @@ describe('hooksCommand', () => {
content: 'Failed to enable hook: Failed to save settings',
});
});
it('should complete hook names using friendly names', () => {
const enableCmd = hooksCommand.subCommands!.find(
(cmd) => cmd.name === 'enable',
)!;
const hookEntry = createMockHook(
'./hooks/test.sh',
HookEventName.BeforeTool,
true,
);
hookEntry.config.name = 'friendly-name';
mockHookSystem.getAllHooks.mockReturnValue([hookEntry]);
const completions = enableCmd.completion!(mockContext, 'frie');
expect(completions).toContain('friendly-name');
});
});
describe('disable subcommand', () => {
+1 -1
View File
@@ -213,7 +213,7 @@ function completeHookNames(
* Get a display name for a hook
*/
function getHookDisplayName(hook: HookRegistryEntry): string {
return hook.config.command || 'unknown-hook';
return hook.config.name || hook.config.command || 'unknown-hook';
}
const panelCommand: SlashCommand = {