From 9065abdca63c2d74732ddb266c18c59f3600bfef Mon Sep 17 00:00:00 2001 From: Natalie Date: Sun, 17 May 2026 03:31:04 -0700 Subject: [PATCH] =?UTF-8?q?feat(@scripts):=20=E2=9C=A8=20update=20remote?= =?UTF-8?q?=20mirroring=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- bin/rclaude | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/bin/rclaude b/bin/rclaude index f4e22cc..9ebeeab 100755 --- a/bin/rclaude +++ b/bin/rclaude @@ -20,10 +20,15 @@ # Usage: # rclaude # local, $PWD # rclaude . # local, $PWD -# rclaude # remote $HOME on +# rclaude # remote: $PWD mirrored under remote $HOME +# rclaude . # same as above (explicit form) # rclaude # remote (or local) at # rclaude list # show active sessions across hosts # rclaude resume [pattern] # reattach (interactive if pattern matches >1) +# +# Mirror semantics: if local $PWD is $HOME/X/Y, the remote dir defaults to +# ~/X/Y on the remote (the remote's $HOME, not $HOME from this machine). +# If $PWD is outside $HOME, falls back to the remote's $HOME. set -eu @@ -221,11 +226,16 @@ if is_local "$host"; then .|"") dir=$PWD ;; esac else - if [ "$dir" = "." ]; then - echo "error: '.' as dir requires a local target; pass an explicit remote path" >&2 - exit 2 + # Remote default: mirror local $PWD relative to $HOME onto the remote's + # $HOME. Same behavior for omitted dir or explicit `.`. Falls back to + # remote $HOME if local $PWD isn't under $HOME. + if [ "$dir" = "." ] || [ -z "$dir" ]; then + case $PWD in + "$HOME") dir=\~ ;; + "$HOME"/*) _rel=${PWD#"$HOME"/}; dir="~/$_rel" ;; + *) dir=\~ ;; + esac fi - [ -z "$dir" ] && dir=\~ fi slug=$(printf %s "$dir" | sed -e 's|^[~/]*||' -e 's|[^A-Za-z0-9]|-|g')