From d11df17b5d32b601973ea077daa61c81454a6cb7 Mon Sep 17 00:00:00 2001 From: Kelvin Chiu Date: Mon, 23 Feb 2026 11:26:23 +0800 Subject: [PATCH] feat: more granular local environment checks (#870) * feat: more granular local environment checks * refactor: improve PR #870 with i18n, shadcn Select, and testable helpers - Extract is_valid_shell, is_valid_shell_flag, default_flag_for_shell to module-level #[cfg(windows)] functions for testability - Add unit tests for extracted helper functions - Replace native + handleToolShellChange(toolName, v) + } + disabled={isLoadingTools || loadingTools[toolName]} + > + + + + + + {t("common.auto")} + + {WSL_SHELL_OPTIONS.map((shell) => ( + + {shell} + + ))} + + + )} + {/* WSL Shell Flag Selector */} + {tool?.env_type === "wsl" && ( + + )} - {isLoadingTools ? ( + {isLoadingTools || loadingTools[toolName] ? ( ) : tool?.version ? (
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 99c7ae6ef..e79bc8954 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -37,7 +37,8 @@ "search": "Search", "reset": "Reset", "actions": "Actions", - "deleting": "Deleting..." + "deleting": "Deleting...", + "auto": "Auto" }, "apiKeyInput": { "placeholder": "Enter API Key", @@ -452,6 +453,14 @@ "oneClickInstall": "One-click Install", "oneClickInstallHint": "Install Claude Code / Codex / Gemini CLI / OpenCode", "localEnvCheck": "Local environment check", + "envBadge": { + "wsl": "WSL", + "windows": "Win", + "macos": "macOS", + "linux": "Linux" + }, + "wslShell": "Shell", + "wslShellFlag": "Flag", "installCommandsCopied": "Install commands copied", "installCommandsCopyFailed": "Copy failed, please copy manually.", "importFailedError": "Import config failed: {{message}}", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 085bb0441..d09f49071 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -37,7 +37,8 @@ "search": "検索", "reset": "リセット", "actions": "操作", - "deleting": "削除中..." + "deleting": "削除中...", + "auto": "自動" }, "apiKeyInput": { "placeholder": "API Key を入力", @@ -452,6 +453,14 @@ "oneClickInstall": "ワンクリックインストール", "oneClickInstallHint": "Claude Code / Codex / Gemini CLI / OpenCode をインストール", "localEnvCheck": "ローカル環境チェック", + "envBadge": { + "wsl": "WSL", + "windows": "Win", + "macos": "macOS", + "linux": "Linux" + }, + "wslShell": "Shell", + "wslShellFlag": "フラグ", "installCommandsCopied": "インストールコマンドをコピーしました", "installCommandsCopyFailed": "コピーに失敗しました。手動でコピーしてください。", "importFailedError": "設定のインポートに失敗しました: {{message}}", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index cd106dfe2..a56ba9a29 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -37,7 +37,8 @@ "search": "查询", "reset": "重置", "actions": "操作", - "deleting": "删除中..." + "deleting": "删除中...", + "auto": "自动" }, "apiKeyInput": { "placeholder": "请输入API Key", @@ -452,6 +453,14 @@ "oneClickInstall": "一键安装", "oneClickInstallHint": "安装 Claude Code / Codex / Gemini CLI / OpenCode", "localEnvCheck": "本地环境检查", + "envBadge": { + "wsl": "WSL", + "windows": "Win", + "macos": "macOS", + "linux": "Linux" + }, + "wslShell": "Shell", + "wslShellFlag": "标志", "installCommandsCopied": "安装命令已复制", "installCommandsCopyFailed": "复制失败,请手动复制。", "importFailedError": "导入配置失败:{{message}}", diff --git a/src/lib/api/settings.ts b/src/lib/api/settings.ts index 6b791659d..5649dce7a 100644 --- a/src/lib/api/settings.ts +++ b/src/lib/api/settings.ts @@ -169,15 +169,23 @@ export const settingsApi = { return await invoke("get_auto_launch_status"); }, - async getToolVersions(): Promise< + async getToolVersions( + tools?: string[], + wslShellByTool?: Record< + string, + { wslShell?: string | null; wslShellFlag?: string | null } + >, + ): Promise< Array<{ name: string; version: string | null; latest_version: string | null; error: string | null; + env_type: "windows" | "wsl" | "macos" | "linux" | "unknown"; + wsl_distro: string | null; }> > { - return await invoke("get_tool_versions"); + return await invoke("get_tool_versions", { tools, wslShellByTool }); }, async getRectifierConfig(): Promise {