Skip to content
Merged
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
15 changes: 14 additions & 1 deletion src/jtag
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@
# JTAG Terminal Portal - Pure CLI client (no server startup)
# Uses pre-bundled CLI for fast startup (~0.6s vs ~2.6s with tsx)

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Resolve symlinks BEFORE deriving SCRIPT_DIR. install.sh's
# mod_jtag_bin_link symlinks $HOME/.local/bin/jtag → src/jtag, so when
# Carl runs `jtag …`, BASH_SOURCE[0] is the symlink path
# (~/.local/bin/jtag) and dirname is ~/.local/bin — neither
# `dist/cli-bundle.js` nor `cli.ts` lives there, so the bundle check
# silently misses and the tsx fallback fires `npx tsx
# ~/.local/bin/cli.ts` which dies with ERR_MODULE_NOT_FOUND.
# `readlink -f` walks the symlink chain to the actual src/jtag, so
# SCRIPT_DIR resolves to the real src/ directory regardless of how
# the user invoked the script.
# Caught 2026-05-03 by carl-install-smoke on Windows/bigmama-1
# (continuum-b69f) after #93's earlier fix at 36e85d212 only handled
# direct `./jtag` invocations, not the symlinked-from-PATH case.
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
BUNDLE="$SCRIPT_DIR/dist/cli-bundle.js"

# Check for --verbose flag to show connection message
Expand Down
Loading