Skip to content

envSwitch v0.2.0

Choose a tag to compare

@dacj4n dacj4n released this 19 May 03:11
· 22 commits to main since this release

v0.2.0 (2026-05-19)

Changed — Brew modules: single opt symlink, no version-rename

  • All Homebrew-based modules (mysql, pgsql, php, python) now create a single symlink from ~/.envswitch/envs/<module>/<runtime_key> → /opt/homebrew/opt/<formula> instead of per-directory symlinks (bin, lib, share, etc.).
  • The directory name is the short runtime key (e.g., 8.0, 16, 3.11), not the full brew version. The actual version from brew is stored in metadata for display.
  • Removed the rename-to-actual-version logic in install_to that was creating duplicate directories (8.0/ and 8.0.46/).
  • Eliminates 60+ lines of duplicate rename code per brew module.

Added — source field in InstalledVersion

  • New source field: brew, tarball, system, fnm, nvm, custom, unknown.
  • sync_local now writes metadata with proper source label for every linked module.
  • list_installed matches metadata by install_path instead of version string for reliability.

Added — GUI: version labels + uninstall protection

  • version_labels: When the actual brew version differs from the runtime key (e.g., dir 3.11 → brew 3.11.15), the minor version is displayed next to the module name.
  • uninstallable: System/fnm/nvm modules no longer show the uninstall button (previously shown but ineffective).
  • source_paths: Non-brew modules now resolve bin/ symlinks to show the real source path (e.g., /usr/bin/ for system Python).

Fixed — MySQL service startup

  • sbin added to install symlink directories (mysqld lives in sbin/ on Homebrew).
  • Before starting, stale mysqld processes are killed and /tmp/mysql.sock + /tmp/mysqlx.sock are cleaned.
  • MySQL stderr is redirected to the log file instead of /dev/null.
  • After spawning, wait 2s and verify process is still alive; if it exited, return the last 20 log lines in the error message.
  • X Plugin disabled (--mysqlx=0) to prevent /tmp/mysqlx.sock conflicts.

Fixed — Python cover not working

  • Homebrew python@X.Y is keg-only and does not create python3/python symlinks.
  • Added post-install step to create python3 → python3.X and python → python3 convenience symlinks in the brew opt prefix, so shims can resolve unversioned commands.

Fixed — GUI Doctor diagnostics

  • Doctor page now includes two new checks: CLI binary available (searches PATH) and shell integration initialized (checks rc files).
  • CLI path uses which envswitch-equivalent PATH search + common locations, not the GUI app bundle path.

v0.2.0 (2026-05-19)

变更 — Brew 模块:单 opt symlink,取消版本重命名

  • 所有 Homebrew 模块(mysql、pgsql、php、python)现在创建单个 symlink:~/.envswitch/envs/<模块>/<runtime_key> → /opt/homebrew/opt/<formula>,替代之前的逐目录 symlink(bin、lib、share 等)。
  • 目录名使用短版本号(如 8.0、16、3.11),brew 的实际版本存储在 metadata 中用于展示。
  • 移除 install_to 中重命名到实际版本的逻辑,消除了 8.0/ 和 8.0.46/ 重复目录的问题。
  • 每个 brew 模块减少 60+ 行重复的重命名代码。

新增 — InstalledVersion 增加 source 字段

  • 新增 source 字段:brew、tarball、system、fnm、nvm、custom、unknown。
  • sync_local 现在为每个链接的模块写入带有正确 source 标签的 metadata。
  • list_installed 改为按 install_path 匹配 metadata,不再按 version 字符串。

新增 — GUI:版本标签 + 卸载保护

  • version_labels:当 brew 实际版本与 runtime key 不同时(如目录 3.11 → brew 3.11.15),在模块名旁显示小版本号。
  • uninstallable:系统/fnm/nvm 模块不再显示卸载按钮(之前显示但无效)。
  • source_paths:非 brew 模块现在解析 bin/ 下的 symlink 显示真实来源路径(如系统 Python 显示 /usr/bin/)。

修复 — MySQL 服务启动

  • 安装 symlink 目录增加 sbin(Homebrew 的 mysqld 位于 sbin/)。
  • 启动前清理残留 mysqld 进程和 /tmp/mysql.sock、/tmp/mysqlx.sock 文件。
  • MySQL stderr 重定向到日志文件,不再丢弃。
  • spawn 后等待 2 秒检查进程是否存活;如果退出,返回最后 20 行日志。
  • 禁用 X Plugin(--mysqlx=0)防止 /tmp/mysqlx.sock 冲突。

修复 — Python cover 不生效

  • Homebrew 的 python@X.Y 是 keg-only 的,不会创建 python3/python 符号链接。
  • 安装后自动在 brew opt prefix 中创建 python3 → python3.X 和 python → python3 便捷链接,使 shims 能解析无版本号命令。

修复 — GUI 诊断增强

  • 诊断页面新增两项检查:CLI 二进制可用(搜索 PATH)和 Shell 集成已初始化(检查 rc 文件)。
  • CLI 路径使用类 which envswitch 的 PATH 搜索 + 常见位置,不再显示 GUI app bundle 路径。

Full Changelog: v0.1.3...v0.2.0