From 2759afa57b381b0c86e3b83e6d0cd5c3c879dbe3 Mon Sep 17 00:00:00 2001 From: Colby McHenry Date: Thu, 21 May 2026 16:07:46 -0500 Subject: [PATCH] fix(dist): resolve symlinks in the bundle launcher (curl install was broken) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit install.sh symlinks ~/.local/bin/codegraph -> the bundle launcher, but the launcher derived its dir from $0, which is the symlink path — so it looked for `node` next to the symlink and failed with `exec: .../node: not found`. Follow the symlink chain to the real bundle dir first. (npm was unaffected — the shim invokes the launcher by absolute path.) Verified via the symlinked install path in a clean no-Node Linux container. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/build-bundle.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/build-bundle.sh b/scripts/build-bundle.sh index aa3cdce..a00f336 100755 --- a/scripts/build-bundle.sh +++ b/scripts/build-bundle.sh @@ -78,7 +78,17 @@ else cp "$NODE_BIN" "$STAGE/node" cat > "$STAGE/bin/codegraph" <<'LAUNCH' #!/bin/sh -DIR="$(cd "$(dirname "$0")/.." && pwd)" +# Resolve symlinks (e.g. the ~/.local/bin/codegraph link install.sh creates) so +# we find the real bundle dir, not the symlink's location. +SELF="$0" +while [ -L "$SELF" ]; do + target="$(readlink "$SELF")" + case "$target" in + /*) SELF="$target" ;; + *) SELF="$(dirname "$SELF")/$target" ;; + esac +done +DIR="$(cd "$(dirname "$SELF")/.." && pwd)" exec "$DIR/node" "$DIR/lib/dist/bin/codegraph.js" "$@" LAUNCH chmod +x "$STAGE/bin/codegraph"