Skip to content

feat(gemini): support syncing default instance credentials to wsl#654

Open
Benjaminlooi wants to merge 3 commits intojlcodes99:mainfrom
Benjaminlooi:feature/add-configuration-gemini-wsl
Open

feat(gemini): support syncing default instance credentials to wsl#654
Benjaminlooi wants to merge 3 commits intojlcodes99:mainfrom
Benjaminlooi:feature/add-configuration-gemini-wsl

Conversation

@Benjaminlooi
Copy link
Copy Markdown

Motivation / 动机

English:
Development on Windows frequently involves using WSL2. This feature allows users to install the Gemini CLI directly within their WSL2 environment while using Cockpit Tools on the Windows host to manage Gemini and other AI providers. By syncing the active .gemini configuration across the OS boundary, it ensures a seamless developer experience without needing to manually copy credentials when switching accounts.

中文:
在 Windows 上进行开发通常会深度依赖 WSL2。此功能允许用户在 WSL2 环境中直接安装 Gemini CLI,同时在 Windows 宿主机上使用 Cockpit Tools 来管理 Gemini 和其他 AI 驱动。通过跨系统边界自动同步 .gemini 配置,它确保了无缝的开发者体验,避免了在切换账号时手动复制凭据的麻烦。

Summary / 摘要

English:
Implemented logic using wsl.exe to automatically sync ~/.gemini to the default WSL distribution when switching the active Gemini instance.
Added a gemini_sync_wsl configuration option (enabled by default) to control this behavior.
Added a "Sync WSL Configuration" toggle to both the main Settings page and the Gemini Quick Settings popover (visible only on Windows).
Added English and Chinese translations for the new WSL sync settings.

中文:
使用 wsl.exe 实现了在切换 Gemini 活跃实例时,自动将 ~/.gemini 同步到默认的 WSL 发行版的逻辑。
添加了 gemini_sync_wsl 配置选项(默认启用)来控制此行为。
在主设置页面和 Gemini 快捷设置弹出窗口中添加了“同步 WSL 配置”开关(仅在 Windows 上可见)。
为新的 WSL 同步设置添加了中英文翻译。

Test Plan / 测试计划

English:
[ ] On Windows, verify that the "Sync WSL Configuration" toggle appears in the Settings page and the Gemini Quick Settings popover.
[ ] With the setting enabled, switch the active Gemini account and verify that the credentials in ~/.gemini inside WSL are updated accordingly.
[ ] With the setting disabled, verify that switching the active Gemini account does not modify the WSL .gemini directory.
[ ] Verify the toggle does not appear on macOS/Linux.

中文:
[ ] 在 Windows 上,验证“同步 WSL 配置”开关正常显示在设置页面和 Gemini 快捷设置弹出窗口中。
[ ] 启用该设置后,切换活跃的 Gemini 账号,验证 WSL 内的 ~/.gemini 目录凭据是否相应更新。
[ ] 禁用该设置后,验证切换活跃的 Gemini 账号不会修改 WSL 中的 .gemini 目录。
[ ] 验证该开关在 macOS/Linux 上不显示。

- Added `gemini_sync_wsl` to the configuration schema.

- Added a toggle in the Settings UI for Windows users to control the WSL sync behavior.

- Implemented `sync_default_gemini_home_to_wsl` using `wsl.exe` to sync `~/.gemini` to the WSL default home.

- Trigger WSL sync when switching the default Gemini instance on Windows if the setting is enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant