diff --git a/scripts/setup-ai-workspace-all-in-one.sh b/scripts/setup-ai-workspace-all-in-one.sh index 50dd551..73f50af 100755 --- a/scripts/setup-ai-workspace-all-in-one.sh +++ b/scripts/setup-ai-workspace-all-in-one.sh @@ -499,6 +499,83 @@ wait_for_postgres() { error "Timed out waiting for local PostgreSQL on port $port" } +service_status_line() { + local label=$1 + local unit_patterns=$2 + local port=${3:-} + local detail="not detected" + local state="DOWN" + + if command -v systemctl >/dev/null 2>&1; then + local unit + for unit in $unit_patterns; do + if systemctl is-active --quiet "$unit" 2>/dev/null; then + state="OK" + detail="systemd:$unit" + break + fi + done + fi + + if [ "$state" != "OK" ] && [ -n "$port" ]; then + if command -v ss >/dev/null 2>&1 && ss -ltn "( sport = :$port )" 2>/dev/null | grep -q ":$port"; then + state="OK" + detail="port:$port" + elif command -v lsof >/dev/null 2>&1 && lsof -nP -iTCP:"$port" -sTCP:LISTEN >/dev/null 2>&1; then + state="OK" + detail="port:$port" + fi + fi + + printf ' - %-28s %s (%s)\n' "$label" "$state" "$detail" +} + +cli_status_line() { + local label=$1 + local bin=$2 + local state="MISSING" + local detail="not in PATH" + + if command -v "$bin" >/dev/null 2>&1; then + state="OK" + detail="$(command -v "$bin")" + fi + + printf ' - %-28s %s (%s)\n' "$label" "$state" "$detail" +} + +print_deployment_summary() { + local domain=${SERVER_DOMAIN:-${XWORKMATE_BRIDGE_DOMAIN:-${BRIDGE_DOMAIN:-${ACP_BRIDGE_DOMAIN:-acp-bridge.onwalk.net}}}} + local token=$1 + + cat <