fix(install): preserve non-array hook entries during uninstall (#1824)
* fix(install): preserve non-array hook entries during uninstall Uninstall filtering returned null for hook entries without a hooks array, silently deleting user-owned entries with unexpected shapes. Return the entry unchanged instead so only GSD hooks are removed. * test(install): add regression test for non-array hook entry preservation (#1825) Fix mirrored filterGsdHooks helper to match production code and add test proving non-array hook entries survive uninstall filtering.
This commit is contained in:
@@ -4432,7 +4432,7 @@ function uninstall(isGlobal, runtime = 'claude') {
|
||||
const before = JSON.stringify(settings.hooks[eventName]);
|
||||
settings.hooks[eventName] = settings.hooks[eventName]
|
||||
.map(entry => {
|
||||
if (!entry.hooks || !Array.isArray(entry.hooks)) return null;
|
||||
if (!entry.hooks || !Array.isArray(entry.hooks)) return entry;
|
||||
// Filter out individual GSD hooks, keep user hooks
|
||||
entry.hooks = entry.hooks.filter(h => !isGsdHookCommand(h.command));
|
||||
return entry.hooks.length > 0 ? entry : null;
|
||||
|
||||
Reference in New Issue
Block a user