Stable PASEO_HOME for worktrees and shared speech models in dev.sh

Worktrees get a persistent ~/.paseo-<name> home instead of a temp dir.
Speech models point at ~/.paseo/models/local-speech to avoid re-downloads.
This commit is contained in:
Mohamed Boudra
2026-04-10 10:29:34 +07:00
parent 201eb6a671
commit 34bd8dfd1b

View File

@@ -5,17 +5,34 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PATH="$SCRIPT_DIR/../node_modules/.bin:$PATH"
# Use a temporary PASEO_HOME to avoid conflicts between dev instances
# Derive PASEO_HOME: stable name for worktrees, temporary dir otherwise
if [ -z "${PASEO_HOME}" ]; then
export PASEO_HOME
PASEO_HOME="$(mktemp -d "${TMPDIR:-/tmp}/paseo-dev.XXXXXX")"
trap "rm -rf '$PASEO_HOME'" EXIT
GIT_DIR="$(git rev-parse --git-dir 2>/dev/null || true)"
GIT_COMMON_DIR="$(git rev-parse --git-common-dir 2>/dev/null || true)"
if [ -n "$GIT_DIR" ] && [ -n "$GIT_COMMON_DIR" ] && [ "$GIT_DIR" != "$GIT_COMMON_DIR" ]; then
# Inside a worktree — derive a stable home from the worktree name
WORKTREE_ROOT="$(git rev-parse --show-toplevel)"
WORKTREE_NAME="$(basename "$WORKTREE_ROOT" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g; s/--*/-/g; s/^-//; s/-$//')"
PASEO_HOME="$HOME/.paseo-${WORKTREE_NAME}"
mkdir -p "$PASEO_HOME"
else
PASEO_HOME="$(mktemp -d "${TMPDIR:-/tmp}/paseo-dev.XXXXXX")"
trap "rm -rf '$PASEO_HOME'" EXIT
fi
fi
# Share speech models with the main install to avoid duplicate downloads
if [ -z "${PASEO_LOCAL_MODELS_DIR}" ]; then
export PASEO_LOCAL_MODELS_DIR="$HOME/.paseo/models/local-speech"
mkdir -p "$PASEO_LOCAL_MODELS_DIR"
fi
echo "══════════════════════════════════════════════════════"
echo " Paseo Dev"
echo "══════════════════════════════════════════════════════"
echo " Home: ${PASEO_HOME}"
echo " Models: ${PASEO_LOCAL_MODELS_DIR}"
echo "══════════════════════════════════════════════════════"
# Configure the daemon for the Portless app origin and let the app bootstrap