zcf 3.4.0 → 3.4.2

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 { 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';
4
+ import { ak as ensureI18nInitialized, al as i18n, aN as readCcrConfig, aI as isCcrInstalled, aJ as installCcr, aO as configureCcrFeature, ao as promptBoolean, aP as handleExitPromptError, aQ as handleGeneralError, aR as COMETIX_COMMAND_NAME, aS as COMETIX_COMMANDS, aT as installCometixLine, am as addNumbersToChoices, aU as checkAndUpdateTools, aV as runCodexUpdate, aW as resolveCodeType$1, at as readJsonConfig, aX as writeJsonConfig, q as ZCF_CONFIG_FILE, aD as readZcfConfig, D as DEFAULT_CODE_TOOL_TYPE, u as isCodeToolType, aY as displayBanner, aB as updateZcfConfig, aZ as version, a_ as resolveAiOutputLanguage, a$ as updatePromptOnly, b0 as selectAndInstallWorkflows, b1 as checkClaudeCodeVersionAndPrompt, w as resolveCodeToolType$1, b2 as displayBannerWithInfo, s as CODE_TOOL_BANNERS, b3 as runCodexUninstall, b4 as configureCodexMcp, b5 as configureCodexApi, b6 as runCodexWorkflowImportWithLanguageSelection, b7 as runCodexFullInit, i as init, b8 as switchCodexProvider, b9 as listCodexProviders, ax as readCodexConfig, ba as switchToOfficialLogin, bb as switchToProvider, bc as readZcfConfigAsync, bd as initI18n, be as selectScriptLanguage, aC 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';
@@ -687,7 +687,7 @@ class ZcfUninstaller {
687
687
  result.removed.push(".claude.json (includes MCP configuration)");
688
688
  }
689
689
  try {
690
- const { uninstallCodeTool } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bk; });
690
+ const { uninstallCodeTool } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bn; });
691
691
  const success = await uninstallCodeTool("claude-code");
692
692
  if (success) {
693
693
  result.removed.push("@anthropic-ai/claude-code");
@@ -923,7 +923,7 @@ async function uninstall(options = {}) {
923
923
  }
924
924
  const uninstaller = new ZcfUninstaller(options.lang || "en");
925
925
  if (codeType === "codex") {
926
- const { runCodexUninstall } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bj; });
926
+ const { runCodexUninstall } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bm; });
927
927
  await runCodexUninstall();
928
928
  return;
929
929
  }
@@ -1193,7 +1193,7 @@ async function update(options = {}) {
1193
1193
  }
1194
1194
  return;
1195
1195
  }
1196
- const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bi; });
1196
+ const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.bl; });
1197
1197
  const configLang = await resolveTemplateLanguage(
1198
1198
  options.configLang,
1199
1199
  // Command line option
@@ -1627,8 +1627,8 @@ async function listCodexProvidersWithDisplay() {
1627
1627
  const current = isCurrent ? ansis.yellow(` (${i18n.t("common:current")})`) : "";
1628
1628
  console.log(`${status}${ansis.white(provider.name)}${current}`);
1629
1629
  console.log(` ${ansis.cyan(`ID: ${provider.id}`)} ${ansis.gray(`(${provider.baseUrl})`)}`);
1630
- if (provider.envKey) {
1631
- console.log(` ${ansis.gray(`Env: ${provider.envKey}`)}`);
1630
+ if (provider.tempEnvKey) {
1631
+ console.log(` ${ansis.gray(`Env: ${provider.tempEnvKey}`)}`);
1632
1632
  }
1633
1633
  console.log();
1634
1634
  });
@@ -3,6 +3,10 @@
3
3
  "alreadyInstalled": "⚠️ Codex CLI already installed, skipping installation",
4
4
  "updatingCli": "🔄 Updating Codex CLI...",
5
5
  "updateSuccess": "✔ Codex CLI updated",
6
+ "detectedHomebrew": "Detected Codex installed via Homebrew, will update using Homebrew",
7
+ "detectedNpm": "Detected Codex installed via npm, will update using npm",
8
+ "unknownInstallMethod": "⚠️ Unable to detect Codex installation method",
9
+ "fallingBackToNpm": "Falling back to npm update method",
6
10
  "workflowInstall": "✔ Codex workflow templates installed",
7
11
  "backupSuccess": "✔ Backup created at {{path}}",
8
12
  "apiModePrompt": "Select API configuration mode",
@@ -115,5 +119,6 @@
115
119
  "providerManager.providerNameRequired": "Provider name is required",
116
120
  "providerManager.baseUrlRequired": "Base URL is required",
117
121
  "providerManager.wireApiInvalid": "Wire API must be either \"responses\" or \"chat\"",
118
- "providerManager.unknownError": "Unknown error"
122
+ "providerManager.unknownError": "Unknown error",
123
+ "envKeyMigrationComplete": "✔ env_key to temp_env_key migration completed"
119
124
  }
