Added install dir priority & user feedback (#1129)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: thdxr <thdxr@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot] 2025-07-18 14:15:10 -04:00 committed by GitHub
parent 611854e4b6
commit 01e7dc2d02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 1 deletions

14
install
View file

@ -41,9 +41,21 @@ case "$filename" in
;;
esac
INSTALL_DIR=$HOME/.opencode/bin
# Determine installation directory with priority order
if [ -n "${OPENCODE_INSTALL_DIR:-}" ]; then
INSTALL_DIR="$OPENCODE_INSTALL_DIR"
elif [ -n "${XDG_BIN_DIR:-}" ]; then
INSTALL_DIR="$XDG_BIN_DIR"
elif [ -d "$HOME/bin" ] || mkdir -p "$HOME/bin" 2>/dev/null; then
INSTALL_DIR="$HOME/bin"
else
INSTALL_DIR="$HOME/.opencode/bin"
fi
mkdir -p "$INSTALL_DIR"
print_message info "Installing to: ${YELLOW}$INSTALL_DIR${GREEN}"
if [ -z "$requested_version" ]; then
url="https://github.com/sst/opencode/releases/latest/download/$filename"
specific_version=$(curl -s https://api.github.com/repos/sst/opencode/releases/latest | awk -F'"' '/"tag_name": "/ {gsub(/^v/, "", $4); print $4}')