zcf 3.3.3 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import cac from 'cac';
3
3
  import ansis from 'ansis';
4
- import { aa as ensureI18nInitialized, ab as i18n, aC as readCcrConfig, ax as isCcrInstalled, ay as installCcr, aD as configureCcrFeature, aE as handleExitPromptError, aF as handleGeneralError, aG as COMETIX_COMMAND_NAME, aH as COMETIX_COMMANDS, aI as installCometixLine, ac as addNumbersToChoices, aJ as checkAndUpdateTools, aK as runCodexUpdate, aL as resolveCodeType$1, ai as readJsonConfig, aM as writeJsonConfig, q as ZCF_CONFIG_FILE, aN as displayBanner, as as readZcfConfig, aq as updateZcfConfig, aO as version, aP as resolveAiOutputLanguage, aQ as updatePromptOnly, aR as selectAndInstallWorkflows, aS as checkClaudeCodeVersionAndPrompt, w as resolveCodeToolType$1, D as DEFAULT_CODE_TOOL_TYPE, u as isCodeToolType, aT as displayBannerWithInfo, s as CODE_TOOL_BANNERS, aU as runCodexUninstall, aV as configureCodexMcp, aW as configureCodexApi, aX as runCodexWorkflowImportWithLanguageSelection, aY as runCodexFullInit, i as init, aZ as switchCodexProvider, a_ as listCodexProviders, am as readCodexConfig, a$ as switchToOfficialLogin, b0 as switchToProvider, b1 as readZcfConfigAsync, b2 as initI18n, b3 as selectScriptLanguage, ar as changeLanguage } from './chunks/simple-config.mjs';
4
+ import { ah as ensureI18nInitialized, ai as i18n, aK as readCcrConfig, aF as isCcrInstalled, aG as installCcr, aL as configureCcrFeature, al as promptBoolean, aM as handleExitPromptError, aN as handleGeneralError, aO as COMETIX_COMMAND_NAME, aP as COMETIX_COMMANDS, aQ as installCometixLine, aj as addNumbersToChoices, aR as checkAndUpdateTools, aS as runCodexUpdate, aT as resolveCodeType$1, aq as readJsonConfig, aU as writeJsonConfig, q as ZCF_CONFIG_FILE, aA as readZcfConfig, D as DEFAULT_CODE_TOOL_TYPE, u as isCodeToolType, aV as displayBanner, ay as updateZcfConfig, aW as version, aX as resolveAiOutputLanguage, aY as updatePromptOnly, aZ as selectAndInstallWorkflows, a_ as checkClaudeCodeVersionAndPrompt, w as resolveCodeToolType$1, a$ as displayBannerWithInfo, s as CODE_TOOL_BANNERS, b0 as runCodexUninstall, b1 as configureCodexMcp, b2 as configureCodexApi, b3 as runCodexWorkflowImportWithLanguageSelection, b4 as runCodexFullInit, i as init, b5 as switchCodexProvider, b6 as listCodexProviders, au as readCodexConfig, b7 as switchToOfficialLogin, b8 as switchToProvider, b9 as readZcfConfigAsync, ba as initI18n, bb as selectScriptLanguage, az as changeLanguage } from './chunks/simple-config.mjs';
5
5
  import { existsSync } from 'node:fs';
6
6
  import { homedir } from 'node:os';
7
7
  import inquirer from 'inquirer';
@@ -17,6 +17,7 @@ import { m as moveToTrash } from './shared/zcf.DGjQxTq_.mjs';
17
17
  import { ClaudeCodeConfigManager } from './chunks/claude-code-config-manager.mjs';
18
18
  import 'dayjs';
19
19
  import 'node:url';
20
+ import 'inquirer-toggle';
20
21
  import 'ora';
21
22
  import 'semver';
22
23
  import 'smol-toml';
@@ -129,11 +130,9 @@ ${ansis.cyan("\u2550".repeat(50))}`);
129
130
  console.log(`
130
131
  ${ansis.dim("\u2500".repeat(50))}
131
132
  `);
132
- const { continueInCcr } = await inquirer.prompt({
133
- type: "confirm",
134
- name: "continueInCcr",
133
+ const continueInCcr = await promptBoolean({
135
134
  message: i18n.t("common:returnToMenu"),
136
- default: true
135
+ defaultValue: true
137
136
  });
138
137
  if (continueInCcr) {
139
138
  return await showCcrMenu();
@@ -258,11 +257,9 @@ ${ansis.cyan("\u2550".repeat(50))}`);
258
257
  console.log(`
259
258
  ${ansis.dim("\u2500".repeat(50))}
260
259
  `);