@@ -15,5 +15,6 @@
15
15
  "backupCreated": "📁 Configuration backup created: {{path}}",
16
16
  "current": "current",
17
17
  "claudeCode": "Claude Code",
18
- "codex": "Codex"
18
+ "codex": "Codex",
19
+ "yes": "Yes"
19
20
  }
@@ -62,6 +62,8 @@
62
62
  "selectMemoryOption": "Select configuration option",
63
63
  "selectOutputStyles": "Select output styles to install",
64
64
  "selectedStyles": "Selected styles",
65
+ "singleConfigSaved": "Configuration {{name}} saved",
66
+ "singleConfigSaveFailed": "Failed to save configuration",
65
67
  "updateDocsOnly": "Update workflow-related md files only with backup",
66
68
  "updatingPrompts": "Updating Claude Code memory documents...",
67
69
  "enterCustomModel": "Enter custom model name",
@@ -32,6 +32,12 @@
32
32
  "wslInstallSuccess": "Claude Code successfully installed in WSL environment",
33
33
  "selectInstallMethod": "Please select installation method for {{codeType}}:",
34
34
  "recommendedMethod": "Recommended",
35
+ "notRecommended": "Not Recommended",
36
+ "installMethodNpm": "npm",
37
+ "installMethodHomebrew": "homebrew",
38
+ "installMethodCurl": "curl",
39
+ "installMethodPowershell": "powershell",
40
+ "installMethodCmd": "cmd",
35
41
  "installingWith": "Installing {{codeType}} using {{method}}...",
36
42
  "installMethodSuccess": "Successfully installed using {{method}}",
37
43
  "installMethodFailed": "Failed to install using {{method}}",
@@ -43,5 +49,32 @@
43
49
  "uninstallFailed": "Failed to uninstall using {{method}}",
44
50
  "manualUninstallRequired": "{{codeType}} requires manual uninstallation",
45
51
  "binaryLocation": "Binary location: {{path}}",
46
- "failedToLocateBinary": "Failed to locate {{command}} binary"
52
+ "failedToLocateBinary": "Failed to locate {{command}} binary",
53
+ "verificationSuccess": "installation verified successfully",
54
+ "verificationFailed": "installation verification failed",
55
+ "symlinkCreated": "Symlink created at {{path}}",
56
+ "foundAtPath": "Found at: {{path}}",
57
+ "manualSymlinkHint": "You may need to manually add the tool to your PATH or create a symlink",
58
+ "duplicateInstallationsDetected": "⚠️ Multiple Claude Code installations detected",
59
+ "duplicateInstallationsWarning": "Having multiple installations may cause version confusion and update issues",
60
+ "currentActiveInstallation": "Current active installation",
61
+ "inactiveInstallations": "Inactive installations",
62
+ "installationSource": "Installation source",
63
+ "installationPath": "Path",
64
+ "installationVersion": "Version",
65
+ "sourceHomebrewCask": "Homebrew Cask",
66
+ "sourceNpm": "npm global",
67
+ "sourceNpmHomebrewNode": "npm (via Homebrew Node)",
68
+ "sourceCurl": "curl installation",
69
+ "sourceOther": "Other",
70
+ "recommendRemoveNpm": "Recommend removing npm installation to maintain single installation source",
71
+ "confirmRemoveDuplicate": "Remove redundant {source}?",
72
+ "removingDuplicateInstallation": "Removing redundant installation...",
73
+ "duplicateRemoved": "Redundant installation removed",
74
+ "duplicateRemovalFailed": "Failed to remove redundant installation",
75
+ "keepBothInstallations": "Keep both installations (not recommended)",
76
+ "duplicateWarningContinue": "Acknowledged duplicate installation risk, continue",
77
+ "versionMismatchWarning": "⚠️ Version mismatch: npm is {npmVersion}, Homebrew is {homebrewVersion}",
78
+ "activatingHomebrew": "Activating Homebrew installation...",
79
+ "autoRemovingNpm": "Silent mode: Auto-removing npm installation and keeping Homebrew..."
47
80
  }
