diff --git a/bin/rclaude b/bin/rclaude index 375b63d..0bc63ad 100755 --- a/bin/rclaude +++ b/bin/rclaude @@ -212,9 +212,27 @@ if is_local "$host"; then echo "rclaude: tmux not installed locally — install via 'brew install tmux' (macOS) or your package manager" >&2 exit 1 fi - cd "$dir" + if ! cd "$dir" 2>/dev/null; then + echo "rclaude: local directory not found: $dir" >&2 + exit 1 + fi exec tmux new-session -A -s "$session" "exec claude --continue ${flag}" fi +# Remote: pre-flight the directory on the remote host so a typo or missing +# path fails loudly here instead of silently killing the tmux pane and +# closing the ssh transport (which looks like a generic "connection closed" +# error to the user). +if ! ssh -o BatchMode=yes -o ConnectTimeout=5 "$host" "test -d ${dir}" 2>/dev/null; then + echo "rclaude: directory not found on $host: $dir" >&2 + case $dir in + *@proj/*|*@apps/*|*@pkg/*) + echo " hint: '@proj/@apps/@pkg' are Claude-instruction aliases, not real shell paths." >&2 + echo " See ~/.claude/instructions/project-paths.md for the real ~/Code// mapping." >&2 + ;; + esac + exit 1 +fi + inner="cd ${dir} && exec claude --continue ${flag}" exec ssh -t "$host" "tmux new-session -A -s '${session}' \"${inner}\""