automa/install.sh
m1ngsama e5542de818 polish: CLI UX overhaul and rich .env.example metadata
CLI improvements:
- Unicode status indicators (✔ ✘ ▶ ● ○ ⚠) and braille spinners
- Animated spinner for docker pull/up operations
- Project metadata parsed from .env.example (@name, @desc, @url, @port, @note)
- Descriptions shown in list, deploy selection, and status views
- Auto-generate passwords for secret fields (PASSWORD/TOKEN/AUTHKEY)
- Confirmation prompt before deploy with project summary
- Post-deploy access URL hint based on @port metadata
- Divider lines for visual section separation
- Helpful error messages with suggested commands
- Command aliases: ls, st, ps, down, log, configure
- Bash 3.2 compatible (no associative arrays)

.env.example enrichment:
- All projects now have @name, @desc, @url, @port metadata headers
- Inline field descriptions shown as context during interactive config
- Tailscale: @note hints for profile-based DERP deployment
- Structured comments group related settings visually

Installer:
- Prerequisite check with per-tool status (✔/✘)
- Quieter git operations
- Cleaner post-install instructions
2026-04-15 10:15:43 +08:00

66 lines
1.6 KiB
Bash
Executable file

#!/usr/bin/env bash
# automa installer
# Usage: curl -fsSL https://raw.githubusercontent.com/m1ngsama/automa/main/install.sh | bash
set -euo pipefail
REPO="https://github.com/m1ngsama/automa.git"
INSTALL_DIR="${AUTOMA_DIR:-$HOME/automa}"
RED='\033[0;31m' GREEN='\033[0;32m' CYAN='\033[0;36m'
BOLD='\033[1m' DIM='\033[2m' NC='\033[0m'
info() { echo -e " ${GREEN}\xe2\x9c\x94${NC} $*"; }
error() { echo -e " ${RED}\xe2\x9c\x98${NC} $*" >&2; }
step() { echo -e " ${CYAN}\xe2\x96\xb6${NC} ${BOLD}$*${NC}"; }
echo ""
echo -e " ${BOLD}${CYAN}automa${NC}${BOLD} installer${NC}"
echo ""
# Check prerequisites
missing=0
for cmd in git docker; do
if command -v "$cmd" &>/dev/null; then
info "$cmd found"
else
error "$cmd is not installed"
missing=1
fi
done
if docker compose version &>/dev/null 2>&1; then
info "docker compose plugin found"
else
error "docker compose plugin is not installed"
echo -e " ${DIM}Install: https://docs.docker.com/compose/install/${NC}"
missing=1
fi
if [[ $missing -eq 1 ]]; then
echo ""
error "Please install missing dependencies and try again"
exit 1
fi
echo ""
# Clone or update
if [[ -d "$INSTALL_DIR/.git" ]]; then
step "Updating existing installation..."
git -C "$INSTALL_DIR" pull --ff-only --quiet
info "Updated"
else
step "Installing to ${INSTALL_DIR}..."
git clone --quiet "$REPO" "$INSTALL_DIR"
info "Cloned"
fi
chmod +x "$INSTALL_DIR/automa"
echo ""
echo -e " ${GREEN}${BOLD}Ready!${NC}"
echo ""
echo -e " ${DIM}Get started:${NC}"
echo -e " ${BOLD}cd ${INSTALL_DIR}${NC}"
echo -e " ${BOLD}./automa deploy${NC}"
echo ""