dev_sandbox/entrypoint.sh
2026-05-13 20:54:14 -04:00

30 lines
1.1 KiB
Bash

#!/bin/zsh
# Wire up Pi config from the workspace bind mount.
#
# Why: ~/.pi holds both config (settings, skills, themes, extensions) AND hot
# runtime state (sessions, logs). We want to persist/commit the config via the
# workspace, but keep sessions on the container's native FS so agent turns
# aren't bottlenecked by virtiofs.
#
# Strategy: keep /root/.pi on native FS, and symlink only the config entries
# out to /workspace/dev_sandbox/.pi/agent/*.
PI_SRC="/workspace/dev_sandbox/.pi/agent"
PI_DST="/root/.pi/agent"
if [[ -d "$PI_SRC" ]]; then
mkdir -p "$PI_DST" "$PI_DST/sessions"
# Entries to persist from the workspace (add more here as needed).
# Note: auth.json is intentionally omitted — credentials stay on the
# named volume only, not in the committed workspace.
for entry in settings.json bin extensions skills themes prompt-templates agents.toml config.toml; do
src="$PI_SRC/$entry"
dst="$PI_DST/$entry"
if [[ -e "$src" ]]; then
# Replace whatever is at dst with a symlink to the workspace copy.
rm -rf "$dst"
ln -sf "$src" "$dst"
fi
done
fi
exec "$@"