MCPcopy
hub / github.com/codeaashu/claude-code / setupPluginHookHotReload

Function setupPluginHookHotReload

src/utils/plugins/loadPluginHooks.ts:255–287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

253 * actually changed.
254 */
255export function setupPluginHookHotReload(): void {
256 if (hotReloadSubscribed) {
257 return
258 }
259 hotReloadSubscribed = true
260
261 // Capture the initial snapshot so the first policySettings change can compare
262 lastPluginSettingsSnapshot = getPluginAffectingSettingsSnapshot()
263
264 settingsChangeDetector.subscribe(source => {
265 if (source === 'policySettings') {
266 const newSnapshot = getPluginAffectingSettingsSnapshot()
267 if (newSnapshot === lastPluginSettingsSnapshot) {
268 logForDebugging(
269 'Plugin hooks: skipping reload, plugin-affecting settings unchanged',
270 )
271 return
272 }
273
274 lastPluginSettingsSnapshot = newSnapshot
275 logForDebugging(
276 'Plugin hooks: reloading due to plugin-affecting settings change',
277 )
278
279 // Clear all plugin-related caches
280 clearPluginCache('loadPluginHooks: plugin-affecting settings changed')
281 clearPluginHookCache()
282
283 // Reload hooks (fire-and-forget, don't block)
284 void loadPluginHooks()
285 }
286 })
287}
288

Callers 1

runFunction · 0.85

Calls 5

logForDebuggingFunction · 0.85
clearPluginCacheFunction · 0.85
clearPluginHookCacheFunction · 0.85
loadPluginHooksFunction · 0.85

Tested by

no test coverage detected