261
- const { continueInCometix } = await inquirer.prompt({
262
- type: "confirm",
263
- name: "continueInCometix",
260
+ const continueInCometix = await promptBoolean({
264
261
  message: i18n.t("common:returnToMenu"),
265
- default: true
262
+ defaultValue: true
266
263
  });
267
264
  if (continueInCometix) {
268
265
  return await showCometixMenu();
@@ -690,19 +687,24 @@ class ZcfUninstaller {
690
687
  result.removed.push(".claude.json (includes MCP configuration)");
691
688
  }
692
689
  try {
693
- await exec$1("npm", ["uninstall", "-g", "@anthropic-ai/claude-code"]);
694
- result.removed.push("@anthropic-ai/claude-code package");
695
- result.success = true;
690
+ const { uninstallCodeTool } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bk; });
691
+ const success = await uninstallCodeTool("claude-code");
692
+ if (success) {
693
+ result.removed.push("@anthropic-ai/claude-code");
694
+ result.success = true;
695
+ } else {
696
+ result.errors.push(i18n.t("uninstall:uninstallFailed", { codeType: i18n.t("common:claudeCode"), message: "" }));
697
+ }
696
698
  } catch (npmError) {
697
699
  if (npmError.message.includes("not found") || npmError.message.includes("not installed")) {
698
700
  result.warnings.push(i18n.t("uninstall:claudeCodePackageNotFound"));
699
701
  result.success = true;
700
702
  } else {
701
- result.errors.push(`Failed to uninstall Claude Code package: ${npmError.message}`);
703
+ result.errors.push(i18n.t("uninstall:uninstallFailed", { codeType: i18n.t("common:claudeCode"), message: `: ${npmError.message}` }));
702
704
  }
703
705
  }
704
706
  } catch (error) {
705
- result.errors.push(`Failed to uninstall Claude Code: ${error.message}`);
707
+ result.errors.push(i18n.t("uninstall:uninstallFailed", { codeType: i18n.t("common:claudeCode"), message: `: ${error.message}` }));
706
708
  }
707
709
  return result;
708
710
  }
