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:
Tibsfox
2026-02-28 05:40:27 -08:00
parent 1c58e84eb3
commit 77dfd2e068
3 changed files with 58 additions and 17 deletions

View File

@@ -14,11 +14,24 @@ After a GSD update wipes and reinstalls files, this command merges user's previo
Check for local patches directory:
```bash
# Global install (path templated at install time)
PATCHES_DIR=~/.claude/gsd-local-patches
# Local install fallback
# Global install — detect runtime config directory
if [ -d "$HOME/.config/opencode/gsd-local-patches" ]; then
PATCHES_DIR="$HOME/.config/opencode/gsd-local-patches"
elif [ -d "$HOME/.opencode/gsd-local-patches" ]; then
PATCHES_DIR="$HOME/.opencode/gsd-local-patches"
elif [ -d "$HOME/.gemini/gsd-local-patches" ]; then
PATCHES_DIR="$HOME/.gemini/gsd-local-patches"
else
PATCHES_DIR="$HOME/.claude/gsd-local-patches"
fi
# Local install fallback — check all runtime directories
if [ ! -d "$PATCHES_DIR" ]; then
PATCHES_DIR=./.claude/gsd-local-patches
for dir in .config/opencode .opencode .gemini .claude; do
if [ -d "./$dir/gsd-local-patches" ]; then
PATCHES_DIR="./$dir/gsd-local-patches"
break
fi
done
fi
```