MCPcopy
hub / github.com/ZToolsCenter/ZTools / reloadPluginCommands

Function reloadPluginCommands

src/renderer/src/stores/commandDataStore.ts:673–694  ·  view source on GitHub ↗

* 仅重新加载插件相关指令,不重新获取系统应用。 * 用于插件安装/卸载/启用/禁用等场景,避免触发系统应用扫描。

()

Source from the content-addressed store, hash-verified

671 * 用于插件安装/卸载/启用/禁用等场景,避免触发系统应用扫描。
672 */
673 async function reloadPluginCommands(): Promise<void> {
674 try {
675 const [plugins, disabledPlugins, disabledMainPushPlugins, commandAliases] = await Promise.all(
676 [
677 window.ztools.getAllPlugins(),
678 window.ztools.getDisabledPlugins(),
679 window.ztools.dbGet(DISABLED_MAIN_PUSH_PLUGINS_KEY),
680 loadCommandAliases()
681 ]
682 )
683 setDisabledPluginPaths(disabledPlugins)
684 disabledMainPushPluginNames.value = normalizeConfigList(disabledMainPushPlugins)
685 const enabledPluginPaths = getEnabledPluginPaths(plugins)
686 enabledPluginsCache.value = plugins.filter((plugin: any) =>
687 enabledPluginPaths.has(plugin.path)
688 )
689
690 rebuildCommandCollections(commandAliases)
691 } catch (error) {
692 console.error('[PluginCommands] 重载插件指令失败:', error)
693 }
694 }
695
696 async function reloadCommandAliases(): Promise<void> {
697 try {

Callers 1

Calls 8

normalizeConfigListFunction · 0.90
loadCommandAliasesFunction · 0.85
setDisabledPluginPathsFunction · 0.85
getEnabledPluginPathsFunction · 0.85
getAllPluginsMethod · 0.80
getDisabledPluginsMethod · 0.80
dbGetMethod · 0.45

Tested by

no test coverage detected