Repository navigation
Releases: dacj4n/envSwitch
Release list
envSwitch v0.2.3
v0.2.3 (2026-06-03)
Changed — Remove JAVA_HOME from JDK module
- JDK no longer exports
JAVA_HOMEenvironment variable. Binary routing is handled entirely by shims + PATH. - Removed the JDK-specific home directory override in
cover()— thefind_jdk_home()function was correctly resolvingContents/Homefor.jdkbundle layouts (used by Zulu and Temurin tar archives), butJAVA_HOMEwas always set to the rawinstall_path, causing a mismatch. - JDK
env_varsis now empty. Shims directory handles all binary resolution.
Changed — GUI log display refinements
-
Operation log now displays newest first (reversed order), so the latest entries are always visible without scrolling.
-
Added Clear button to the Logs page: clears the operation log file and immediately refreshes the UI. Uses
clear_ops()backend function withResult<String, String>return for Tauri IPC compatibility. -
Version bump: 0.2.2 → 0.2.3.
v0.2.3 (2026-06-03)
变更 — 移除 JAVA_HOME 环境变量切换
- JDK 模块不再导出
JAVA_HOME环境变量,二进制路由完全由 shims + PATH 处理。 - 移除了
cover()中的 JDK 主目录覆盖逻辑 —find_jdk_home()已能正确解析.jdkbundle(Zulu 和 Temurin tar 包常用)中的Contents/Home,但之前JAVA_HOME始终被设为原始install_path,导致路径不匹配。 - JDK 的
env_vars已设为空,所有二进制解析通过 shims 目录完成。
变更 — GUI 日志显示优化
-
操作日志现在从上到下由新到旧排列,无需滚动即可看到最新条目。
-
日志页面新增清空按钮:清除操作日志文件并立即刷新界面。使用
clear_ops()后端函数,返回Result<String, String>确保 Tauri IPC 兼容。 -
版本号:0.2.2 → 0.2.3。
Full Changelog: v0.2.2...v0.2.3
envSwitch v0.2.2
v0.2.2 (2026-05-21)
Added — GUI one-click shell init/uninit
- Settings page now has Initialize and Remove buttons for shell integration.
init_shell/uninit_shellTauri commands: create~/.envswitch/dirs, writeinit.sh, add/remove init block from.zshrc/.bashrc— all from the GUI, no CLI binary needed.- Shell integration status shown in real-time on the Settings page.
Changed — CLI availability is optional
cover_moduleno longer requires the CLI binary to be installed. Only shell initialization is checked.- Doctor page: CLI availability downgraded from error to warning, labeled "(optional — for terminal use)".
Added — Python unversioned tool symlinks (pip, pydoc, idle, wheel)
- Homebrew python@X.Y is keg-only — unversioned
pip3/pip/pydoc3/idle3etc. were missing. ensure_symlink()helper creates convenience links after install:python3,python,pip3,pip,pydoc3,idle3,python3-config,wheel3.
Changed — CI: Intel Mac build target
- Release workflow now builds both
aarch64-apple-darwin(Apple Silicon) andx86_64-apple-darwin(Intel Mac). - SHA256 printed to CI logs for audit trail.
v0.2.2 (2026-05-21)
新增 — GUI 一键 Shell 初始化/移除
- 设置页面新增 初始化 和 移除 按钮,一键管理 Shell 集成。
init_shell/uninit_shellTauri 命令:创建~/.envswitch/目录、写入init.sh、添加/移除 rc 文件中的 init block — 全部在 GUI 内完成,无需 CLI 二进制。- 设置页面实时显示 Shell 集成状态。
变更 — CLI 可用性改为可选
cover_module不再要求 CLI 二进制必须安装,仅检查 Shell 初始化。- 诊断页面:CLI 可用性从错误降级为警告,标注"可选 — 终端使用"。
新增 — Python 非版本化工具链接(pip、pydoc、idle、wheel)
- Homebrew 的 python@X.Y 是 keg-only,缺少
pip3/pip/pydoc3/idle3等非版本化链接。 ensure_symlink()辅助函数在安装后创建便捷链接:python3、python、pip3、pip、pydoc3、idle3、python3-config、wheel3。
变更 — CI:Intel Mac 构建目标
- Release 工作流现在同时构建
aarch64-apple-darwin(Apple Silicon)和x86_64-apple-darwin(Intel Mac)。 - CI 日志中打印 SHA256 便于审计。
Full Changelog: v0.2.1...v0.2.2
envSwitch v0.2.1
v0.2.1 (2026-05-20)
Changed — GUI app name to envSwitch
- GUI app bundle product name changed from lowercase
envswitchto camelCaseenvSwitch. CLI binary name remainsenvswitch. - Version bump: 0.2.0 → 0.2.1.
Added — sanitize_cmd() for service subprocess reliability
- New helper
sanitize_cmd()inproviders/homebrew.rs: clears inherited environment and sets onlyPATH+HOME+LANG=C+LC_ALL=C+LC_CTYPE=C. - Applied to all service subprocesses: MySQL (
mysqldinit + start) and PostgreSQL (initdb+pg_ctl). - Guarantees reliable startup from any context (CLI, GUI, launchd, SSH) — C locale is always available on all Unix systems.
Fixed — PostgreSQL GUI startup
init_data_dirwas callingCommand::new("initdb")without a full path. Now usesfind_binary(install_path, "initdb").start_service: clean stalepostmaster.pidbefore starting, detect already-running PostgreSQL, redirectpg_ctlstdout/stderr to log file, wait 2s and verifypg_ctlexit status, confirm postgres PID is alive, return last 20 log lines on failure.- Set
LC_ALL=Cto fixFATAL: postmaster became multithreaded during startupwhen launched from macOS GUI.
Fixed — GUI page state lost on navigation
- Pages were unmounting on sidebar navigation, losing spinner states, expanded sections, and scroll positions.
- Added
KeepAlivewrapper that keeps all main pages mounted and usesdisplay: nonefor inactive ones, with lazy first-mount viauseRef. - Added
usePageActive(path, fn)hook — each page auto-refreshes data when navigated to (Services, Versions, Status, Logs, Doctor).
Fixed — Services page simultaneous spinners
togglingstate changed fromstring | nulltoSet<string>so multiple services can show spinners concurrently on Start All / Stop All.
Docs
- Added screenshots section to both English and Chinese READMEs.
v0.2.1 (2026-05-20)
变更 — GUI 应用名称改为 envSwitch
- GUI app bundle 的 productName 从小写
envswitch改为 camelCaseenvSwitch。CLI 二进制名仍为envswitch。 - 版本号:0.2.0 → 0.2.1。
新增 — sanitize_cmd() 服务进程环境净化
- 新增
sanitize_cmd()辅助函数(位于providers/homebrew.rs):清空继承的环境变量,只保留PATH+HOME+LANG=C+LC_ALL=C+LC_CTYPE=C。 - 应用到所有服务子进程:MySQL(
mysqld初始化/启动)和 PostgreSQL(initdb/pg_ctl)。 - 保证从任何上下文(终端、GUI、launchd、SSH)都能稳定启动 — C locale 在所有 Unix 系统上始终存在。
修复 — PostgreSQL GUI 启动
init_data_dir改用find_binary(install_path, "initdb")解析完整路径,不再依赖 PATH。start_service:启动前清理残留postmaster.pid、检测已运行实例、将pg_ctl输出重定向到日志、等待 2 秒后验证退出状态、确认 postgres PID 存活、失败时返回最后 20 行日志。- 设置
LC_ALL=C修复从 macOS GUI 启动时的FATAL: postmaster became multithreaded during startup错误。
修复 — GUI 页面导航后状态丢失
- 侧边栏切换时页面组件被卸载,导致转圈状态、展开列表、滚动位置等丢失。
- 新增
KeepAlive组件,保持所有主页面挂载,非活跃页面用display: none隐藏,首次访问懒挂载。 - 新增
usePageActive(path, fn)hook,每个页面在导航到时自动刷新数据(Services、Versions、Status、Logs、Doctor)。
修复 — 服务页面多服务同时转圈
toggling状态从单个字符串改为Set<string>,点击"全部启动/停止"时多个服务可同时显示转圈。
文档
- 英文和中文 README 新增截图章节。
Full Changelog: v0.2.0...v0.2.1
Full Changelog: v0.2.0...v0.2.1
envSwitch v0.2.0
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_tothat was creating duplicate directories (8.0/and8.0.46/). - Eliminates 60+ lines of duplicate rename code per brew module.
Added — source field in InstalledVersion
- New
sourcefield:brew,tarball,system,fnm,nvm,custom,unknown. sync_localnow writes metadata with proper source label for every linked module.list_installedmatches metadata byinstall_pathinstead 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→ brew3.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
sbinadded to install symlink directories (mysqld lives insbin/on Homebrew).- Before starting, stale
mysqldprocesses are killed and/tmp/mysql.sock+/tmp/mysqlx.sockare 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.sockconflicts.
Fixed — Python cover not working
- Homebrew python@X.Y is keg-only and does not create
python3/pythonsymlinks. - Added post-install step to create
python3→python3.Xandpython→python3convenience 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→ brew3.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
envSwitch v0.1.3
v0.1.3 (2026-05-18)
Changed — Architecture: shell function → precmd hook + env.sh
Removed the envswitch() shell function wrapper entirely and replaced it with a clean precmd hook architecture:
cover/uncover/autono longer outputexportstatements to stdout. They write~/.envswitch/state/env.shinstead.- Shell init block now uses a
precmdhook (zsh) /PROMPT_COMMAND(bash) that sourcesenv.shon every prompt. - Environment variables (JAVA_HOME, GOROOT, etc.) refresh automatically on the next prompt after a
coveroperation. which envswitchnow returns only the binary path — no more shell function pollution.envswitch initwrites.zshrc/.bashrcfor new terminals, and prints a hint tosource ~/.envswitch/init.shfor immediate effect in the current terminal.envswitch uninitremoves the init block and prints cleanup instructions for the current shell session.load-globalsis no longer called by the init block (replaced by directsource env.shat startup).
Added — GUI: CLI init detection + Doctor diagnostics
cover_modulenow checks that the envSwitch CLI binary is available (via PATH search) and that shell integration is initialized before allowing cover operations. If not, a clear error message is shown.- Doctor page adds two new diagnostic checks:
- envSwitch CLI available — verifies the CLI binary exists in PATH (not the GUI app bundle).
- Shell integration initialized — checks
.zshrc/.bashrcfor the init block.
Fixed — CLI path detection
check_init_status()now finds the real CLI binary by searching PATH (equivalent towhich envswitch) and common install locations (~/.cargo/bin/,/usr/local/bin/,/opt/homebrew/bin/), instead of returning the GUI app bundle path.
Fixed — Build warnings
- Suppressed
dead_codewarnings on library items that are consumed by the GUI crate but unreferenced by the CLI binary target.
v0.1.3 (2026-05-18)
变更 — 架构重构:shell function → precmd hook + env.sh
彻底移除 envswitch() shell function 包装,改为干净的 precmd hook 架构:
cover/uncover/auto不再向 stdout 输出export语句,改为写入~/.envswitch/state/env.sh。- Shell init block 使用
precmdhook(zsh)/PROMPT_COMMAND(bash),在每个提示符自动 sourceenv.sh。 JAVA_HOME、GOROOT等环境变量在cover操作后的下一次提示符自动刷新。which envswitch现在只返回 binary 路径 — 不再有 shell function 污染。envswitch init为新终端写入.zshrc/.bashrc,并提示source ~/.envswitch/init.sh使当前终端立即生效。envswitch uninit移除 init block 并打印当前 shell 会话清理指令。load-globals不再被 init block 调用(改为启动时直接source env.sh)。
新增 — GUI:CLI 初始化检测 + 诊断增强
cover_module在允许 cover 操作前检查 envSwitch CLI 二进制是否可用(通过 PATH 搜索)以及 Shell 集成是否已初始化。未初始化时显示明确错误提示。- 诊断页面新增两项检查:
- envSwitch 命令行可用 — 验证 CLI 二进制在 PATH 中存在(而非 GUI app bundle 路径)。
- Shell 集成已初始化 — 检查
.zshrc/.bashrc中的 init block。
修复 — CLI 路径检测
check_init_status()现在通过搜索 PATH(等同于which envswitch)和常见安装位置(~/.cargo/bin/、/usr/local/bin/、/opt/homebrew/bin/)来查找真正的 CLI 二进制,而非返回 GUI app bundle 路径。
修复 — 编译警告
- 对仅被 GUI crate 引用、未被 CLI binary target 使用的库项添加了
#[allow(dead_code)],消除编译警告。
Full Changelog: v0.1.2...v0.1.3
envSwitch v0.1.2
style: fix cargo fmt alignment in homebrew.rs and php.rs Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
envSwitch v0.1.0
Full Changelog: https://github.com/dacj4n/envSwitch/commits/v0.1.0