fix(#3329): reconcile stale managed .sh hook commands on install/update (#3460)

* fix(#3329): reconcile stale managed .sh hook commands on install/update

applySettingsJsonHooks registers the four .sh managed hooks only-if-absent,
so entries registered before the #580/#3393 shellHookOmitsBashRunner fix kept
their bash-runner-prefixed commands forever — /gsd-update re-invokes the
installer but never re-derived existing entries. Add
reconcileManagedShellHookCommands (wired into applySettingsJsonHooks): on
win32+claude it rewrites existing managed .sh entries to the command this
install would generate today, scoped to exact managed basenames so
user-authored hooks are untouched, and inert wherever the bash runner is
still the correct shape.

Also bumps the allow-test-rule ceiling 301→302: PR #3455 added
tests/milestone-lock.test.cjs (the 302nd marked file) without the ratchet
bump, leaving lint-tests red on next.

* chore(#3329): add changeset fragment

* chore(#3329): backfill changeset pr number 3460

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-14 10:55:12 -04:00
committed by GitHub
parent 5452f1a700
commit 8bbb3eaabc
4 changed files with 312 additions and 0 deletions

View File

@@ -1106,6 +1106,15 @@ function rewriteLegacyManagedNodeHookCommands(settings, absoluteRunner, opts) {
return hooksSurface.rewriteLegacyManagedNodeHookCommands(settings, absoluteRunner, opts);
}
// #3329: rewrite already-registered managed `.sh` hook commands to the shape
// the current installer would generate (the #580/#3393 bash-runner-omission
// migration the register-only-if-absent path never applied to existing
// entries). Invoked inside applySettingsJsonHooks in the compiled surface
// module; re-bound here for tests/consumers, mirroring the #2979 rewriter.
function reconcileManagedShellHookCommands(settings, expected, opts) {
return hooksSurface.reconcileManagedShellHookCommands(settings, expected, opts);
}
/**
* Build the GSD-managed Codex SessionStart hook block for config.toml.
*
@@ -13784,6 +13793,7 @@ module.exports = {
referencesHook,
applySettingsJsonHooks,
rewriteLegacyManagedNodeHookCommands,
reconcileManagedShellHookCommands,
buildCodexHookBlock,
rewriteLegacyCodexHookBlock,
buildCodexHookWindowsShimIR,