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>main
parent
b56587f26e
commit
f648aae440
|
|
@ -16,6 +16,7 @@ import {
|
||||||
type NormalizedPluginsConfig,
|
type NormalizedPluginsConfig,
|
||||||
} from "./config-state.js";
|
} from "./config-state.js";
|
||||||
import { initializeGlobalHookRunner } from "./hook-runner-global.js";
|
import { initializeGlobalHookRunner } from "./hook-runner-global.js";
|
||||||
|
import { clearPluginCommands } from "./commands.js";
|
||||||
import { createPluginRegistry, type PluginRecord, type PluginRegistry } from "./registry.js";
|
import { createPluginRegistry, type PluginRecord, type PluginRegistry } from "./registry.js";
|
||||||
import { createPluginRuntime } from "./runtime/index.js";
|
import { createPluginRuntime } from "./runtime/index.js";
|
||||||
import { setActivePluginRegistry } from "./runtime.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 runtime = createPluginRuntime();
|
||||||
const { registry, createApi } = createPluginRegistry({
|
const { registry, createApi } = createPluginRegistry({
|
||||||
logger,
|
logger,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue