diff --git a/.agents/scripts/auto-update-helper.sh b/.agents/scripts/auto-update-helper.sh index 984ecb435..8d3d63bb0 100755 --- a/.agents/scripts/auto-update-helper.sh +++ b/.agents/scripts/auto-update-helper.sh @@ -26,7 +26,21 @@ set -euo pipefail -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +# Resolve symlinks to find real script location (t1262) +# When invoked via symlink (e.g. ~/.aidevops/bin/aidevops-auto-update), +# BASH_SOURCE[0] is the symlink path. We must resolve it to find sibling scripts. +_resolve_script_path() { + local src="${BASH_SOURCE[0]}" + while [[ -L "$src" ]]; do + local dir + dir="$(cd "$(dirname "$src")" && pwd)" || return 1 + src="$(readlink "$src")" + [[ "$src" != /* ]] && src="$dir/$src" + done + cd "$(dirname "$src")" && pwd +} +SCRIPT_DIR="$(_resolve_script_path)" || exit +unset -f _resolve_script_path source "${SCRIPT_DIR}/shared-constants.sh" init_log_file diff --git a/.agents/scripts/supervisor-helper.sh b/.agents/scripts/supervisor-helper.sh index e226eb664..a7b4a5aea 100755 --- a/.agents/scripts/supervisor-helper.sh +++ b/.agents/scripts/supervisor-helper.sh @@ -164,8 +164,22 @@ if [[ -z "${GH_TOKEN:-}" ]]; then fi unset _gh_token_cache -# Configuration - resolve relative to this script's location -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit +# Configuration - resolve relative to this script's real location (not symlink) +# When invoked via symlink (e.g. ~/.aidevops/bin/aidevops-supervisor-pulse), +# BASH_SOURCE[0] is the symlink path. We must resolve it to find sibling scripts. +_resolve_script_path() { + local src="${BASH_SOURCE[0]}" + while [[ -L "$src" ]]; do + local dir + dir="$(cd "$(dirname "$src")" && pwd)" || return 1 + src="$(readlink "$src")" + # Handle relative symlinks + [[ "$src" != /* ]] && src="$dir/$src" + done + cd "$(dirname "$src")" && pwd +} +SCRIPT_DIR="$(_resolve_script_path)" || exit +unset -f _resolve_script_path readonly SCRIPT_DIR source "${SCRIPT_DIR}/shared-constants.sh"