| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Load secrets from ./.env if the file exists |
| 4 | if [[ -f .env ]]; then |
| 5 | set -o allexport |
| 6 | source .env |
| 7 | set +o allexport |
| 8 | fi |
| 9 | |
| 10 | # Installs system dependencies required for this project |
| 11 | |
| 12 | UPDATE=0 |
| 13 | for arg in "$@"; do |
| 14 | if [[ "$arg" == "--update" ]]; then |
| 15 | UPDATE=1 |
| 16 | fi |
| 17 | done |
| 18 | |
| 19 | # Install or update OpenCode (AI-powered development) |
| 20 | if ! command -v opencode >/dev/null 2>&1 || [[ "$UPDATE" -eq 1 ]]; then |
| 21 | curl -fsSL https://opencode.ai/install | bash |
| 22 | fi |
| 23 | |
| 24 | install_brew() { |
| 25 | # $1: executable name |
| 26 | # $2: brew install argument |
| 27 | local exe="$1" |
| 28 | local formula="$2" |
| 29 | if ! command -v "$exe" >/dev/null 2>&1; then |
| 30 | brew install "$formula" |
| 31 | elif [[ "$UPDATE" -eq 1 ]]; then |
| 32 | brew upgrade "$formula" |
| 33 | fi |
| 34 | } |
| 35 | |
| 36 | install_brew rg ripgrep |
| 37 | install_brew localstack localstack/tap/localstack-cli |
| 38 | localstack auth set-token $LOCALSTACK_TOKEN 2>&1 > /dev/null |