#!/usr/bin/env bash # dev.sh - run pi with ONLY this repo's extensions (isolated from the global set). # # -ne / --no-extensions disables auto-discovery of ~/.pi/agent/extensions and # project-local .pi/extensions, so the stable global set keeps running other # sessions untouched. Each *.ts here is then loaded explicitly via -e. # # Any extra args are passed through to pi, e.g: ./dev.sh --mode rpc set -euo pipefail cd "$(dirname "$0")" # Extensions to skip loading in dev too (experimental / broken / opt-in). EXCLUDE=" sixel-images.ts " args=(-ne) shopt -s nullglob for f in *.ts; do case "$EXCLUDE" in *" $f "*) continue ;; esac args+=(-e "./$f") done shopt -u nullglob if [ "${#args[@]}" -eq 1 ]; then echo "dev.sh: no *.ts extensions found in $(pwd)" >&2 exit 1 fi # -ne disables package discovery too, so globally-installed pi packages # (pi-subagents, pi-goal, pi-autoresearch, ...) wouldn't load their tools. Re-add # each package's extension entry via -e so they work alongside our dev copies. # Their skills/prompts still load (separate -ns/-np gates, which we don't pass). # Skip some with e.g. PI_DEV_SKIP_PACKAGES="pi-goal,pi-autoresearch". if command -v node >/dev/null 2>&1; then while IFS= read -r extpath; do [ -n "$extpath" ] && args+=(-e "$extpath") done < <(node "$(dirname "$0")/scripts/resolve-package-extensions.mjs" 2>/dev/null || true) fi exec pi "${args[@]}" "$@"