fix: scope hooks to DevDesk's tmux and reload env per Claude launch (0.2.1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,9 +10,18 @@ set -uo pipefail
|
||||
NAME=$(dd_current_session)
|
||||
[ -n "$NAME" ] || dd_die "not running inside a DevDesk session"
|
||||
|
||||
CLAUDE_BIN=${CLAUDE_BIN:-claude}
|
||||
SETTINGS="$DEVDESK_SHARE/claude-settings.json"
|
||||
read -r -a EXTRA <<<"${CLAUDE_ARGS:-}"
|
||||
|
||||
# Re-read /etc/devdesk/env before every Claude launch, so changes (Remote
|
||||
# Control, CLAUDE_ARGS, …) apply on the next restart of Claude in a session.
|
||||
reload_config() {
|
||||
if [ -r "$DEVDESK_ENV" ]; then
|
||||
# shellcheck source=/dev/null
|
||||
. "$DEVDESK_ENV"
|
||||
fi
|
||||
CLAUDE_BIN=${CLAUDE_BIN:-claude}
|
||||
read -r -a EXTRA <<<"${CLAUDE_ARGS:-}"
|
||||
}
|
||||
|
||||
ORANGE=$'\033[38;2;255;107;0m'
|
||||
CYAN=$'\033[38;2;0;212;255m'
|
||||
@@ -66,6 +75,7 @@ printf '\033]2;%s\033\134' "$NAME" # pane title (ST = ESC \\)
|
||||
mode=resume
|
||||
while :; do
|
||||
NAME=$(dd_current_session) # follow renames
|
||||
reload_config
|
||||
if [ "$mode" = new ]; then run_new; else run_resume; fi
|
||||
rc=$?
|
||||
NAME=$(dd_current_session)
|
||||
|
||||
@@ -152,8 +152,10 @@ dd_resolve_dir() {
|
||||
# Name of the DevDesk session this process runs in. Asks tmux, so it stays
|
||||
# right after a rename; falls back to the DEVDESK_SESSION set at creation.
|
||||
dd_current_session() {
|
||||
local name=""
|
||||
if [ -n "${TMUX:-}" ] && [ -n "${TMUX_PANE:-}" ]; then
|
||||
local name="" outer=${TMUX:-}
|
||||
# Only DevDesk's own tmux server: a Claude started with these settings in
|
||||
# some other tmux must not write into DevDesk's state.
|
||||
if [ "${outer%%,*}" = "$DEVDESK_SOCKET" ] && [ -n "${TMUX_PANE:-}" ]; then
|
||||
name=$(tmux display-message -p -t "$TMUX_PANE" '#S' 2>/dev/null)
|
||||
fi
|
||||
printf '%s\n' "${name:-${DEVDESK_SESSION:-}}"
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
|
||||
input=$(cat)
|
||||
|
||||
session=""
|
||||
if [ -n "${TMUX:-}" ] && [ -n "${TMUX_PANE:-}" ]; then
|
||||
# Only record for panes on DevDesk's own tmux server.
|
||||
session="" outer=${TMUX:-}
|
||||
if [ "${outer%%,*}" = "${DEVDESK_SOCKET:-/run/devdesk/tmux.sock}" ] && [ -n "${TMUX_PANE:-}" ]; then
|
||||
session=$(tmux display-message -p -t "$TMUX_PANE" '#S' 2>/dev/null)
|
||||
session=${session:-${DEVDESK_SESSION:-}}
|
||||
fi
|
||||
session=${session:-${DEVDESK_SESSION:-}}
|
||||
|
||||
if [[ $session =~ ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$ ]]; then
|
||||
dir="${DEVDESK_STATE_DIR:-/var/lib/devdesk}/context"
|
||||
|
||||
Reference in New Issue
Block a user