#!/usr/bin/env bash # sx-fix-down.sh — stop the sx-fix tmux session (and optionally remove worktrees). # Usage: ./scripts/sx-fix-down.sh [--clean] # --clean also `git worktree remove` every /root/rose-ash-loops/sx-* worktree # Commits on loops/sx-* branches are preserved either way (branches are not deleted). set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT" SESSION="sx-fix" if tmux has-session -t "$SESSION" 2>/dev/null; then tmux kill-session -t "$SESSION" echo "killed tmux session '$SESSION'." else echo "no tmux session '$SESSION'." fi if [ "${1:-}" = "--clean" ]; then for wt in /root/rose-ash-loops/sx-*; do [ -d "$wt" ] || continue git worktree remove --force "$wt" 2>/dev/null && echo "removed worktree $wt" || echo "skip $wt" done echo "branches loops/sx-* are kept (commits preserved)." fi