mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 20:50:34 +00:00
refactor hookregisry and add test
This commit is contained in:
parent
1b88ed7c40
commit
872e16505b
3 changed files with 659 additions and 5 deletions
|
|
@ -174,11 +174,12 @@ const enableCommand: SlashCommand = {
|
|||
const registry = hookSystem.getRegistry();
|
||||
const allHooks = registry.getAllHooks();
|
||||
|
||||
// Return disabled hooks for enable command
|
||||
return allHooks
|
||||
// Return disabled hooks for enable command (deduplicated by name)
|
||||
const disabledHookNames = allHooks
|
||||
.filter((hook) => !hook.enabled)
|
||||
.map((hook) => hook.config.name || hook.config.command || '')
|
||||
.filter((name) => name && name.startsWith(partialArg));
|
||||
return [...new Set(disabledHookNames)];
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -242,11 +243,12 @@ const disableCommand: SlashCommand = {
|
|||
const registry = hookSystem.getRegistry();
|
||||
const allHooks = registry.getAllHooks();
|
||||
|
||||
// Return enabled hooks for disable command
|
||||
return allHooks
|
||||
// Return enabled hooks for disable command (deduplicated by name)
|
||||
const enabledHookNames = allHooks
|
||||
.filter((hook) => hook.enabled)
|
||||
.map((hook) => hook.config.name || hook.config.command || '')
|
||||
.filter((name) => name && name.startsWith(partialArg));
|
||||
return [...new Set(enabledHookNames)];
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue