mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-26 23:03:31 +02:00
25 lines
710 B
Bash
25 lines
710 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [ -z "${HOME:-}" ]; then
|
|
echo "Claude terminal: HOME is not initialized." >&2
|
|
exit 1
|
|
fi
|
|
|
|
export SHELL="/bin/bash"
|
|
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
|
|
|
workspace="${CLAUDE_TERMINAL_WORKSPACE:-${HOME}/workspace}"
|
|
session_name="${CLAUDE_TMUX_SESSION:-claude}"
|
|
|
|
if [ ! -d "$workspace" ]; then
|
|
echo "Claude terminal: workspace does not exist: $workspace" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cd -- "$workspace"
|
|
|
|
# Reattach every browser connection to the same terminal session. Closing the browser detaches
|
|
# the client but leaves Claude Code and other commands running inside tmux.
|
|
exec tmux new-session -A -s "$session_name" -c "$workspace"
|