@@ -3,6 +3,10 @@
3
3
  "alreadyInstalled": "⚠️ Codex CLI 已安装,跳过安装步骤",
4
4
  "updatingCli": "🔄 正在更新 Codex CLI...",
5
5
  "updateSuccess": "✔ Codex CLI 更新完成",
6
+ "detectedHomebrew": "检测到 Codex 通过 Homebrew 安装,将使用 Homebrew 更新",
7
+ "detectedNpm": "检测到 Codex 通过 npm 安装,将使用 npm 更新",
8
+ "unknownInstallMethod": "⚠️ 无法检测 Codex 安装方式",
9
+ "fallingBackToNpm": "回退到 npm 更新方式",
6
10
  "workflowInstall": "✔ 已安装 Codex 工作流模板",
7
11
  "backupSuccess": "✔ 已创建备份 {{path}}",
8
12
  "apiModePrompt": "请选择 API 配置模式",
@@ -115,5 +119,6 @@
115
119
  "providerManager.providerNameRequired": "提供商名称是必需的",
116
120
  "providerManager.baseUrlRequired": "基础 URL 是必需的",
117
121
  "providerManager.wireApiInvalid": "Wire API 必须是 \"responses\" 或 \"chat\"",
118
- "providerManager.unknownError": "未知错误"
122
+ "providerManager.unknownError": "未知错误",
123
+ "envKeyMigrationComplete": "✔ 已完成 env_key 到 temp_env_key 的迁移"
119
124
  }
@@ -15,5 +15,6 @@
15
15
  "backupCreated": "📁 已创建配置备份:{{path}}",
16
16
  "current": "当前",
17
17
  "claudeCode": "Claude Code",
18
- "codex": "Codex"
18
+ "codex": "Codex",
19
+ "yes": "是"
19
20
  }
@@ -62,6 +62,8 @@
62
62
  "selectMemoryOption": "选择配置选项",
63
63
  "selectOutputStyles": "选择要安装的输出风格",
64
64
  "selectedStyles": "已选择风格",
65
+ "singleConfigSaved": "配置 {{name}} 已保存",
66
+ "singleConfigSaveFailed": "配置保存失败",
65
67
  "updateDocsOnly": "仅更新工作流相关md并备份旧配置",
66
68
  "updatingPrompts": "正在更新 Claude Code 记忆文档...",
67
69
  "enterCustomModel": "请输入自定义模型名称",
@@ -32,6 +32,12 @@
32
32
  "wslInstallSuccess": "Claude Code 已成功安装在 WSL 环境中",
33
33
  "selectInstallMethod": "请选择 {{codeType}} 的安装方式:",
34
34
  "recommendedMethod": "推荐",
35
+ "notRecommended": "不推荐",
36
+ "installMethodNpm": "npm",
37
+ "installMethodHomebrew": "homebrew",
38
+ "installMethodCurl": "curl",
39
+ "installMethodPowershell": "powershell",
40
+ "installMethodCmd": "cmd",
35
41
  "installingWith": "正在使用 {{method}} 安装 {{codeType}}...",