@@ -905,7 +907,26 @@ class ZcfUninstaller {
905
907
  async function uninstall(options = {}) {
906
908
  try {
907
909
  ensureI18nInitialized();
910
+ let codeType;
911
+ if (options.codeType) {
912
+ try {
913
+ codeType = await resolveCodeType$1(options.codeType);
914
+ } catch (error) {
915
+ const errorMessage = error instanceof Error ? error.message : String(error);
916
+ console.error(ansis.red(`${i18n.t("errors:generalError")} ${errorMessage}`));
917
+ const config = readZcfConfig();
918
+ codeType = config?.codeToolType && isCodeToolType(config.codeToolType) ? config.codeToolType : DEFAULT_CODE_TOOL_TYPE;
919
+ }
920
+ } else {
921
+ const config = readZcfConfig();
922
+ codeType = config?.codeToolType && isCodeToolType(config.codeToolType) ? config.codeToolType : DEFAULT_CODE_TOOL_TYPE;
923
+ }
908
924
  const uninstaller = new ZcfUninstaller(options.lang || "en");
925
+ if (codeType === "codex") {
926
+ const { runCodexUninstall } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bj; });
927
+ await runCodexUninstall();
928
+ return;
929
+ }
909
930
  if (options.mode && options.mode !== "interactive") {
910
931
  if (options.mode === "complete") {
911
932
  await executeCompleteUninstall(uninstaller);
@@ -930,7 +951,6 @@ async function uninstall(options = {}) {
930
951
  }
931
952
  async function showInteractiveUninstall(uninstaller) {
932
953
  console.log(ansis.cyan.bold(i18n.t("uninstall:title")));
933
- console.log(ansis.yellow(i18n.t("uninstall:warning")));
934
954
  console.log("");
935
955
  const { mainChoice } = await inquirer.prompt({
936
956
  type: "list",
@@ -1029,11 +1049,9 @@ async function executeCompleteUninstall(uninstaller) {
1029
1049
  console.log("");
1030
1050
  console.log(ansis.red.bold(i18n.t("uninstall:executingComplete")));
1031
1051
  console.log(ansis.yellow(i18n.t("uninstall:completeWarning")));
1032
- const { confirm } = await inquirer.prompt({
1033
- type: "confirm",
1034
- name: "confirm",
1052
+ const confirm = await promptBoolean({
1035
1053
  message: i18n.t("uninstall:confirmComplete"),
1036
- default: false
1054
+ defaultValue: false
1037
1055
  });
1038
1056
  if (!confirm) {
1039
1057
  console.log(ansis.yellow(i18n.t("common:cancelled")));
@@ -1051,11 +1069,9 @@ async function executeCustomUninstall(uninstaller, items) {
1051
1069
  items.forEach((item) => {
1052
1070
  console.log(` \u2022 ${i18n.t(`uninstall:${item}`)}`);
1053
1071
  });
1054
- const { confirm } = await inquirer.prompt({
1055
- type: "confirm",
1056
- name: "confirm",
1072
+ const confirm = await promptBoolean({
1057
1073
  message: i18n.t("uninstall:confirmCustom"),
1058
- default: false
1074
+ defaultValue: false
1059
1075
  });
1060
1076
  if (!confirm) {
1061
1077
  console.log(ansis.yellow(i18n.t("common:cancelled")));
@@ -1177,7 +1193,7 @@ async function update(options = {}) {
1177
1193
  }
1178
1194
  return;
1179
1195
  }
1180
- const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.ba; });
1196
+ const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bi; });
1181
1197
  const configLang = await resolveTemplateLanguage(
1182
1198
  options.configLang,
1183
1199
  // Command line option
@@ -1392,11 +1408,9 @@ async function showClaudeCodeMenu() {
1392
1408
  return void 0;
1393
1409
  }
1394
1410
  printSeparator();
1395
- const { continue: shouldContinue } = await inquirer.prompt({
1396
- type: "confirm",
1397
- name: "continue",
1411
+ const shouldContinue = await promptBoolean({
1398
1412
  message: i18n.t("common:returnToMenu"),
1399
- default: true
1413
+ defaultValue: true
1400
1414
  });
1401
1415
  if (!shouldContinue) {
1402
1416
  console.log(ansis.cyan(i18n.t("common:goodbye")));
@@ -1494,11 +1508,9 @@ async function showCodexMenu() {
1494
1508
  return void 0;
1495
1509
  }
1496
1510
  printSeparator();
1497
- const { continue: shouldContinue } = await inquirer.prompt({
1498
- type: "confirm",
1499
- name: "continue",
1511
+ const shouldContinue = await promptBoolean({
1500
1512
  message: i18n.t("common:returnToMenu"),
1501
- default: true
1513
+ defaultValue: true
1502
1514
  });
1503
1515
  if (!shouldContinue) {
1504
1516
  console.log(ansis.cyan(i18n.t("common:goodbye")));
@@ -1979,10 +1991,10 @@ async function setupCommands(cli) {
1979
1991
  list: options.list
1980
1992
  });
1981
1993
  }));
1982
- cli.command("uninstall", "Remove ZCF configurations and tools").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--mode, -m <mode>", "Uninstall mode (complete/custom/interactive), default: interactive").option("--items, -i <items>", "Comma-separated items for custom uninstall mode").action(await withLanguageResolution(async (options) => {
1994
+ cli.command("uninstall", "Remove ZCF configurations and tools").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex, cc, cx)").option("--mode, -m <mode>", "Uninstall mode (complete/custom/interactive), default: interactive").option("--items, -i <items>", "Comma-separated items for custom uninstall mode").action(await withLanguageResolution(async (options) => {
1983
1995
  await uninstall(options);
1984
1996
  }));
1985
- cli.command("check-updates", "Check and update Claude Code and CCR to latest versions").alias("check").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex, cc, cx)").action(await withLanguageResolution(async (options) => {
1997
+ cli.command("check-updates", "Check and update Claude Code and CCR to latest versions").alias("check").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex, cc, cx)").option("--skip-prompt, -s", "Skip all interactive prompts (non-interactive mode)").action(await withLanguageResolution(async (options) => {
1986
1998
  await checkUpdates(options);
1987
1999
  }));
1988
2000
  cli.help((sections) => customizeHelp(sections));
@@ -1,6 +1,4 @@
1
1
  {
2
- "installingCli": "🚀 Installing Codex CLI...",
3
- "installSuccess": "✔ Codex CLI installed",
4
2
  "usingSudo": "⚠️ Detected non-root Linux user. Using sudo for Codex CLI installation (password prompt may appear).",
5
3
  "alreadyInstalled": "⚠️ Codex CLI already installed, skipping installation",
6
4
  "updatingCli": "🔄 Updating Codex CLI...",
@@ -105,5 +103,17 @@
105
103
  "upToDate": "Codex is up to date (v{version})",
106
104
  "notInstalled": "Codex is not installed",
107
105
  "cannotCheckVersion": "Cannot check latest version",
108
- "checkFailed": "Version check failed"
106
+ "checkFailed": "Version check failed",
107
+ "providerManager.noConfig": "No existing configuration found",
108
+ "providerManager.backupFailed": "Failed to create backup",
109
+ "providerManager.providerExists": "Provider with ID \"{{id}}\" already exists",
110
+ "providerManager.providerNotFound": "Provider with ID \"{{id}}\" not found",
111
+ "providerManager.noProvidersSpecified": "No providers specified for deletion",
112
+ "providerManager.providersNotFound": "Some providers not found: {{providers}}",
113
+ "providerManager.cannotDeleteAll": "Cannot delete all providers. At least one provider must remain.",
114
+ "providerManager.providerIdRequired": "Provider ID is required",
115
+ "providerManager.providerNameRequired": "Provider name is required",
116
+ "providerManager.baseUrlRequired": "Base URL is required",
117
+ "providerManager.wireApiInvalid": "Wire API must be either \"responses\" or \"chat\"",
118
+ "providerManager.unknownError": "Unknown error"
109
119
  }
@@ -13,5 +13,7 @@
13
13
  "back": "Back",
14
14
  "operationFailed": "Operation failed",
15
15
  "backupCreated": "📁 Configuration backup created: {{path}}",
16
- "current": "current"
16
+ "current": "current",
17
+ "claudeCode": "Claude Code",
18
+ "codex": "Codex"
17
19
  }
@@ -29,5 +29,19 @@
29
29
  "wslDetected": "WSL environment detected ({distro})",
30
30
  "wslDetectedGeneric": "WSL environment detected",
31
31
  "wslPathInfo": "Configuration path: {path}",
32
- "wslInstallSuccess": "Claude Code successfully installed in WSL environment"
32
+ "wslInstallSuccess": "Claude Code successfully installed in WSL environment",
33
+ "selectInstallMethod": "Please select installation method for {{codeType}}:",
34
+ "recommendedMethod": "Recommended",
35
+ "installingWith": "Installing {{codeType}} using {{method}}...",
36
+ "installMethodSuccess": "Successfully installed using {{method}}",
37
+ "installMethodFailed": "Failed to install using {{method}}",
38
+ "tryAnotherMethod": "Installation failed. Try another method?",
39
+ "noMoreMethods": "No more installation methods available",
40
+ "detectedVersion": "Detected version {{version}}",
41
+ "uninstallingWith": "Uninstalling {{codeType}} using {{method}}...",
42
+ "uninstallSuccess": "Successfully uninstalled using {{method}}",
43
+ "uninstallFailed": "Failed to uninstall using {{method}}",
44
+ "manualUninstallRequired": "{{codeType}} requires manual uninstallation",
45
+ "binaryLocation": "Binary location: {{path}}",
46
+ "failedToLocateBinary": "Failed to locate {{command}} binary"
33
47
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "title": "ZCF Uninstaller",
3
- "warning": "⚠️ This will permanently remove Claude Code configurations and tools from your system.",
4
3
  "selectMainOption": "Select uninstall option:",
5
4
  "completeUninstall": "Complete Uninstall",
6
5
  "completeUninstallDesc": "Remove all Claude Code related configurations and tools",
@@ -52,5 +51,6 @@
52
51
  "claudeCodePackageNotFound": "Claude Code package not found",
53
52
  "backupsNotFound": "Backup directory not found",
54
53
  "zcfConfigNotFound": "ZCF configuration file not found",
55
- "outputStylesDirectoryNotFound": "Output styles directory not found"
54
+ "outputStylesDirectoryNotFound": "Output styles directory not found",
55
+ "uninstallFailed": "Failed to uninstall {{codeType}}{{message}}"
56
56
  }
@@ -1,6 +1,4 @@
1
1
  {
2
- "installingCli": "🚀 正在安装 Codex CLI...",
3
- "installSuccess": "✔ Codex CLI 安装完成",
4
2
  "usingSudo": "⚠️ 检测到 Linux 非 root 用户,正在使用 sudo 安装 Codex CLI(可能需要输入密码)。",
5
3
  "alreadyInstalled": "⚠️ Codex CLI 已安装,跳过安装步骤",
6
4
  "updatingCli": "🔄 正在更新 Codex CLI...",
@@ -105,5 +103,17 @@
105
103
  "upToDate": "Codex 已是最新版本 (v{version})",
106
104
  "notInstalled": "Codex 未安装",
107
105
  "cannotCheckVersion": "无法检查最新版本",
108
- "checkFailed": "版本检查失败"
106
+ "checkFailed": "版本检查失败",
107
+ "providerManager.noConfig": "未找到现有配置",
108
+ "providerManager.backupFailed": "创建备份失败",
109
+ "providerManager.providerExists": "ID 为 \"{{id}}\" 的提供商已存在",
110
+ "providerManager.providerNotFound": "ID 为 \"{{id}}\" 的提供商不存在",
111
+ "providerManager.noProvidersSpecified": "未指定要删除的提供商",
112
+ "providerManager.providersNotFound": "未找到以下提供商:{{providers}}",
113
+ "providerManager.cannotDeleteAll": "不能删除所有提供商,至少需要保留一个",
114
+ "providerManager.providerIdRequired": "提供商 ID 是必需的",
115
+ "providerManager.providerNameRequired": "提供商名称是必需的",
116
+ "providerManager.baseUrlRequired": "基础 URL 是必需的",
117
+ "providerManager.wireApiInvalid": "Wire API 必须是 \"responses\" 或 \"chat\"",
118
+ "providerManager.unknownError": "未知错误"
109
119
  }
@@ -13,5 +13,7 @@
13
13
  "back": "返回",
14
14
  "operationFailed": "操作失败",
15
15
  "backupCreated": "📁 已创建配置备份:{{path}}",
16
- "current": "当前"
16
+ "current": "当前",
17
+ "claudeCode": "Claude Code",
18
+ "codex": "Codex"
17
19
  }
