zcf 2.9.5 → 2.9.7

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/README.md CHANGED
@@ -27,6 +27,7 @@ Menu options include:
27
27
  - `3-7` Configuration management (API/CCR, MCP, Model settings, AI personality, etc.)
28
28
  - `R` Claude Code Router management (enhanced in v2.8.1)
29
29
  - `U` ccusage - Claude Code usage analysis
30
+ - `+` Check updates - Check and update Claude Code and CCR versions
30
31
  - More features...
31
32
 
32
33
  ### Or, use direct commands:
@@ -86,6 +87,8 @@ Check for updates (v2.8.1+):
86
87
 
87
88
  ```bash
88
89
  npx zcf check-updates # Check and update Claude Code and CCR to latest versions
90
+ # or
91
+ npx zcf → select +
89
92
  ```
90
93
 
91
94
  CCR menu options:
@@ -512,6 +515,13 @@ If you find this project helpful, please consider sponsoring its development. Yo
512
515
  </tr>
513
516
  </table>
514
517
 
518
+ ### Our Sponsors
519
+
520
+ A huge thank you to all our sponsors for their generous support!
521
+
522
+ - Tc (first sponsor)
523
+ - 16°C 咖啡 (My best friend🤪, offered Claude Code max $200 package)
524
+
515
525
  ## 📄 License
516
526
 
517
527
  MIT License
@@ -8,17 +8,14 @@ import { exec } from 'tinyexec';
8
8
  import { exec as exec$1 } from 'child_process';
9
9
  import { promisify } from 'util';
10
10
  import ora from 'ora';
11
- import { readFile as readFile$1, writeFile as writeFile$1, mkdir } from 'fs/promises';
12
- import { join as join$1 } from 'path';
13
- import { homedir as homedir$1 } from 'os';
14
11
  import semver from 'semver';
15
- import { rm, mkdir as mkdir$1, copyFile as copyFile$1 } from 'node:fs/promises';
12
+ import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
16
13
  import { exec as exec$2 } from 'node:child_process';
17
14
  import { promisify as promisify$1 } from 'node:util';
18
15
  import { homedir, platform } from 'node:os';
19
- import { join as join$2 } from 'node:path';
16
+ import { join as join$1 } from 'node:path';
20
17
 
21
- const version = "2.9.5";
18
+ const version = "2.9.7";
22
19
  const homepage = "https://github.com/UfoMiao/zcf";
23
20
 
24
21
  const common$1 = {
@@ -218,6 +215,7 @@ const menu$1 = {
218
215
  ccusage: "ccusage",
219
216
  installBmad: "\u5B89\u88C5 BMad Method",
220
217
  clearCache: "\u6E05\u9664\u504F\u597D\u7F13\u5B58",
218
+ checkUpdates: "\u68C0\u67E5\u66F4\u65B0",
221
219
  changeLanguage: "\u66F4\u6539\u663E\u793A\u8BED\u8A00 / Select display language",
222
220
  exit: "\u9000\u51FA"
223
221
  },
@@ -235,6 +233,7 @@ const menu$1 = {
235
233
  ccusage: "Claude Code \u7528\u91CF\u5206\u6790",
236
234
  installBmad: "AI \u9A71\u52A8\u7684\u5F00\u53D1\u65B9\u6CD5\u8BBA\u6846\u67B6",
237
235
  clearCache: "\u6E05\u9664\u504F\u597D\u8BED\u8A00\u7B49\u7F13\u5B58",
236
+ checkUpdates: "\u68C0\u67E5\u5E76\u66F4\u65B0 Claude Code \u548C CCR \u7684\u7248\u672C",
238
237
  changeLanguage: "\u66F4\u6539 ZCF \u754C\u9762\u8BED\u8A00"
239
238
  }
240
239
  };
@@ -683,6 +682,7 @@ const menu = {
683
682
  ccusage: "ccusage",
684
683
  installBmad: "Install BMad Method",
685
684
  clearCache: "Clear preference cache",
685
+ checkUpdates: "Check updates",
686
686
  changeLanguage: "Select display language / \u66F4\u6539\u663E\u793A\u8BED\u8A00",
687
687
  exit: "Exit"
688
688
  },