36
42
  "installMethodSuccess": "使用 {{method}} 安装成功",
37
43
  "installMethodFailed": "使用 {{method}} 安装失败",
@@ -43,5 +49,32 @@
43
49
  "uninstallFailed": "使用 {{method}} 卸载失败",
44
50
  "manualUninstallRequired": "{{codeType}} 需要手动卸载",
45
51
  "binaryLocation": "可执行文件位置:{{path}}",
46
- "failedToLocateBinary": "无法定位 {{command}} 可执行文件"
52
+ "failedToLocateBinary": "无法定位 {{command}} 可执行文件",
53
+ "verificationSuccess": "安装验证成功",
54
+ "verificationFailed": "安装验证失败",
55
+ "symlinkCreated": "已在 {{path}} 创建符号链接",
56
+ "foundAtPath": "在此路径找到: {{path}}",
57
+ "manualSymlinkHint": "您可能需要手动将工具添加到 PATH 或创建符号链接",
58
+ "duplicateInstallationsDetected": "⚠️ 检测到多个 Claude Code 安装",
59
+ "duplicateInstallationsWarning": "同时存在多个安装可能导致版本混乱和更新异常",
60
+ "currentActiveInstallation": "当前活动安装",
61
+ "inactiveInstallations": "未激活的安装",
62
+ "installationSource": "安装来源",
63
+ "installationPath": "路径",
64
+ "installationVersion": "版本",
65
+ "sourceHomebrewCask": "Homebrew Cask",
66
+ "sourceNpm": "npm 全局安装",
67
+ "sourceNpmHomebrewNode": "npm (通过 Homebrew Node)",
68
+ "sourceCurl": "curl 安装",
69
+ "sourceOther": "其他",
70
+ "recommendRemoveNpm": "建议删除 npm 安装以保持单一安装源",
71
+ "confirmRemoveDuplicate": "是否删除冗余的 {source}?",
72
+ "removingDuplicateInstallation": "正在删除冗余安装...",
73
+ "duplicateRemoved": "冗余安装已删除",
74
+ "duplicateRemovalFailed": "删除冗余安装失败",
75
+ "keepBothInstallations": "保留两个安装(不推荐)",
76
+ "duplicateWarningContinue": "已知晓多重安装风险,继续使用",
77
+ "versionMismatchWarning": "⚠️ 版本不一致:npm 版本为 {npmVersion},Homebrew 版本为 {homebrewVersion}",
78
+ "activatingHomebrew": "正在激活 Homebrew 安装...",
79
+ "autoRemovingNpm": "静默模式:自动删除 npm 安装并保留 Homebrew..."
47
80
  }
package/dist/index.d.mts CHANGED
@@ -65,6 +65,15 @@ interface InitOptions {
65
65
  }
66
66
  declare function init(options?: InitOptions): Promise<void>;
67
67
 
68
+ declare function getPlatform(): 'windows' | 'macos' | 'linux';
69
+ declare function commandExists(command: string): Promise<boolean>;
70
+ /**
71
+ * Get recommended install methods for a code tool based on current platform
72
+ * Returns methods in priority order (most recommended first)
73
+ */
74
+ type CodeType = 'claude-code' | 'codex';
75
+ type InstallMethod$1 = 'npm' | 'homebrew' | 'curl' | 'powershell' | 'cmd' | 'npm-global' | 'native';
76
+
68
77
  interface McpService {
69
78
  id: string;
70
79
  name: string;
@@ -92,7 +101,7 @@ interface ClaudeConfiguration {
92
101
  };
93
102
  env?: Record<string, string>;
94
103
  primaryApiKey?: string;
95
- installMethod?: 'npm' | 'native';
104
+ installMethod?: InstallMethod$1;
96
105
  }
97
106
 
98
107
  declare function getMcpConfigPath(): string;
@@ -185,14 +194,6 @@ declare function switchToOfficialLogin(): boolean;
185
194
  */