@@ -29,5 +29,19 @@
29
29
  "wslDetected": "检测到 WSL 环境 ({distro})",
30
30
  "wslDetectedGeneric": "检测到 WSL 环境",
31
31
  "wslPathInfo": "配置文件位置:{path}",
32
- "wslInstallSuccess": "Claude Code 已成功安装在 WSL 环境中"
32
+ "wslInstallSuccess": "Claude Code 已成功安装在 WSL 环境中",
33
+ "selectInstallMethod": "请选择 {{codeType}} 的安装方式:",
34
+ "recommendedMethod": "推荐",
35
+ "installingWith": "正在使用 {{method}} 安装 {{codeType}}...",
36
+ "installMethodSuccess": "使用 {{method}} 安装成功",
37
+ "installMethodFailed": "使用 {{method}} 安装失败",
38
+ "tryAnotherMethod": "安装失败,是否尝试其他安装方式?",
39
+ "noMoreMethods": "没有更多可用的安装方式",
40
+ "detectedVersion": "检测到版本 {{version}}",
41
+ "uninstallingWith": "正在使用 {{method}} 卸载 {{codeType}}...",
42
+ "uninstallSuccess": "使用 {{method}} 卸载成功",
43
+ "uninstallFailed": "使用 {{method}} 卸载失败",
44
+ "manualUninstallRequired": "{{codeType}} 需要手动卸载",
45
+ "binaryLocation": "可执行文件位置:{{path}}",
46
+ "failedToLocateBinary": "无法定位 {{command}} 可执行文件"
33
47
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "title": "ZCF 卸载工具",
3
- "warning": "⚠️ 这将永久删除您系统中的 Claude Code 配置和工具。",
4
3
  "selectMainOption": "选择卸载选项:",
