From 2f2f1845f7f6a3e2bea7aa83d0bc70e740a622b6 Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Wed, 15 Apr 2026 11:07:00 +0200 Subject: [PATCH] fix(source): resolve symlink before computing SCRIPT_DIR When gsd-from-source is invoked via a symlink (e.g. ~/.bun/bin/gsd-real pointing at it so `gsd` resolves to source without further indirection), BASH_SOURCE[0] is the symlink path, not the real file. The previous dirname-of-BASH_SOURCE[0] approach resolved SCRIPT_DIR to the symlink's parent dir (e.g. ~/.bun/bin) and tried to bun-run ~/.bun/src/loader.ts, which doesn't exist. Wrapping BASH_SOURCE[0] in readlink -f resolves the physical path first, so SCRIPT_DIR always points at bin/ inside the gsd source checkout regardless of how the script is reached. Co-Authored-By: Claude Opus 4.6 (1M context) --- bin/gsd-from-source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/gsd-from-source b/bin/gsd-from-source index c1310f887..6c9b4bd68 100755 --- a/bin/gsd-from-source +++ b/bin/gsd-from-source @@ -16,7 +16,7 @@ # Requirements: bun on PATH, node_modules populated (`bun install` once). set -euo pipefail -SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +SCRIPT_DIR=$(cd -- "$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")" &>/dev/null && pwd) GSD_SOURCE_ROOT=$(cd -- "$SCRIPT_DIR/.." &>/dev/null && pwd) export GSD_BIN_PATH="$SCRIPT_DIR/gsd-from-source"