fix: clear plugin commands on reload to prevent duplicates

Add clearPluginCommands() call in loadClawdbotPlugins() to ensure
previously registered commands are cleaned up before reloading plugins.
This prevents command conflicts during hot-reload scenarios.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Glucksberg 2026-01-23 12:43:39 +00:00 committed by Peter Steinberger
parent 691adccf32
commit b16576f298

View File

@ -16,6 +16,7 @@ import {
type NormalizedPluginsConfig,
} from "./config-state.js";
import { initializeGlobalHookRunner } from "./hook-runner-global.js";
import { clearPluginCommands } from "./commands.js";
import { createPluginRegistry, type PluginRecord, type PluginRegistry } from "./registry.js";
import { createPluginRuntime } from "./runtime/index.js";
import { setActivePluginRegistry } from "./runtime.js";
@ -178,6 +179,9 @@ export function loadClawdbotPlugins(options: PluginLoadOptions = {}): PluginRegi
}
}
// Clear previously registered plugin commands before reloading
clearPluginCommands();
const runtime = createPluginRuntime();
const { registry, createApi } = createPluginRegistry({
logger,