5
4
  "completeUninstall": "完全卸载",
6
5
  "completeUninstallDesc": "删除所有 Claude Code 相关配置和工具",
@@ -52,5 +51,6 @@
52
51
  "claudeCodePackageNotFound": "未找到 Claude Code 包",
53
52
  "backupsNotFound": "未找到备份目录",
54
53
  "zcfConfigNotFound": "未找到 ZCF 配置文件",
55
- "outputStylesDirectoryNotFound": "未找到输出风格目录"
54
+ "outputStylesDirectoryNotFound": "未找到输出风格目录",
55
+ "uninstallFailed": "卸载 {{codeType}} 失败{{message}}"
56
56
  }
package/dist/index.d.mts CHANGED
@@ -137,6 +137,10 @@ interface ApiConfig {
137
137
  key: string;
138
138
  authType?: 'auth_token' | 'api_key';
139
139
  }
140
+ /**
141
+ * Installation method types for code tools
142
+ */
143
+ type InstallMethod = 'npm' | 'homebrew' | 'curl' | 'powershell' | 'cmd';
140
144
 
141
145
  declare function ensureClaudeDir(): void;
142
146
  declare function backupExistingConfig(): string | null;
@@ -181,8 +185,29 @@ declare function switchToOfficialLogin(): boolean;
181
185
  */
182
186
  declare function promptApiConfigurationAction(): Promise<'modify-partial' | 'modify-all' | 'keep-existing' | null>;
183
187
 
188
+ declare function getPlatform(): 'windows' | 'macos' | 'linux';
189
+ declare function commandExists(command: string): Promise<boolean>;
190
+ /**
191
+ * Get recommended install methods for a code tool based on current platform
192
+ * Returns methods in priority order (most recommended first)
193
+ */
194
+ type CodeType = 'claude-code' | 'codex';
195
+
184
196
  declare function isClaudeCodeInstalled(): Promise<boolean>;
185
- declare function installClaudeCode(): Promise<void>;
197
+ /**
198
+ * Install Claude Code with method selection support
199
+ * @param skipMethodSelection - If true, use default npm installation
200
+ */
201
+ declare function installClaudeCode(skipMethodSelection?: boolean): Promise<void>;
202
+ /**
203
+ * Check if Codex is installed
204
+ */
205
+ declare function isCodexInstalled(): Promise<boolean>;
206
+ /**
207
+ * Install Codex with method selection support
208
+ * @param skipMethodSelection - If true, use default npm installation
209
+ */
210
+ declare function installCodex(skipMethodSelection?: boolean): Promise<void>;
186
211
  /**
187
212
  * Check if local Claude Code installation exists
188
213
  */
@@ -201,10 +226,33 @@ declare function getInstallationStatus(): Promise<InstallationStatus>;
201
226
  */
202
227
  declare function removeLocalClaudeCode(): Promise<void>;
203
228
  /**
204
- * Set installMethod to 'npm' in ~/.claude.json
229
+ * Uninstall code tool based on install method
230
+ * @param codeType - Type of code tool to uninstall
231
+ * @returns true if uninstalled successfully
232
+ */
233
+ declare function uninstallCodeTool(codeType: CodeType): Promise<boolean>;
234
+ /**
235
+ * Set installMethod in both ~/.claude.json and zcf-config
205
236
  * This ensures Claude Code knows it was installed via npm for proper auto-updates
206
237
  */
207
- declare function setInstallMethod(method?: 'npm' | 'native'): Promise<void>;
238
+ declare function setInstallMethod(method?: InstallMethod | 'native', codeType?: CodeType): Promise<void>;
239
+ /**
240
+ * Detect installed version of a code tool
241
+ * Returns version string or null if not installed
242
+ */
243
+ declare function detectInstalledVersion(codeType: CodeType): Promise<string | null>;
244
+ /**
245
+ * Select installation method interactively
246
+ */
247
+ declare function selectInstallMethod(codeType: CodeType, excludeMethods?: InstallMethod[]): Promise<InstallMethod | null>;
248
+ /**
249
+ * Execute installation using specified method
250
+ */
251
+ declare function executeInstallMethod(method: InstallMethod, codeType: CodeType): Promise<boolean>;
252
+ /**
253
+ * Handle installation failure with retry options
254
+ */
255
+ declare function handleInstallFailure(codeType: CodeType, failedMethods: InstallMethod[]): Promise<boolean>;
208
256
 
