fix(install): replace compgen with bash-3.2-portable glob check

compgen is unreliable on bash 3.2 (macOS stock). Replace with a simple
for-loop over the glob plus a file-existence test that breaks early.
This commit is contained in:
Parfii-bot 2026-04-21 03:48:28 +08:00
parent 5fa4bb9777
commit f04c9f38da

View file

@ -197,7 +197,12 @@ done
say " copied $copied, skipped $skipped (already present)"
# --- copy template ---------------------------------------------------------
if compgen -G "$KIT_DIR/_templates/*.template" >/dev/null; then
# bash-3.2-portable glob detection: iterate, break on first hit.
has_templates=0
for t in "$KIT_DIR/_templates/"*.template; do
[ -f "$t" ] && { has_templates=1; break; }
done
if [ "$has_templates" = "1" ]; then
say "copying specialist template"
backup_dir "$AGENTS_DIR/_templates"
cp -f "$KIT_DIR/_templates/"*.template "$AGENTS_DIR/_templates/"