Skip to content

Instantly share code, notes, and snippets.

@torbbang
Created December 16, 2025 12:02
Show Gist options
  • Select an option

  • Save torbbang/584392f06ef5777bdd71d377c0a12f5d to your computer and use it in GitHub Desktop.

Select an option

Save torbbang/584392f06ef5777bdd71d377c0a12f5d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# set-agent: Interactively select a Vibe configuration directory
# Usage: source set-agent (or . set-agent)
# Check if script is being sourced
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "⚠️ This script must be sourced to set VIBE_HOME in your current shell."
echo "Usage: source set-agent"
echo " or: . set-agent"
exit 1
fi
ALT_CONFIGS_DIR="$HOME/.vibe/alt-configs"
if [[ ! -d "$ALT_CONFIGS_DIR" ]]; then
echo "❌ Error: $ALT_CONFIGS_DIR does not exist"
return 1
fi
# Get list of directories
configs=()
while IFS= read -r -d '' dir; do
configs+=("$(basename "$dir")")
done < <(find "$ALT_CONFIGS_DIR" -mindepth 1 -maxdepth 1 -type d -print0 | sort -z)
if [[ ${#configs[@]} -eq 0 ]]; then
echo "πŸ“­ No configurations found in $ALT_CONFIGS_DIR"
return 1
fi
# Add option to use default config
configs+=("default (~/.vibe)")
echo "πŸ”§ Available Vibe configurations:"
select config in "${configs[@]}"; do
if [[ -n "$config" ]]; then
if [[ "$config" == "default (~/.vibe)" ]]; then
unset VIBE_HOME
echo "✨ Using default Vibe configuration (~/.vibe)"
else
export VIBE_HOME="$ALT_CONFIGS_DIR/$config"
echo "πŸš€ VIBE_HOME set to: $VIBE_HOME"
fi
break
else
echo "❓ Invalid selection. Please try again."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment