From 63af9af0f48b664f94d2acd239fb1e395c302b95 Mon Sep 17 00:00:00 2001 From: Elliot Drel <2superfirebolt@gmail.com> Date: Mon, 16 Mar 2026 23:49:34 -0400 Subject: [PATCH] fix: track hook files in manifest for local patch detection (#769) Hook files (gsd-statusline.js, gsd-check-update.js, gsd-context-monitor.js) are installed during updates but were never included in gsd-file-manifest.json. This means saveLocalPatches() could not detect user modifications to hooks, causing them to be silently overwritten on update with no backup. Add hooks/gsd-*.js to writeManifest() so the existing local patch detection system automatically backs up modified hooks to gsd-local-patches/ before overwriting, matching the behavior already in place for workflows, commands, and agents. Co-Authored-By: Claude Opus 4.6 (1M context) --- bin/install.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/install.js b/bin/install.js index cff9bb5f8..c2ee9aee3 100755 --- a/bin/install.js +++ b/bin/install.js @@ -2314,6 +2314,18 @@ function writeManifest(configDir, runtime = 'claude') { } } } + // Track hook files so saveLocalPatches() can detect user modifications + // Hooks are only installed for runtimes that use settings.json (not Codex/Copilot) + if (!isCodex && !isCopilot) { + const hooksDir = path.join(configDir, 'hooks'); + if (fs.existsSync(hooksDir)) { + for (const file of fs.readdirSync(hooksDir)) { + if (file.startsWith('gsd-') && file.endsWith('.js')) { + manifest.files['hooks/' + file] = fileHash(path.join(hooksDir, file)); + } + } + } + } fs.writeFileSync(path.join(configDir, MANIFEST_NAME), JSON.stringify(manifest, null, 2)); return manifest;