From c987c408414bd601a5ade7771253b734402b54aa Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 14 Jan 2026 00:44:06 -0500 Subject: [PATCH] fix: respect XDG environment variables in install script Update install.sh to use XDG Base Directory Specification variables: - INSTALL_DIR: Use ${XDG_DATA_HOME:-$HOME/.local}/bin - CACHE_DIR: Use ${XDG_CACHE_HOME:-$HOME/.cache} for clearing plugin cache - OPENCODE_COMMANDS_DIR: Use ${XDG_CONFIG_HOME:-$HOME/.config}/opencode/command This ensures the install script works correctly in: - Portable OpenCode installations - Containerized environments - Any setup where XDG environment variables are configured Follows up on PR #72 which fixed the same issue in postinstall. --- scripts/install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index e4275773..772bdcce 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,7 +2,7 @@ set -e REPO="backnotprop/plannotator" -INSTALL_DIR="$HOME/.local/bin" +INSTALL_DIR="${XDG_DATA_HOME:-$HOME/.local}/bin" case "$(uname -s)" in Darwin) os="darwin" ;; @@ -73,7 +73,8 @@ if ! echo "$PATH" | tr ':' '\n' | grep -qx "$INSTALL_DIR"; then fi # Clear any cached OpenCode plugin to force fresh download on next run -rm -rf ~/.cache/opencode/node_modules/@plannotator ~/.bun/install/cache/@plannotator 2>/dev/null +CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}" +rm -rf "$CACHE_DIR/opencode/node_modules/@plannotator" "$HOME/.bun/install/cache/@plannotator" 2>/dev/null || true # Install /review slash command CLAUDE_COMMANDS_DIR="$HOME/.claude/commands" @@ -97,7 +98,7 @@ COMMAND_EOF echo "Installed /plannotator-review command to ${CLAUDE_COMMANDS_DIR}/plannotator-review.md" # Install OpenCode slash command -OPENCODE_COMMANDS_DIR="$HOME/.config/opencode/command" +OPENCODE_COMMANDS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/opencode/command" mkdir -p "$OPENCODE_COMMANDS_DIR" cat > "$OPENCODE_COMMANDS_DIR/plannotator-review.md" << 'COMMAND_EOF'