fix(hooks): use shared cache dir and correct stale hooks path
Two fixes for multi-runtime installations: 1. Update cache now writes to ~/.cache/gsd/ instead of the runtime- specific config dir, preventing mismatches when check-update and statusline resolve to different runtimes. Statusline reads from shared path first with legacy fallback. 2. Stale hooks detection now checks configDir/hooks/ where hooks are actually installed, not configDir/get-shit-done/hooks/ which does not exist. Closes #1421 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -996,19 +996,15 @@ describe('stale hook filter', () => {
|
||||
// ─── stale hook path regression (#1249) ──────────────────────────────────────
|
||||
|
||||
describe('stale hook path', () => {
|
||||
test('gsd-check-update.js checks get-shit-done/hooks/ not configDir/hooks/', () => {
|
||||
test('gsd-check-update.js checks configDir/hooks/ where hooks are actually installed (#1421)', () => {
|
||||
const content = fs.readFileSync(
|
||||
path.join(__dirname, '..', 'hooks', 'gsd-check-update.js'), 'utf-8'
|
||||
);
|
||||
// Hooks are installed at configDir/hooks/ (e.g. ~/.claude/hooks/),
|
||||
// not configDir/get-shit-done/hooks/ which doesn't exist (#1421)
|
||||
assert.ok(
|
||||
content.includes("path.join(configDir, 'get-shit-done', 'hooks')"),
|
||||
'stale hook check must look in configDir/get-shit-done/hooks/, not configDir/hooks/'
|
||||
);
|
||||
assert.ok(
|
||||
!content.includes("path.join(configDir, 'hooks')") ||
|
||||
content.indexOf("path.join(configDir, 'get-shit-done', 'hooks')") <
|
||||
content.indexOf("path.join(configDir, 'hooks')") + 100, // allow the old pattern only if corrected version exists first
|
||||
'should not use the wrong hooks path'
|
||||
content.includes("path.join(configDir, 'hooks')"),
|
||||
'stale hook check must look in configDir/hooks/ where hooks are actually installed'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user