fix(opencode): detect runtime config directory instead of hardcoding .claude
Three files had hardcoded `.claude` paths that break OpenCode and Gemini installations where the config directory is `.config/opencode`, `.opencode`, or `.gemini` respectively. Changes: - hooks/gsd-check-update.js: add detectConfigDir() helper that checks all runtime directories for get-shit-done/VERSION, falling back to .claude. Used for cache dir, project VERSION, and global VERSION. - commands/gsd/reapply-patches.md: detect runtime directory for both global and local patch directories instead of hardcoding ~/.claude/ and ./.claude/ - workflows/update.md: detect runtime directory for local and global VERSION/marker files, and clear cache across all runtime directories Closes #682 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,12 +9,25 @@ const { spawn } = require('child_process');
|
||||
|
||||
const homeDir = os.homedir();
|
||||
const cwd = process.cwd();
|
||||
const cacheDir = path.join(homeDir, '.claude', 'cache');
|
||||
|
||||
// Detect runtime config directory (supports Claude, OpenCode, Gemini)
|
||||
function detectConfigDir(baseDir) {
|
||||
for (const dir of ['.config/opencode', '.opencode', '.gemini', '.claude']) {
|
||||
if (fs.existsSync(path.join(baseDir, dir, 'get-shit-done', 'VERSION'))) {
|
||||
return path.join(baseDir, dir);
|
||||
}
|
||||
}
|
||||
return path.join(baseDir, '.claude');
|
||||
}
|
||||
|
||||
const globalConfigDir = detectConfigDir(homeDir);
|
||||
const projectConfigDir = detectConfigDir(cwd);
|
||||
const cacheDir = path.join(globalConfigDir, 'cache');
|
||||
const cacheFile = path.join(cacheDir, 'gsd-update-check.json');
|
||||
|
||||
// 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');
|
||||
const projectVersionFile = path.join(projectConfigDir, 'get-shit-done', 'VERSION');
|
||||
const globalVersionFile = path.join(globalConfigDir, 'get-shit-done', 'VERSION');
|
||||
|
||||
// Ensure cache directory exists
|
||||
if (!fs.existsSync(cacheDir)) {
|
||||
|
||||
Reference in New Issue
Block a user