#!/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 AGENTS.md; 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 # Global gitignore lives on the host at ~/.gitignore_global, symlinked from # the host into the workspace at /workspace/dev_sandbox/.gitignore_global. # Mirror it to /root/.gitignore_global so git's --system core.excludesfile # (set in the Dockerfile) resolves. Symlink so host edits apply immediately. GITIGNORE_SRC="/workspace/dev_sandbox/.gitignore_global" GITIGNORE_DST="/root/.gitignore_global" if [[ -e "$GITIGNORE_SRC" ]]; then rm -f "$GITIGNORE_DST" ln -sf "$GITIGNORE_SRC" "$GITIGNORE_DST" fi exec "$@"