209
257
  /**
210
258
  * Clean up and deduplicate permissions array
@@ -226,12 +274,9 @@ declare function cleanupPermissions(templatePermissions: string[], userPermissio
226
274
  */
227
275
  declare function mergeAndCleanPermissions(templatePermissions: string[] | undefined, userPermissions: string[] | undefined): string[];
228
276
 
229
- declare function getPlatform(): 'windows' | 'macos' | 'linux';
230
- declare function commandExists(command: string): Promise<boolean>;
231
-
232
277
  declare function importRecommendedEnv(): Promise<void>;
233
278
  declare function importRecommendedPermissions(): Promise<void>;
234
279
  declare function openSettingsJson(): Promise<void>;
235
280
 
236
- export { AI_OUTPUT_LANGUAGES, API_DEFAULT_URL, API_ENV_KEY, CLAUDE_DIR, CLAUDE_MD_FILE, CLAUDE_VSC_CONFIG_FILE, CODEX_AGENTS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODEX_PROMPTS_DIR, CODE_TOOL_ALIASES, CODE_TOOL_BANNERS, CODE_TOOL_TYPES, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureApiKeyApproved, ensureClaudeDir, fixWindowsMcpConfig, getAiOutputLanguageLabel, getExistingApiConfig, getExistingModelConfig, getInstallationStatus, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, isCodeToolType, isLocalClaudeCodeInstalled, manageApiKeyApproval, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, promptApiConfigurationAction, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, resolveCodeToolType, setInstallMethod, setPrimaryApiKey, switchToOfficialLogin, updateCustomModel, updateDefaultModel, writeMcpConfig };
281
+ export { AI_OUTPUT_LANGUAGES, API_DEFAULT_URL, API_ENV_KEY, CLAUDE_DIR, CLAUDE_MD_FILE, CLAUDE_VSC_CONFIG_FILE, CODEX_AGENTS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODEX_PROMPTS_DIR, CODE_TOOL_ALIASES, CODE_TOOL_BANNERS, CODE_TOOL_TYPES, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, detectInstalledVersion, ensureApiKeyApproved, ensureClaudeDir, executeInstallMethod, fixWindowsMcpConfig, getAiOutputLanguageLabel, getExistingApiConfig, getExistingModelConfig, getInstallationStatus, getMcpConfigPath, getPlatform, handleInstallFailure, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, installCodex, isClaudeCodeInstalled, isCodeToolType, isCodexInstalled, isLocalClaudeCodeInstalled, manageApiKeyApproval, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, promptApiConfigurationAction, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, resolveCodeToolType, selectInstallMethod, setInstallMethod, setPrimaryApiKey, switchToOfficialLogin, uninstallCodeTool, updateCustomModel, updateDefaultModel, writeMcpConfig };
237
282
  export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang };
package/dist/index.d.ts CHANGED
@@ -137,6 +137,10 @@ interface ApiConfig {
137
137
  key: string;
138
138
  authType?: 'auth_token' | 'api_key';
139
139
  }
140
+ /**
141
+ * Installation method types for code tools
142
+ */
143
+ type InstallMethod = 'npm' | 'homebrew' | 'curl' | 'powershell' | 'cmd';
140
144
 
141
145
  declare function ensureClaudeDir(): void;
142
146
  declare function backupExistingConfig(): string | null;
@@ -181,8 +185,29 @@ declare function switchToOfficialLogin(): boolean;
181
185
  */
182
186
  declare function promptApiConfigurationAction(): Promise<'modify-partial' | 'modify-all' | 'keep-existing' | null>;
183
187
 
188
+ declare function getPlatform(): 'windows' | 'macos' | 'linux';
189
+ declare function commandExists(command: string): Promise<boolean>;
190
+ /**
191
+ * Get recommended install methods for a code tool based on current platform
192
+ * Returns methods in priority order (most recommended first)
193
+ */
194
+ type CodeType = 'claude-code' | 'codex';
195
+
184
196
  declare function isClaudeCodeInstalled(): Promise<boolean>;
185
- declare function installClaudeCode(): Promise<void>;
197
+ /**
198
+ * Install Claude Code with method selection support
199
+ * @param skipMethodSelection - If true, use default npm installation
200
+ */
201
+ declare function installClaudeCode(skipMethodSelection?: boolean): Promise<void>;
202
+ /**
203
+ * Check if Codex is installed
204
+ */
205
+ declare function isCodexInstalled(): Promise<boolean>;
206
+ /**
207
+ * Install Codex with method selection support
208
+ * @param skipMethodSelection - If true, use default npm installation
209
+ */
210
+ declare function installCodex(skipMethodSelection?: boolean): Promise<void>;
186
211
  /**
187
212
  * Check if local Claude Code installation exists
188
213
  */
