Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,4 @@ gha-creds-*.json

# IDEs
.idea
package-lock.json
11 changes: 6 additions & 5 deletions registry/rothnic/modules/opencode/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

# Load any existing PATH customizations
source "$HOME"/.bashrc 2>/dev/null || true
source "$HOME"/.bashrc 2> /dev/null || true

command_exists() {
command -v "$1" > /dev/null 2>&1
Expand Down Expand Up @@ -60,7 +60,7 @@ install_nodejs() {
export NPM_CONFIG_CACHE="$npm_cache_dir"

# Persist PATH + npm cache so start.sh and future shells see it
if ! grep -q "node-v${NODE_VERSION}-${node_distro}/bin" "$HOME/.bashrc" 2>/dev/null; then
if ! grep -q "node-v${NODE_VERSION}-${node_distro}/bin" "$HOME/.bashrc" 2> /dev/null; then
{
echo "export PATH=\"${node_dir}/bin:\$HOME/.local/bin:\$PATH\""
echo "export NPM_CONFIG_CACHE=\"${npm_cache_dir}\""
Expand All @@ -84,9 +84,10 @@ install_opencode() {
if ! command_exists opencode; then
echo "Installing OpenCode via npm (version: ${ARG_OPENCODE_VERSION})..."

npm config set prefix "$HOME/.local" >/dev/null 2>&1 || true
# Use environment variable instead of npm config to avoid .npmrc conflicts with nvm
export NPM_CONFIG_PREFIX="$HOME/.local"

if ! grep -q 'PATH="$HOME/.local/bin:$PATH"' "$HOME/.bashrc" 2>/dev/null; then
if ! grep -q 'PATH="$HOME/.local/bin:$PATH"' "$HOME/.bashrc" 2> /dev/null; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc"
fi

Expand Down Expand Up @@ -122,7 +123,7 @@ check_github_authentication() {
if command_exists coder; then
if coder external-auth access-token "${ARG_EXTERNAL_AUTH_ID:-github}" > /dev/null 2>&1; then
local t
t=$(coder external-auth access-token "${ARG_EXTERNAL_AUTH_ID:-github}" 2>/dev/null || echo "")
t=$(coder external-auth access-token "${ARG_EXTERNAL_AUTH_ID:-github}" 2> /dev/null || echo "")
if [ -n "$t" ] && [ "$t" != "null" ]; then
export GITHUB_TOKEN="$t"
export GH_TOKEN="$t"
Expand Down