@@ -6,44 +6,9 @@ if [ ! -x "${REAL_CLAUDE}" ]; then
66 if command -v claude-real > /dev/null 2>&1 ; then
77 REAL_CLAUDE=" $( command -v claude-real) "
88 else
9- echo " claude-real not found, cannot start persistent claude session ." >&2
9+ echo " claude-real not found, cannot start claude." >&2
1010 exit 127
1111 fi
1212fi
1313
14- # Non-interactive mode keeps the original behavior.
15- if [ " ${CLAUDE_NO_TMUX:- } " = " 1" ] || ! command -v tmux > /dev/null 2>&1 || [ ! -t 0 ] || [ ! -t 1 ]; then
16- exec " ${REAL_CLAUDE} " " $@ "
17- fi
18-
19- WORKDIR=" $( pwd -P) "
20- HASH=" $( printf ' %s' " ${WORKDIR} " | sha1sum | awk ' {print $1}' ) "
21- SESSION=" claude_${HASH: 0: 12} "
22-
23- build_cmd () {
24- local quoted
25- printf -v quoted ' %q ' " ${REAL_CLAUDE} " " $@ "
26- printf ' %s' " ${quoted% } "
27- }
28-
29- CMD=" $( build_cmd " $@ " ) "
30-
31- if tmux has-session -t " ${SESSION} " 2> /dev/null; then
32- if [ -n " ${TMUX:- } " ]; then
33- CURRENT=" $( tmux display-message -p ' #S' 2> /dev/null || true) "
34- if [ " ${CURRENT} " = " ${SESSION} " ]; then
35- echo " Already attached to ${SESSION} (${WORKDIR} )" >&2
36- exit 0
37- fi
38- exec tmux switch-client -t " ${SESSION} "
39- fi
40- exec tmux attach -t " ${SESSION} "
41- fi
42-
43- tmux new-session -d -s " ${SESSION} " -c " ${WORKDIR} " " ${CMD} "
44- tmux set-option -t " ${SESSION} " destroy-unattached off > /dev/null 2>&1 || true
45-
46- if [ -n " ${TMUX:- } " ]; then
47- exec tmux switch-client -t " ${SESSION} "
48- fi
49- exec tmux attach -t " ${SESSION} "
14+ exec " ${REAL_CLAUDE} " " $@ "
0 commit comments