fix(hooks): update check now finds VERSION in local project installs (#166)
The update check script always looked for VERSION in ~/.claude/get-shit-done/, but GSD can be installed locally in ./.claude/get-shit-done/. This caused false "update available" notifications when using local installations. Changes: - Check project directory first, then fall back to global - Remove unused execSync import
This commit is contained in:
@@ -5,12 +5,16 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const { execSync, spawn } = require('child_process');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
const homeDir = os.homedir();
|
||||
const cwd = process.cwd();
|
||||
const cacheDir = path.join(homeDir, '.claude', 'cache');
|
||||
const cacheFile = path.join(cacheDir, 'gsd-update-check.json');
|
||||
const versionFile = path.join(homeDir, '.claude', 'get-shit-done', 'VERSION');
|
||||
|
||||
// VERSION file locations (check project first, then global)
|
||||
const projectVersionFile = path.join(cwd, '.claude', 'get-shit-done', 'VERSION');
|
||||
const globalVersionFile = path.join(homeDir, '.claude', 'get-shit-done', 'VERSION');
|
||||
|
||||
// Ensure cache directory exists
|
||||
if (!fs.existsSync(cacheDir)) {
|
||||
@@ -23,11 +27,17 @@ const child = spawn(process.execPath, ['-e', `
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
const cacheFile = ${JSON.stringify(cacheFile)};
|
||||
const versionFile = ${JSON.stringify(versionFile)};
|
||||
const projectVersionFile = ${JSON.stringify(projectVersionFile)};
|
||||
const globalVersionFile = ${JSON.stringify(globalVersionFile)};
|
||||
|
||||
// Check project directory first (local install), then global
|
||||
let installed = '0.0.0';
|
||||
try {
|
||||
installed = fs.readFileSync(versionFile, 'utf8').trim();
|
||||
if (fs.existsSync(projectVersionFile)) {
|
||||
installed = fs.readFileSync(projectVersionFile, 'utf8').trim();
|
||||
} else if (fs.existsSync(globalVersionFile)) {
|
||||
installed = fs.readFileSync(globalVersionFile, 'utf8').trim();
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
let latest = null;
|
||||
|
||||
Reference in New Issue
Block a user