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:
Tibsfox
2026-03-27 11:26:06 -07:00
parent 1421dc07bc
commit 9ef71b0b70
3 changed files with 16 additions and 13 deletions

View File

@@ -92,8 +92,12 @@ process.stdin.on('end', () => {
}
// GSD update available?
// Check shared cache first (#1421), fall back to runtime-specific cache for
// backward compatibility with older gsd-check-update.js versions.
let gsdUpdate = '';
const cacheFile = path.join(claudeDir, 'cache', 'gsd-update-check.json');
const sharedCacheFile = path.join(homeDir, '.cache', 'gsd', 'gsd-update-check.json');
const legacyCacheFile = path.join(claudeDir, 'cache', 'gsd-update-check.json');
const cacheFile = fs.existsSync(sharedCacheFile) ? sharedCacheFile : legacyCacheFile;
if (fs.existsSync(cacheFile)) {
try {
const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));