fix(hooks): respect CLAUDE_CONFIG_DIR for custom config directories
Hooks hardcode ~/.claude/ as the config directory, breaking setups where Claude Code uses a custom config directory (e.g. multi-account with CLAUDE_CONFIG_DIR=~/.claude-personal/). The update check hook shows stale notifications and the statusline reads from wrong paths. - gsd-check-update.js: check CLAUDE_CONFIG_DIR before filesystem scan - gsd-statusline.js: use CLAUDE_CONFIG_DIR for todos and cache paths Closes #870 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
Lex Christopherson
parent
7554503b42
commit
90e7d30839
@@ -11,13 +11,19 @@ const homeDir = os.homedir();
|
|||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
|
|
||||||
// Detect runtime config directory (supports Claude, OpenCode, Gemini)
|
// Detect runtime config directory (supports Claude, OpenCode, Gemini)
|
||||||
|
// Respects CLAUDE_CONFIG_DIR for custom config directory setups
|
||||||
function detectConfigDir(baseDir) {
|
function detectConfigDir(baseDir) {
|
||||||
|
// Check env override first (supports multi-account setups)
|
||||||
|
const envDir = process.env.CLAUDE_CONFIG_DIR;
|
||||||
|
if (envDir && fs.existsSync(path.join(envDir, 'get-shit-done', 'VERSION'))) {
|
||||||
|
return envDir;
|
||||||
|
}
|
||||||
for (const dir of ['.config/opencode', '.opencode', '.gemini', '.claude']) {
|
for (const dir of ['.config/opencode', '.opencode', '.gemini', '.claude']) {
|
||||||
if (fs.existsSync(path.join(baseDir, dir, 'get-shit-done', 'VERSION'))) {
|
if (fs.existsSync(path.join(baseDir, dir, 'get-shit-done', 'VERSION'))) {
|
||||||
return path.join(baseDir, dir);
|
return path.join(baseDir, dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return path.join(baseDir, '.claude');
|
return envDir || path.join(baseDir, '.claude');
|
||||||
}
|
}
|
||||||
|
|
||||||
const globalConfigDir = detectConfigDir(homeDir);
|
const globalConfigDir = detectConfigDir(homeDir);
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ process.stdin.on('end', () => {
|
|||||||
// Current task from todos
|
// Current task from todos
|
||||||
let task = '';
|
let task = '';
|
||||||
const homeDir = os.homedir();
|
const homeDir = os.homedir();
|
||||||
const todosDir = path.join(homeDir, '.claude', 'todos');
|
// Respect CLAUDE_CONFIG_DIR for custom config directory setups (#870)
|
||||||
|
const claudeDir = process.env.CLAUDE_CONFIG_DIR || path.join(homeDir, '.claude');
|
||||||
|
const todosDir = path.join(claudeDir, 'todos');
|
||||||
if (session && fs.existsSync(todosDir)) {
|
if (session && fs.existsSync(todosDir)) {
|
||||||
try {
|
try {
|
||||||
const files = fs.readdirSync(todosDir)
|
const files = fs.readdirSync(todosDir)
|
||||||
@@ -90,7 +92,7 @@ process.stdin.on('end', () => {
|
|||||||
|
|
||||||
// GSD update available?
|
// GSD update available?
|
||||||
let gsdUpdate = '';
|
let gsdUpdate = '';
|
||||||
const cacheFile = path.join(homeDir, '.claude', 'cache', 'gsd-update-check.json');
|
const cacheFile = path.join(claudeDir, 'cache', 'gsd-update-check.json');
|
||||||
if (fs.existsSync(cacheFile)) {
|
if (fs.existsSync(cacheFile)) {
|
||||||
try {
|
try {
|
||||||
const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
|
const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
|
||||||
|
|||||||
Reference in New Issue
Block a user