Add opencode installation to setup.sh

This commit is contained in:
2026-02-27 11:36:13 -05:00
parent 662952b755
commit 0d41bc9d71
2 changed files with 22 additions and 1 deletions

View File

@ -122,6 +122,19 @@ aur_install_if_possible() {
fi
}
install_opencode() {
if have opencode; then
log "opencode already installed"
return 0
fi
if have npm; then
log "Installing opencode via npm..."
npm install -g opencode-ai
else
log "Skipping opencode (npm not found)"
fi
}
ensure_brew() {
if have brew; then return 0; fi
log "Homebrew not found; installing Homebrew..."
@ -236,6 +249,8 @@ fedora)
log "Optional: Slack via Flatpak"
sudo flatpak install -y flathub com.slack.Slack || true
fi
install_opencode
;;
arch)
@ -249,6 +264,8 @@ arch)
pacman_install_best_effort "${ARCH_EXTRAS[@]}"
aur_install_if_possible google-chrome slack-desktop || true
install_opencode
;;
macos)
@ -265,6 +282,8 @@ macos)
log "Tip: run fzf install helper if you want keybindings/completion:"
echo " $(brew --prefix)/opt/fzf/install"
fi
install_opencode
;;
freebsd)

View File

@ -66,7 +66,9 @@ export GPG_TTY=$(tty)
load_keys &>/dev/null
# opencode
[[ -d "~/.opencode" ]] && export PATH=/Users/colin.powell/.opencode/bin:$PATH
[[ -d "$HOME/.npm-global" ]] && export PATH="$HOME/.npm-global/bin":$PATH
[[ -d "$HOME/.local/opencode/bin" ]] && export PATH="$HOME/.local/opencode/bin":$PATH
[[ -d "$HOME/.opencode/bin" ]] && export PATH="$HOME/.opencode/bin":$PATH
# See ~/.aliases for the various aliases seen in here
source "$HOME/.aliases"