186
195
  declare function promptApiConfigurationAction(): Promise<'modify-partial' | 'modify-all' | 'keep-existing' | null>;
187
196
 
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
-
196
197
  declare function isClaudeCodeInstalled(): Promise<boolean>;
197
198
  /**
198
199
  * Install Claude Code with method selection support
@@ -235,7 +236,7 @@ declare function uninstallCodeTool(codeType: CodeType): Promise<boolean>;
235
236
  * Set installMethod in both ~/.claude.json and zcf-config
236
237
  * This ensures Claude Code knows it was installed via npm for proper auto-updates
237
238
  */
238
- declare function setInstallMethod(method?: InstallMethod | 'native', codeType?: CodeType): Promise<void>;
239
+ declare function setInstallMethod(method: InstallMethod, codeType?: CodeType): Promise<void>;
239
240
  /**
240
241
  * Detect installed version of a code tool
241
242
  * Returns version string or null if not installed
@@ -253,6 +254,40 @@ declare function executeInstallMethod(method: InstallMethod, codeType: CodeType)
253
254
  * Handle installation failure with retry options
254
255
  */
255
256
  declare function handleInstallFailure(codeType: CodeType, failedMethods: InstallMethod[]): Promise<boolean>;
257
+ /**
258
+ * Installation verification result
259
+ */
260
+ interface VerificationResult {
261
+ success: boolean;
262
+ commandPath: string | null;
263
+ version: string | null;
264
+ needsSymlink: boolean;
265
+ symlinkCreated: boolean;
266
+ error?: string;
267
+ }
268
+ /**
269
+ * Verify installation by checking command availability and version
270
+ * If command is not in PATH but found in Homebrew paths, attempt to create symlink
271
+ */
272
+ declare function verifyInstallation(codeType: CodeType): Promise<VerificationResult>;
273
+ /**
274
+ * Symlink creation result
275
+ */
276
+ interface SymlinkResult {
277
+ success: boolean;
278
+ symlinkPath: string | null;
279
+ error?: string;
280
+ }
281
+ /**
282
+ * Create symlink in Homebrew bin directory for commands installed via npm
283
+ * This handles the case where npm global packages are installed to
284
+ * /opt/homebrew/Cellar/node/{version}/bin/ but that path is not in the user's PATH
285
+ */
286
+ declare function createHomebrewSymlink(command: string, sourcePath: string): Promise<SymlinkResult>;
287
+ /**
288
+ * Display verification result to user with appropriate messages
289
+ */
290
+ declare function displayVerificationResult(result: VerificationResult, codeType: CodeType): void;
256
291
 
257
292
  /**
258
293
  * Clean up and deduplicate permissions array
@@ -278,5 +313,5 @@ declare function importRecommendedEnv(): Promise<void>;
278
313
  declare function importRecommendedPermissions(): Promise<void>;
279
314
  declare function openSettingsJson(): Promise<void>;
280
315
 
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 };
282
- export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang };
316
+ 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, createHomebrewSymlink, detectInstalledVersion, displayVerificationResult, 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, verifyInstallation, writeMcpConfig };
317
+ export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang, VerificationResult };
package/dist/index.d.ts CHANGED
@@ -65,6 +65,15 @@ interface InitOptions {
65
65
  }
66
66
  declare function init(options?: InitOptions): Promise<void>;
67
67
 
68
+ declare function getPlatform(): 'windows' | 'macos' | 'linux';
69
+ declare function commandExists(command: string): Promise<boolean>;
70
+ /**
71
+ * Get recommended install methods for a code tool based on current platform
72
+ * Returns methods in priority order (most recommended first)
73
+ */
74
+ type CodeType = 'claude-code' | 'codex';
75
+ type InstallMethod$1 = 'npm' | 'homebrew' | 'curl' | 'powershell' | 'cmd' | 'npm-global' | 'native';
76
+
68
77
  interface McpService {
69
78
  id: string;
70
79
  name: string;
@@ -92,7 +101,7 @@ interface ClaudeConfiguration {
92
101
  };
93
102
  env?: Record<string, string>;
94
103
  primaryApiKey?: string;
95
- installMethod?: 'npm' | 'native';
104
+ installMethod?: InstallMethod$1;
96
105
  }