@@ -700,6 +700,7 @@ const menu = {
700
700
  ccusage: "Claude Code usage analysis",
701
701
  installBmad: "AI-driven development methodology framework",
702
702
  clearCache: "Clear preference language and other caches",
703
+ checkUpdates: "Check and update Claude Code and CCR versions",
703
704
  changeLanguage: "Change ZCF interface language"
704
705
  }
705
706
  };
@@ -2047,27 +2048,6 @@ function format(template, replacements) {
2047
2048
  }
2048
2049
 
2049
2050
  const execAsync$3 = promisify(exec$1);
2050
- const CACHE_DIR = join$1(homedir$1(), ".claude", "cache");
2051
- const CACHE_FILE = join$1(CACHE_DIR, "version-cache.json");
2052
- const CACHE_DURATION = 24 * 60 * 60 * 1e3;
2053
- async function ensureCacheDir() {
2054
- try {
2055
- await mkdir(CACHE_DIR, { recursive: true });
2056
- } catch (error) {
2057
- }
2058
- }
2059
- async function readCache() {
2060
- try {
2061
- const content = await readFile$1(CACHE_FILE, "utf-8");
2062
- return JSON.parse(content);
2063
- } catch {
2064
- return {};
2065
- }
2066
- }
2067
- async function writeCache(cache) {
2068
- await ensureCacheDir();
2069
- await writeFile$1(CACHE_FILE, JSON.stringify(cache, null, 2));
2070
- }
2071
2051
  async function getInstalledVersion(command) {
2072
2052
  try {
2073
2053
  let stdout;
@@ -2084,24 +2064,10 @@ async function getInstalledVersion(command) {
2084
2064
  return null;
2085
2065
  }
2086
2066
  }
2087
- async function getLatestVersion(packageName, useCache = true) {
2088
- if (useCache) {
2089
- const cache = await readCache();
2090
- const cached = cache[packageName];
2091
- if (cached && Date.now() - cached.checkedAt < CACHE_DURATION) {
2092
- return cached.version;
2093
- }
2094
- }
2067
+ async function getLatestVersion(packageName) {
2095
2068
  try {
2096
2069
  const { stdout } = await execAsync$3(`npm view ${packageName} version`);
2097
- const version = stdout.trim();
2098
- const cache = await readCache();
2099
- cache[packageName] = {
2100
- version,
2101
- checkedAt: Date.now()
2102
- };
2103
- await writeCache(cache);
2104
- return version;
2070
+ return stdout.trim();
2105
2071
  } catch {
2106
2072
  return null;
2107
2073
  }
@@ -2493,7 +2459,7 @@ async function installWorkflowWithDependencies(config, configLang, scriptLang) {
2493
2459
  \u{1F4E6} ${i18n.workflow.installingWorkflow}: ${workflowName}...`));
2494
2460
  const commandsDir = join(CLAUDE_DIR, "commands", "zcf");
2495
2461
  if (!existsSync(commandsDir)) {
2496
- await mkdir$1(commandsDir, { recursive: true });
2462
+ await mkdir(commandsDir, { recursive: true });
2497
2463
  }
2498
2464
  for (const commandFile of config.commands) {
2499
2465
  const commandSource = join(rootDir, "templates", configLang, "workflow", config.category, "commands", commandFile);
@@ -2515,7 +2481,7 @@ async function installWorkflowWithDependencies(config, configLang, scriptLang) {
2515
2481
  if (config.autoInstallAgents && config.agents.length > 0) {
2516
2482
  const agentsCategoryDir = join(CLAUDE_DIR, "agents", "zcf", config.category);
2517
2483
  if (!existsSync(agentsCategoryDir)) {
2518
- await mkdir$1(agentsCategoryDir, { recursive: true });
2484
+ await mkdir(agentsCategoryDir, { recursive: true });
2519
2485
  }
2520
2486
  for (const agent of config.agents) {
2521
2487
  const agentSource = join(rootDir, "templates", configLang, "workflow", config.category, "agents", agent.filename);
@@ -2792,8 +2758,8 @@ function getFallbackPresets() {
2792
2758
  }
2793
2759
 
2794
2760
  const execAsync = promisify$1(exec$2);
2795
- const CCR_CONFIG_DIR = join$2(homedir(), ".claude-code-router");
2796
- const CCR_CONFIG_FILE = join$2(CCR_CONFIG_DIR, "config.json");
2761
+ const CCR_CONFIG_DIR = join$1(homedir(), ".claude-code-router");
2762
+ const CCR_CONFIG_FILE = join$1(CCR_CONFIG_DIR, "config.json");
2797
2763
  const CCR_BACKUP_DIR = CCR_CONFIG_DIR;
2798
2764
  function ensureCcrConfigDir() {
2799
2765
  if (!existsSync(CCR_CONFIG_DIR)) {
@@ -2808,7 +2774,7 @@ function backupCcrConfig(scriptLang) {
2808
2774
  }
2809
2775
  const timestamp = dayjs().format("YYYY-MM-DDTHH-mm-ss-SSS") + "Z";
2810
2776
  const backupFileName = `config.json.${timestamp}.bak`;
2811
- const backupPath = join$2(CCR_BACKUP_DIR, backupFileName);
2777
+ const backupPath = join$1(CCR_BACKUP_DIR, backupFileName);
2812
2778
  console.log(ansis.cyan(`${i18n.ccr.backupCcrConfig}`));
2813
2779
  copyFileSync(CCR_CONFIG_FILE, backupPath);
2814
2780
  console.log(ansis.green(`\u2714 ${i18n.ccr.ccrBackupSuccess.replace("{path}", backupPath)}`));
@@ -3415,4 +3381,4 @@ async function openSettingsJson() {
3415
3381
  }
3416
3382
  }
3417
3383
 
3418
- export { readCcrConfig as $, AI_OUTPUT_LANGUAGES as A, writeMcpConfig as B, CLAUDE_DIR as C, backupMcpConfig as D, mergeMcpServers as E, buildMcpServerConfig as F, fixWindowsMcpConfig as G, addCompletedOnboarding as H, I18N as I, getTranslation as J, addNumbersToChoices as K, LEGACY_ZCF_CONFIG_FILE as L, MCP_SERVICES as M, updateZcfConfig as N, readZcfConfig as O, configureAiPersonality as P, isWindows as Q, selectMcpServices as R, SETTINGS_FILE as S, formatApiKeyDisplay as T, modifyApiConfigPartially as U, isCcrInstalled as V, installCcr as W, setupCcrConfiguration as X, validateApiKey as Y, ZCF_CONFIG_FILE as Z, readZcfConfigAsync as _, importRecommendedEnv as a, configureCcrFeature as a0, handleExitPromptError as a1, handleGeneralError as a2, displayBanner as a3, selectScriptLanguage as a4, resolveAiOutputLanguage as a5, updatePromptOnly as a6, selectAndInstallWorkflows as a7, version as a8, displayBannerWithInfo as a9, checkAndUpdateTools as aa, prompts as ab, importRecommendedPermissions as b, commandExists as c, cleanupPermissions as d, CLAUDE_MD_FILE as e, ClAUDE_CONFIG_FILE as f, getPlatform as g, SUPPORTED_LANGS as h, init as i, LANG_LABELS as j, isClaudeCodeInstalled as k, installClaudeCode as l, mergeAndCleanPermissions as m, ensureClaudeDir as n, openSettingsJson as o, backupExistingConfig as p, copyConfigFiles as q, configureApi as r, mergeConfigs as s, mergeSettingsFile as t, updateDefaultModel as u, getExistingModelConfig as v, getExistingApiConfig as w, applyAiLanguageDirective as x, getMcpConfigPath as y, readMcpConfig as z };
3384
+ export { readCcrConfig as $, AI_OUTPUT_LANGUAGES as A, writeMcpConfig as B, CLAUDE_DIR as C, backupMcpConfig as D, mergeMcpServers as E, buildMcpServerConfig as F, fixWindowsMcpConfig as G, addCompletedOnboarding as H, I18N as I, getTranslation as J, addNumbersToChoices as K, LEGACY_ZCF_CONFIG_FILE as L, MCP_SERVICES as M, updateZcfConfig as N, readZcfConfig as O, configureAiPersonality as P, isWindows as Q, selectMcpServices as R, SETTINGS_FILE as S, formatApiKeyDisplay as T, modifyApiConfigPartially as U, isCcrInstalled as V, installCcr as W, setupCcrConfiguration as X, validateApiKey as Y, ZCF_CONFIG_FILE as Z, readZcfConfigAsync as _, importRecommendedEnv as a, configureCcrFeature as a0, handleExitPromptError as a1, handleGeneralError as a2, displayBanner as a3, selectScriptLanguage as a4, resolveAiOutputLanguage as a5, updatePromptOnly as a6, selectAndInstallWorkflows as a7, version as a8, checkAndUpdateTools as a9, displayBannerWithInfo as aa, prompts as ab, importRecommendedPermissions as b, commandExists as c, cleanupPermissions as d, CLAUDE_MD_FILE as e, ClAUDE_CONFIG_FILE as f, getPlatform as g, SUPPORTED_LANGS as h, init as i, LANG_LABELS as j, isClaudeCodeInstalled as k, installClaudeCode as l, mergeAndCleanPermissions as m, ensureClaudeDir as n, openSettingsJson as o, backupExistingConfig as p, copyConfigFiles as q, configureApi as r, mergeConfigs as s, mergeSettingsFile as t, updateDefaultModel as u, getExistingModelConfig as v, getExistingApiConfig as w, applyAiLanguageDirective as x, getMcpConfigPath as y, readMcpConfig as z };
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 { J as getTranslation, Z as ZCF_CONFIG_FILE, h as SUPPORTED_LANGS, K as addNumbersToChoices, j as LANG_LABELS, N as updateZcfConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, O as readZcfConfig, x as applyAiLanguageDirective, P as configureAiPersonality, v as getExistingModelConfig, u as updateDefaultModel, Q as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, R as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, E as mergeMcpServers, w as getExistingApiConfig, T as formatApiKeyDisplay, H as addCompletedOnboarding, U as modifyApiConfigPartially, V as isCcrInstalled, W as installCcr, X as setupCcrConfiguration, Y as validateApiKey, r as configureApi, _ as readZcfConfigAsync, I as I18N, $ as readCcrConfig, a0 as configureCcrFeature, a1 as handleExitPromptError, a2 as handleGeneralError, a3 as displayBanner, a4 as selectScriptLanguage, a5 as resolveAiOutputLanguage, a6 as updatePromptOnly, a7 as selectAndInstallWorkflows, a8 as version, a9 as displayBannerWithInfo, i as init, aa as checkAndUpdateTools } from './chunks/simple-config.mjs';
4
+ import { J as getTranslation, Z as ZCF_CONFIG_FILE, h as SUPPORTED_LANGS, K as addNumbersToChoices, j as LANG_LABELS, N as updateZcfConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, O as readZcfConfig, x as applyAiLanguageDirective, P as configureAiPersonality, v as getExistingModelConfig, u as updateDefaultModel, Q as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, R as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, E as mergeMcpServers, w as getExistingApiConfig, T as formatApiKeyDisplay, H as addCompletedOnboarding, U as modifyApiConfigPartially, V as isCcrInstalled, W as installCcr, X as setupCcrConfiguration, Y as validateApiKey, r as configureApi, _ as readZcfConfigAsync, I as I18N, $ as readCcrConfig, a0 as configureCcrFeature, a1 as handleExitPromptError, a2 as handleGeneralError, a3 as displayBanner, a4 as selectScriptLanguage, a5 as resolveAiOutputLanguage, a6 as updatePromptOnly, a7 as selectAndInstallWorkflows, a8 as version, a9 as checkAndUpdateTools, aa as displayBannerWithInfo, i as init } from './chunks/simple-config.mjs';
5
5
  import inquirer from 'inquirer';
6
6
  import { existsSync, unlinkSync } from 'node:fs';
7
7
  import { x } from 'tinyexec';
@@ -13,9 +13,6 @@ import 'pathe';
13
13
  import 'dayjs';
14
14
  import 'node:url';
15
15
  import 'ora';
16
- import 'fs/promises';
17
- import 'path';
18
- import 'os';
19
16
  import 'semver';
20
17
  import 'node:fs/promises';
21
18
  import 'node:child_process';
@@ -759,6 +756,16 @@ ${i18n.configuration.updatingPrompts}
759
756
  }
760
757
  }
761
758
 
759
+ async function checkUpdates(options = {}) {
760
+ const scriptLang = options.lang || await selectScriptLanguage();
761
+ try {
762
+ await checkAndUpdateTools(scriptLang);
763
+ } catch (error) {
764
+ console.error(ansis.red("Error checking updates:"), error);
765
+ process.exit(1);
766
+ }
767
+ }
768
+
762
769
  async function showMainMenu() {
763
770
  try {
764
771
  displayBannerWithInfo();
@@ -820,6 +827,9 @@ async function showMainMenu() {
820
827
  console.log(
821
828
  ` ${ansis.cyan("-.")} ${i18n.menu.menuOptions.clearCache} ${ansis.gray("- " + i18n.menu.menuDescriptions.clearCache)}`
822
829
  );
830
+ console.log(
831
+ ` ${ansis.cyan("+.")} ${i18n.menu.menuOptions.checkUpdates} ${ansis.gray("- " + i18n.menu.menuDescriptions.checkUpdates)}`
832
+ );
823
833
  console.log(` ${ansis.red("Q.")} ${ansis.red(i18n.menu.menuOptions.exit)}`);
824
834
  console.log("");
825
835
  const { choice } = await inquirer.prompt({
@@ -827,7 +837,7 @@ async function showMainMenu() {
827
837
  name: "choice",
828
838
  message: i18n.common.enterChoice,
829
839
  validate: (value) => {
830
- const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "0", "-", "q", "Q"];
840
+ const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "0", "-", "+", "q", "Q"];
831
841
  return valid.includes(value) || i18n.common.invalidChoice;
832
842
  }
833
843
  });
@@ -875,13 +885,16 @@ async function showMainMenu() {
875
885
  case "-":
876
886
  await clearZcfCacheFeature(scriptLang);
877
887
  break;
888
+ case "+":
889
+ await checkUpdates({ lang: scriptLang });
890
+ break;
878
891
  case "q":
879
892
  exitMenu = true;
880
893
  console.log(ansis.cyan(i18n.common.goodbye));
881
894
  break;
882
895
  }
883
896
  if (!exitMenu && choice.toLowerCase() !== "q") {
884
- if (choice === "0" || choice === "-" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r") {
897
+ if (choice === "0" || choice === "-" || choice === "+" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r") {
885
898
  console.log("\n" + ansis.dim("\u2500".repeat(50)) + "\n");
886
899
  continue;
887
900
  }
@@ -923,16 +936,6 @@ async function ccr(options = {}) {
923
936
  }
924
937
  }
925
938
 
926
- async function checkUpdates(options = {}) {
927
- const scriptLang = options.lang || await selectScriptLanguage();
928
- try {
929
- await checkAndUpdateTools(scriptLang);
930
- } catch (error) {
931
- console.error(ansis.red("Error checking updates:"), error);
932
- process.exit(1);
933
- }
934
- }
935
-
936
939
  function setupCommands(cli) {
937
940
  cli.command("[lang]", "Show interactive menu (default)").option("--init", "Run full initialization directly").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--force, -f", "Force overwrite existing configuration").action(async (lang, options) => {
938
941
  await handleDefaultCommand(lang, options);
package/dist/index.mjs CHANGED
@@ -9,9 +9,6 @@ import 'tinyexec';
9
9
  import 'child_process';
10
10
  import 'util';
11
11
  import 'ora';
12
- import 'fs/promises';
13
- import 'path';
14
- import 'os';
15
12
  import 'semver';
16
13
  import 'node:fs/promises';
17
14
  import 'node:child_process';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zcf",
3
3
  "type": "module",
4
- "version": "2.9.5",
4
+ "version": "2.9.7",
5
5
  "description": "Zero-Config Claude-Code Flow - One-click configuration tool for Claude Code",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/UfoMiao/zcf",