@@ -201,10 +226,33 @@ declare function getInstallationStatus(): Promise<InstallationStatus>;
201
226
  */
202
227
  declare function removeLocalClaudeCode(): Promise<void>;
203
228
  /**
204
- * Set installMethod to 'npm' in ~/.claude.json
229
+ * Uninstall code tool based on install method
230
+ * @param codeType - Type of code tool to uninstall
231
+ * @returns true if uninstalled successfully
232
+ */
233
+ declare function uninstallCodeTool(codeType: CodeType): Promise<boolean>;
234
+ /**
235
+ * Set installMethod in both ~/.claude.json and zcf-config
205
236
  * This ensures Claude Code knows it was installed via npm for proper auto-updates
206
237
  */
207
- declare function setInstallMethod(method?: 'npm' | 'native'): Promise<void>;
238
+ declare function setInstallMethod(method?: InstallMethod | 'native', codeType?: CodeType): Promise<void>;
239
+ /**
240
+ * Detect installed version of a code tool
241
+ * Returns version string or null if not installed
242
+ */
243
+ declare function detectInstalledVersion(codeType: CodeType): Promise<string | null>;
244
+ /**
245
+ * Select installation method interactively
246
+ */
247
+ declare function selectInstallMethod(codeType: CodeType, excludeMethods?: InstallMethod[]): Promise<InstallMethod | null>;
248
+ /**
249
+ * Execute installation using specified method
250
+ */
251
+ declare function executeInstallMethod(method: InstallMethod, codeType: CodeType): Promise<boolean>;
252
+ /**
253
+ * Handle installation failure with retry options
254
+ */
255
+ declare function handleInstallFailure(codeType: CodeType, failedMethods: InstallMethod[]): Promise<boolean>;
208
256
 
209
257
  /**
210
258
  * Clean up and deduplicate permissions array
@@ -226,12 +274,9 @@ declare function cleanupPermissions(templatePermissions: string[], userPermissio
226
274
  */
227
275
  declare function mergeAndCleanPermissions(templatePermissions: string[] | undefined, userPermissions: string[] | undefined): string[];
228
276
 
229
- declare function getPlatform(): 'windows' | 'macos' | 'linux';
230
- declare function commandExists(command: string): Promise<boolean>;
231
-
232
277
  declare function importRecommendedEnv(): Promise<void>;
233
278
  declare function importRecommendedPermissions(): Promise<void>;
234
279
  declare function openSettingsJson(): Promise<void>;
235
280
 
236
- export { AI_OUTPUT_LANGUAGES, API_DEFAULT_URL, API_ENV_KEY, CLAUDE_DIR, CLAUDE_MD_FILE, CLAUDE_VSC_CONFIG_FILE, CODEX_AGENTS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODEX_PROMPTS_DIR, CODE_TOOL_ALIASES, CODE_TOOL_BANNERS, CODE_TOOL_TYPES, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureApiKeyApproved, ensureClaudeDir, fixWindowsMcpConfig, getAiOutputLanguageLabel, getExistingApiConfig, getExistingModelConfig, getInstallationStatus, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, isCodeToolType, isLocalClaudeCodeInstalled, manageApiKeyApproval, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, promptApiConfigurationAction, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, resolveCodeToolType, setInstallMethod, setPrimaryApiKey, switchToOfficialLogin, updateCustomModel, updateDefaultModel, writeMcpConfig };
281
+ export { AI_OUTPUT_LANGUAGES, API_DEFAULT_URL, API_ENV_KEY, CLAUDE_DIR, CLAUDE_MD_FILE, CLAUDE_VSC_CONFIG_FILE, CODEX_AGENTS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODEX_PROMPTS_DIR, CODE_TOOL_ALIASES, CODE_TOOL_BANNERS, CODE_TOOL_TYPES, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, detectInstalledVersion, ensureApiKeyApproved, ensureClaudeDir, executeInstallMethod, fixWindowsMcpConfig, getAiOutputLanguageLabel, getExistingApiConfig, getExistingModelConfig, getInstallationStatus, getMcpConfigPath, getPlatform, handleInstallFailure, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, installCodex, isClaudeCodeInstalled, isCodeToolType, isCodexInstalled, isLocalClaudeCodeInstalled, manageApiKeyApproval, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, promptApiConfigurationAction, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, resolveCodeToolType, selectInstallMethod, setInstallMethod, setPrimaryApiKey, switchToOfficialLogin, uninstallCodeTool, updateCustomModel, updateDefaultModel, writeMcpConfig };
237
282
  export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { z as AI_OUTPUT_LANGUAGES, A as API_DEFAULT_URL, v as API_ENV_KEY, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, h as CLAUDE_VSC_CONFIG_FILE, n as CODEX_AGENTS_FILE, l as CODEX_AUTH_FILE, k as CODEX_CONFIG_FILE, j as CODEX_DIR, p as CODEX_PROMPTS_DIR, t as CODE_TOOL_ALIASES, s as CODE_TOOL_BANNERS, r as CODE_TOOL_TYPES, f as ClAUDE_CONFIG_FILE, D as DEFAULT_CODE_TOOL_TYPE, y as LANG_LABELS, L as LEGACY_ZCF_CONFIG_FILES, S as SETTINGS_FILE, x as SUPPORTED_LANGS, Z as ZCF_CONFIG_DIR, q as ZCF_CONFIG_FILE, M as addCompletedOnboarding, a1 as applyAiLanguageDirective, T as backupExistingConfig, H as backupMcpConfig, J as buildMcpServerConfig, c as cleanupPermissions, a as commandExists, V as configureApi, U as copyConfigFiles, N as ensureApiKeyApproved, R as ensureClaudeDir, K as fixWindowsMcpConfig, B as getAiOutputLanguageLabel, a0 as getExistingApiConfig, $ as getExistingModelConfig, a7 as getInstallationStatus, E as getMcpConfigPath, g as getPlatform, b as importRecommendedEnv, d as importRecommendedPermissions, i as init, a5 as installClaudeCode, a4 as isClaudeCodeInstalled, u as isCodeToolType, a6 as isLocalClaudeCodeInstalled, P as manageApiKeyApproval, m as mergeAndCleanPermissions, W as mergeConfigs, I as mergeMcpServers, _ as mergeSettingsFile, o as openSettingsJson, a3 as promptApiConfigurationAction, F as readMcpConfig, O as removeApiKeyFromRejected, a8 as removeLocalClaudeCode, w as resolveCodeToolType, a9 as setInstallMethod, Q as setPrimaryApiKey, a2 as switchToOfficialLogin, X as updateCustomModel, Y as updateDefaultModel, G as writeMcpConfig } from './chunks/simple-config.mjs';
