diff options
| author | user <user@clank> | 2026-07-22 19:41:01 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-12 19:34:35 +0200 |
| commit | 252bc1d37abf66c8aea8adfa6cb3826429ed96e4 (patch) | |
| tree | 913e01bdc97584752defffb527ecb1259ab6cdd7 /pi-ext | |
| parent | Add dev.sh: run pi with only this repo's extensions (isolated) (diff) | |
| download | sl0ppi-252bc1d37abf66c8aea8adfa6cb3826429ed96e4.tar.gz sl0ppi-252bc1d37abf66c8aea8adfa6cb3826429ed96e4.tar.xz sl0ppi-252bc1d37abf66c8aea8adfa6cb3826429ed96e4.zip | |
Add install.sh: copy extensions into global pi extensions dir
Diffstat (limited to 'pi-ext')
| -rwxr-xr-x | pi-ext/install.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pi-ext/install.sh b/pi-ext/install.sh new file mode 100755 index 0000000..a93a498 --- /dev/null +++ b/pi-ext/install.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# install.sh - copy this repo's extensions into the global pi extensions dir. +# +# Copies (does not symlink) every *.ts here into ~/.pi/agent/extensions so the +# global set is a deliberate snapshot, not live-linked to in-progress dev edits. +# After installing, use /reload inside a running pi session to pick them up. +# +# Override the target dir with PI_EXT_DIR, e.g: +# PI_EXT_DIR=~/.config/pi/agent/extensions ./install.sh +# +# Flags: +# -n, --dry-run show what would be copied without writing +set -euo pipefail + +cd "$(dirname "$0")" + +DEST="${PI_EXT_DIR:-$HOME/.pi/agent/extensions}" + +dry_run=0 +case "${1:-}" in + -n|--dry-run) dry_run=1 ;; + "") ;; + *) echo "install.sh: unknown arg '$1'" >&2; exit 2 ;; +esac + +shopt -s nullglob +files=(*.ts) +shopt -u nullglob + +if [ "${#files[@]}" -eq 0 ]; then + echo "install.sh: no *.ts extensions found in $(pwd)" >&2 + exit 1 +fi + +if [ "$dry_run" -eq 1 ]; then + echo "Would install ${#files[@]} extension(s) into: $DEST" + for f in "${files[@]}"; do echo " $f"; done + exit 0 +fi + +mkdir -p "$DEST" +for f in "${files[@]}"; do + cp "$f" "$DEST/$f" + echo "installed $f -> $DEST/$f" +done + +echo +echo "Done. Run /reload in a pi session (or restart pi) to load them." |
