fix: filter stale hooks check to gsd-prefixed files only (#1200)

gsd-check-update.js scanned ALL .js files in the hooks directory and
flagged any without a gsd-hook-version header as stale. This incorrectly
flagged user-created hooks (e.g. guard-edits-outside-project.js),
producing a persistent 'stale hooks' warning that /gsd:update couldn't
resolve.

Fix: filter hookFiles to f.startsWith('gsd-') && f.endsWith('.js')
since all GSD hooks follow the gsd-* naming convention.

Includes regression test validating the filter excludes user hooks.

Closes #1200
This commit is contained in:
Tom Boucher
2026-03-18 23:29:38 -04:00
parent 5fd384f336
commit 9ca03ec35e
2 changed files with 31 additions and 1 deletions

View File

@@ -70,7 +70,7 @@ const child = spawn(process.execPath, ['-e', `
const hooksDir = path.join(configDir, 'hooks');
try {
if (fs.existsSync(hooksDir)) {
const hookFiles = fs.readdirSync(hooksDir).filter(f => f.endsWith('.js'));
const hookFiles = fs.readdirSync(hooksDir).filter(f => f.startsWith('gsd-') && f.endsWith('.js'));
for (const hookFile of hookFiles) {
try {
const content = fs.readFileSync(path.join(hooksDir, hookFile), 'utf8');