#!/bin/sh
# tssh <host>
#
# Interactive ssh that auto-attaches to (or creates) a per-user tmux session
# on the remote, so transport drops don't kill your shell.
#
# Detach with Ctrl-b d. Reattach by re-running this command.
# Session name: claude-$LOCAL_USER on the remote box.

set -eu

if [ $# -lt 1 ]; then
    echo "usage: $0 <host>" >&2
    exit 2
fi

host=$1
session="claude-$(whoami)"

exec ssh -t "$host" "tmux new-session -A -s '${session}'"
