From 75dbbbbaecf1dc8a852b37e1bcb98eaea2251c20 Mon Sep 17 00:00:00 2001 From: shahondin1624 Date: Fri, 24 Apr 2026 06:34:09 +0200 Subject: [PATCH] install-mechanicus: glob-based sync, include shared/ --- scripts/install-mechanicus.sh | 73 ++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/scripts/install-mechanicus.sh b/scripts/install-mechanicus.sh index 8c65f09..345aa3e 100755 --- a/scripts/install-mechanicus.sh +++ b/scripts/install-mechanicus.sh @@ -1,18 +1,14 @@ #!/usr/bin/env bash # -# install-mechanicus.sh — Install only the Dark Mechanicus theme and its -# flavouring extensions into ~/.pi/agent/. No certs, no ai-server provider, -# no ssh setup — just the TUI paint job. +# install-mechanicus.sh — Install the Dark Mechanicus theme and every +# flavouring extension in the repo into ~/.pi/agent/. No certs, no +# ai-server provider, no ssh setup — just the TUI paint job. # -# Syncs: -# themes/dark-mechanicus.json -> ~/.pi/agent/themes/ -# mechanicus-banner.ts -> ~/.pi/agent/extensions/ -# mechanicus-footer.ts -> ~/.pi/agent/extensions/ -# mechanicus-status-line.ts -> ~/.pi/agent/extensions/ -# mechanicus-session-names.ts -> ~/.pi/agent/extensions/ -# mechanicus-thinking-label.ts -> ~/.pi/agent/extensions/ -# dark-mechanicus-indicator.ts -> ~/.pi/agent/extensions/ -# markdown-body-color.ts -> ~/.pi/agent/extensions/ +# What "flavouring" means here: every top-level *.ts file in the repo +# EXCEPT the provider extensions (ai-server/, local-llama.ts), plus the +# shared/ utilities they import from, plus themes/. Using a glob (not a +# hardcoded list) so new flavour extensions dropped at the repo root +# are picked up automatically. # # Usage: # scripts/install-mechanicus.sh [options] @@ -25,6 +21,9 @@ set -euo pipefail PI_DIR="${PI_DIR:-$HOME/.pi/agent}" ACTIVATE=0 +# Top-level *.ts files that are NOT flavouring extensions — skip these. +EXCLUDE_EXTS=(local-llama.ts) + usage() { sed -n '2,/^$/p' "$0" | sed 's/^#\{0,1\} \{0,1\}//'; exit 0; } while [[ $# -gt 0 ]]; do @@ -39,17 +38,7 @@ done REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$REPO_ROOT" -[[ -f themes/dark-mechanicus.json ]] || { echo "Run from a checked-out pi-extensions repo (themes/dark-mechanicus.json not found)" >&2; exit 1; } - -EXTS=( - mechanicus-banner.ts - mechanicus-footer.ts - mechanicus-status-line.ts - mechanicus-session-names.ts - mechanicus-thinking-label.ts - dark-mechanicus-indicator.ts - markdown-body-color.ts -) +[[ -d themes && -f themes/dark-mechanicus.json ]] || { echo "Run from a checked-out pi-extensions repo (themes/dark-mechanicus.json not found)" >&2; exit 1; } echo "==> Dark Mechanicus install" echo " repo root: $REPO_ROOT" @@ -57,22 +46,34 @@ echo " pi dir: $PI_DIR" mkdir -p "$PI_DIR/themes" "$PI_DIR/extensions" -echo; echo "==> Syncing theme" -rsync -a themes/dark-mechanicus.json "$PI_DIR/themes/" -echo " dark-mechanicus.json installed" +echo; echo "==> Syncing themes" +rsync -a themes/ "$PI_DIR/themes/" +echo " $(ls themes/*.json 2>/dev/null | wc -l) theme file(s) installed" -echo; echo "==> Syncing extensions" -missing=() -for f in "${EXTS[@]}"; do - if [[ -f "$f" ]]; then - rsync -a "$f" "$PI_DIR/extensions/" - echo " $f" - else - missing+=("$f") +echo; echo "==> Syncing flavouring extensions" +shopt -s nullglob +synced=0 +for f in *.ts; do + skip=0 + for ex in "${EXCLUDE_EXTS[@]}"; do + [[ "$f" == "$ex" ]] && skip=1 && break + done + if [[ $skip -eq 1 ]]; then + echo " (skipping provider: $f)" + continue fi + rsync -a "$f" "$PI_DIR/extensions/" + echo " $f" + synced=$((synced + 1)) done -if [[ ${#missing[@]} -gt 0 ]]; then - echo " missing in repo (skipped): ${missing[*]}" >&2 +shopt -u nullglob +echo " $synced flavouring extension(s) installed" + +if [[ -d shared ]]; then + rsync -a --delete shared "$PI_DIR/extensions/" + echo " shared/ ($(ls shared/*.ts 2>/dev/null | wc -l) file(s))" +else + echo " shared/ dir missing in repo — flavouring extensions will fail to load" >&2 fi if [[ $ACTIVATE -eq 1 ]]; then