1
+ export { z as AI_OUTPUT_LANGUAGES, A as API_DEFAULT_URL, v as API_ENV_KEY, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, h as CLAUDE_VSC_CONFIG_FILE, n as CODEX_AGENTS_FILE, l as CODEX_AUTH_FILE, k as CODEX_CONFIG_FILE, j as CODEX_DIR, p as CODEX_PROMPTS_DIR, t as CODE_TOOL_ALIASES, s as CODE_TOOL_BANNERS, r as CODE_TOOL_TYPES, f as ClAUDE_CONFIG_FILE, D as DEFAULT_CODE_TOOL_TYPE, y as LANG_LABELS, L as LEGACY_ZCF_CONFIG_FILES, S as SETTINGS_FILE, x as SUPPORTED_LANGS, Z as ZCF_CONFIG_DIR, q as ZCF_CONFIG_FILE, M as addCompletedOnboarding, a1 as applyAiLanguageDirective, T as backupExistingConfig, H as backupMcpConfig, J as buildMcpServerConfig, c as cleanupPermissions, a as commandExists, V as configureApi, U as copyConfigFiles, ad as detectInstalledVersion, N as ensureApiKeyApproved, R as ensureClaudeDir, af as executeInstallMethod, K as fixWindowsMcpConfig, B as getAiOutputLanguageLabel, a0 as getExistingApiConfig, $ as getExistingModelConfig, a9 as getInstallationStatus, E as getMcpConfigPath, g as getPlatform, ag as handleInstallFailure, b as importRecommendedEnv, d as importRecommendedPermissions, i as init, a5 as installClaudeCode, a7 as installCodex, a4 as isClaudeCodeInstalled, u as isCodeToolType, a6 as isCodexInstalled, a8 as isLocalClaudeCodeInstalled, P as manageApiKeyApproval, m as mergeAndCleanPermissions, W as mergeConfigs, I as mergeMcpServers, _ as mergeSettingsFile, o as openSettingsJson, a3 as promptApiConfigurationAction, F as readMcpConfig, O as removeApiKeyFromRejected, aa as removeLocalClaudeCode, w as resolveCodeToolType, ae as selectInstallMethod, ac as setInstallMethod, Q as setPrimaryApiKey, a2 as switchToOfficialLogin, ab as uninstallCodeTool, X as updateCustomModel, Y as updateDefaultModel, G as writeMcpConfig } from './chunks/simple-config.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:process';
4
4
  import 'ansis';
@@ -9,6 +9,7 @@ import 'node:util';
9
9
  import 'dayjs';
10
10
  import 'pathe';
11
11
  import 'node:url';
12
+ import 'inquirer-toggle';
12
13
  import 'ora';
13
14
  import 'semver';
14
15
  import 'smol-toml';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zcf",
3
3
  "type": "module",
4
- "version": "3.3.3",
4
+ "version": "3.4.0",
5
5
  "description": "Zero-Config Code Flow - One-click configuration tool for Code Cli",
6
6
  "author": {
7
7
  "name": "Miao Da",
@@ -52,6 +52,7 @@
52
52
  "i18next": "^25.5.2",
53
53
  "i18next-fs-backend": "^2.6.0",
54
54
  "inquirer": "^12.9.6",
55
+ "inquirer-toggle": "^1.0.1",
55
56
  "ora": "^9.0.0",
56
57
  "pathe": "^2.0.3",
57
58
  "semver": "^7.7.2",