#!/usr/bin/env bash set -euo pipefail script_dir="$(cd "$(dirname "$0")" && pwd -P)" project_root="$(cd "$script_dir/.." && pwd -P)" # shellcheck source=macos_helpers.sh source "$script_dir/macos_helpers.sh" macos_install_exit_trap 0 macos_require_darwin artifact="$project_root/dist/DoctorWorkstation.app" artifact_executable="$artifact/Contents/MacOS/DoctorWorkstation" if [[ -d "$artifact" && -x "$artifact_executable" ]]; then printf '正在打开已构建应用:%s\n' "$artifact" if /usr/bin/open "$artifact"; then printf '应用已启动。\n' exit 0 fi macos_die "DoctorWorkstation.app 存在,但 Finder 无法打开它。" fi if [[ -e "$artifact" ]]; then printf '检测到不完整的应用产物,将改为启动源码:%s\n' "$artifact" >&2 else printf '尚无已构建应用,正在准备源码运行环境。\n' fi macos_ensure_uv cd "$project_root" printf '正在同步 Python 运行依赖(首次运行可能需要几分钟)…\n' "$MACOS_UV_BIN" sync --locked printf '正在启动医生工作站…\n' "$MACOS_UV_BIN" run --frozen doctor-workstation