97
106
 
98
107
  declare function getMcpConfigPath(): string;
@@ -185,14 +194,6 @@ declare function switchToOfficialLogin(): boolean;
185
194
  */
186
195
  declare function promptApiConfigurationAction(): Promise<'modify-partial' | 'modify-all' | 'keep-existing' | null>;
187
196
 
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
-
196
197
  declare function isClaudeCodeInstalled(): Promise<boolean>;
197
198
  /**
198
199
  * Install Claude Code with method selection support
@@ -235,7 +236,7 @@ declare function uninstallCodeTool(codeType: CodeType): Promise<boolean>;
235
236
  * Set installMethod in both ~/.claude.json and zcf-config
236
237
  * This ensures Claude Code knows it was installed via npm for proper auto-updates
237
238
  */
238
- declare function setInstallMethod(method?: InstallMethod | 'native', codeType?: CodeType): Promise<void>;
239
+ declare function setInstallMethod(method: InstallMethod, codeType?: CodeType): Promise<void>;
239
240
  /**
240
241
  * Detect installed version of a code tool
241
242
  * Returns version string or null if not installed
@@ -253,6 +254,40 @@ declare function executeInstallMethod(method: InstallMethod, codeType: CodeType)
253
254
  * Handle installation failure with retry options
254
255
  */
255
256
  declare function handleInstallFailure(codeType: CodeType, failedMethods: InstallMethod[]): Promise<boolean>;
257
+ /**
258
+ * Installation verification result
259
+ */
260
+ interface VerificationResult {
261
+ success: boolean;
262
+ commandPath: string | null;
263
+ version: string | null;
264
+ needsSymlink: boolean;
265
+ symlinkCreated: boolean;
266
+ error?: string;
267
+ }
268
+ /**
269
+ * Verify installation by checking command availability and version
270
+ * If command is not in PATH but found in Homebrew paths, attempt to create symlink
271
+ */
272
+ declare function verifyInstallation(codeType: CodeType): Promise<VerificationResult>;
273
+ /**
274
+ * Symlink creation result
275
+ */
276
+ interface SymlinkResult {
277
+ success: boolean;
278
+ symlinkPath: string | null;
279
+ error?: string;
280
+ }
281
+ /**
282
+ * Create symlink in Homebrew bin directory for commands installed via npm
283
+ * This handles the case where npm global packages are installed to
284
+ * /opt/homebrew/Cellar/node/{version}/bin/ but that path is not in the user's PATH
285
+ */
286
+ declare function createHomebrewSymlink(command: string, sourcePath: string): Promise<SymlinkResult>;
287
+ /**
288
+ * Display verification result to user with appropriate messages
289
+ */
290
+ declare function displayVerificationResult(result: VerificationResult, codeType: CodeType): void;
256
291
 
257
292
  /**
258
293
  * Clean up and deduplicate permissions array
@@ -278,5 +313,5 @@ declare function importRecommendedEnv(): Promise<void>;
278
313
  declare function importRecommendedPermissions(): Promise<void>;
279
314
  declare function openSettingsJson(): Promise<void>;
280
315
 
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 };
282
- export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang };
316
+ 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, createHomebrewSymlink, detectInstalledVersion, displayVerificationResult, 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, verifyInstallation, writeMcpConfig };
317
+ export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang, VerificationResult };
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, 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';
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, ai as createHomebrewSymlink, ad as detectInstalledVersion, aj as displayVerificationResult, 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, ah as verifyInstallation, G as writeMcpConfig } from './chunks/simple-config.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:process';
4
4
  import 'ansis';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zcf",
3
3
  "type": "module",
4
- "version": "3.4.0",
4
+ "version": "3.4.2",
5
5
  "description": "Zero-Config Code Flow - One-click configuration tool for Code Cli",
6
6
  "author": {
7
7
  "name": "Miao Da",