zcf 2.10.0 → 2.10.1

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.
@@ -15,7 +15,7 @@ import semver from 'semver';
15
15
  import { exec } from 'tinyexec';
16
16
  import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
17
17
 
18
- const version = "2.10.0";
18
+ const version = "2.10.1";
19
19
  const homepage = "https://github.com/UfoMiao/zcf";
20
20
 
21
21
  const WORKFLOW_CONFIGS = [
@@ -2316,6 +2316,22 @@ function showConfigurationTips(scriptLang, apiKey) {
2316
2316
  }
2317
2317
  console.log("");
2318
2318
  }
2319
+ function createDefaultCcrConfig() {
2320
+ return {
2321
+ LOG: false,
2322
+ CLAUDE_PATH: "",
2323
+ HOST: "127.0.0.1",
2324
+ PORT: 3456,
2325
+ APIKEY: "sk-zcf-x-ccr",
2326
+ API_TIMEOUT_MS: "600000",
2327
+ PROXY_URL: "",
2328
+ transformers: [],
2329
+ Providers: [],
2330
+ // Empty providers array - user configures in UI
2331
+ Router: {}
2332
+ // Empty router configuration - user configures in UI
2333
+ };
2334
+ }
2319
2335
  async function setupCcrConfiguration(scriptLang) {
2320
2336
  const i18n = getTranslation(scriptLang);
2321
2337
  try {
@@ -2352,21 +2368,7 @@ async function setupCcrConfiguration(scriptLang) {
2352
2368
  let config;
2353
2369
  if (preset === "skip") {
2354
2370
  console.log(ansis.yellow(`${i18n.ccr.skipConfiguring}`));
2355
- config = {
2356
- LOG: false,
2357
- CLAUDE_PATH: "",
2358
- HOST: "127.0.0.1",
2359
- PORT: 3456,
2360
- APIKEY: "sk-zcf-x-ccr",
2361
- API_TIMEOUT_MS: "600000",
2362
- PROXY_URL: "",
2363
- transformers: [],
2364
- Providers: [],
2365
- // Empty providers array
2366
- Router: {
2367
- // Empty router configuration - user will configure in CCR UI
2368
- }
2369
- };
2371
+ config = createDefaultCcrConfig();
2370
2372
  } else {
2371
2373
  config = await configureCcrWithPreset(preset, scriptLang);
2372
2374
  }
@@ -2461,8 +2463,8 @@ async function checkClaudeCodeVersion() {
2461
2463
  };
2462
2464
  }
2463
2465
  async function checkCometixLineVersion() {
2464
- const currentVersion = await getInstalledVersion("ccometix");
2465
- const latestVersion = await getLatestVersion("ccometix");
2466
+ const currentVersion = await getInstalledVersion("ccline");
2467
+ const latestVersion = await getLatestVersion("@cometix/ccline");
2466
2468
  return {
2467
2469
  installed: currentVersion !== null,
2468
2470
  currentVersion,
@@ -3476,7 +3478,7 @@ async function init(options = {}) {
3476
3478
  }
3477
3479
  let apiConfig = null;
3478
3480
  const isNewInstall = !existsSync(SETTINGS_FILE);
3479
- if (action !== "docs-only" && (isNewInstall || ["backup", "merge"].includes(action))) {
3481
+ if (action !== "docs-only" && (isNewInstall || ["backup", "merge", "new"].includes(action))) {
3480
3482
  if (options.skipPrompt) {
3481
3483
  if (options.apiType === "auth_token" && options.apiKey) {
3482
3484
  apiConfig = {
@@ -3491,15 +3493,30 @@ async function init(options = {}) {
3491
3493
  url: options.apiUrl || "https://api.anthropic.com"
3492
3494
  };
3493
3495
  } else if (options.apiType === "ccr_proxy") {
3494
- const ccrInstalled = await isCcrInstalled();
3495
- if (!ccrInstalled) {
3496
+ const ccrStatus = await isCcrInstalled();
3497
+ if (!ccrStatus.hasCorrectPackage) {
3496
3498
  await installCcr(scriptLang);
3499
+ } else {
3500
+ console.log(ansis.green(`\u2714 ${i18n.ccr?.ccrAlreadyInstalled || "CCR already installed"}`));
3497
3501
  }
3498
- const ccrConfigured = await setupCcrConfiguration(scriptLang);
3499
- if (ccrConfigured) {
3500
- console.log(ansis.green(`\u2714 ${i18n.ccr.ccrSetupComplete}`));
3501
- apiConfig = null;
3502
+ const existingCcrConfig = readCcrConfig();
3503
+ if (existingCcrConfig) {
3504
+ const backupPath = backupCcrConfig(scriptLang);
3505
+ if (backupPath) {
3506
+ console.log(ansis.gray(`\u2714 ${i18n.ccr?.ccrBackupSuccess?.replace("{path}", backupPath) || "CCR configuration backed up"}`));
3507
+ }
3508
+ }
3509
+ const defaultCcrConfig = createDefaultCcrConfig();
3510
+ writeCcrConfig(defaultCcrConfig);
3511
+ console.log(ansis.green(`\u2714 ${i18n.ccr?.ccrConfigSuccess || "CCR configuration created"}`));
3512
+ await configureCcrProxy(defaultCcrConfig);
3513
+ console.log(ansis.green(`\u2714 ${i18n.ccr?.proxyConfigSuccess || "Proxy settings configured"}`));
3514
+ try {
3515
+ addCompletedOnboarding();
3516
+ } catch (error) {
3517
+ console.error(ansis.red(i18n.configuration?.failedToSetOnboarding || "Failed to set onboarding flag"), error);
3502
3518
  }
3519
+ apiConfig = null;
3503
3520
  }
3504
3521
  } else {
3505
3522
  const existingApiConfig = getExistingApiConfig();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zcf",
3
3
  "type": "module",
4
- "version": "2.10.0",
4
+ "version": "2.10.1",
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",