From aed4d24ae702475676de332029a33975cc20e00f Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 20 May 2026 14:37:08 -0700 Subject: [PATCH] Default tmcodex to unix remote --- dotfiles/lib/functions/tmcodex | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dotfiles/lib/functions/tmcodex b/dotfiles/lib/functions/tmcodex index fd14fa73..3b93724e 100644 --- a/dotfiles/lib/functions/tmcodex +++ b/dotfiles/lib/functions/tmcodex @@ -24,6 +24,19 @@ function _tmcodex_resolve_dir { cd -- "$dir" && pwd -P } +function _tmcodex_has_remote_arg { + while [ "$#" -gt 0 ]; do + case "$1" in + --remote|--remote=*) + return 0 + ;; + esac + shift + done + + return 1 +} + function tmcodex { launch_dir="$PWD" @@ -69,7 +82,11 @@ function tmcodex { ( cd -- "$launch_dir" || exit - trw codex --dangerously-bypass-approvals-and-sandbox --cd "$launch_dir" "$@" + if _tmcodex_has_remote_arg "$@"; then + trw codex --dangerously-bypass-approvals-and-sandbox --cd "$launch_dir" "$@" + else + trw codex --remote "${TMCODEX_REMOTE:-unix://}" --dangerously-bypass-approvals-and-sandbox --cd "$launch_dir" "$@" + fi ) }