@daylenjeez/ccm-switch 1.2.3 → 1.2.4

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
@@ -202,7 +202,11 @@ Use `ccm clear` to delete them automatically, or clean them up manually:
202
202
  - `~/.ccm/config.json` — profiles
203
203
  - `~/.claude/settings.json` — may still contain an active `env` profile written by ccm
204
204
 
205
- > Do **not** delete `~/.cc-switch/cc-switch.db` unless you are also uninstalling cc-switch; that database is owned by cc-switch.
205
+ Then remove the CLI:
206
+
207
+ ```bash
208
+ npm uninstall -g @daylenjeez/ccm-switch
209
+ ```
206
210
 
207
211
  ## 📄 License
208
212
 
package/README.zh-CN.md CHANGED
@@ -10,7 +10,7 @@
10
10
  [![license](https://img.shields.io/npm/l/@daylenjeez/ccm-switch.svg?style=flat-square)](https://github.com/daylenjeez/ccm-switch/blob/main/LICENSE)
11
11
  [![node](https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square)](https://nodejs.org)
12
12
 
13
- English | [中文文档](https://github.com/daylenjeez/ccm-switch/blob/main/README.zh-CN.md)
13
+ [English](https://github.com/daylenjeez/ccm-switch/blob/main/README.md) | 中文文档
14
14
 
15
15
  [安装](#-安装) · [快速开始](#-快速开始) · [命令一览](#-命令一览) · [工作原理](#%EF%B8%8F-工作原理)
16
16
 
@@ -20,12 +20,12 @@ English | [中文文档](https://github.com/daylenjeez/ccm-switch/blob/main/READ
20
20
 
21
21
  ## ✨ 亮点
22
22
 
23
- - 🔌 **cc-switch 无缝对接** — 直接读取 [cc-switch](https://github.com/farion1231/cc-switch) 数据库,无需迁移
24
- - 🧙 **交互式向导** — `ccm add` 逐步引导,输入 `<` 可返回上一步
25
- - ⚡ **一键切换** — `ccm use OpenRouter` 或 `ccm ls` 方向键选择
26
- - 🛡️ **安全切换** — 自动保留 `language`、`permissions` 等个人设置
27
- - 🚀 **零配置上手** — 直接 `ccm init`,跟着提示走,无需阅读文档
28
- - 🌍 **中英双语** — `ccm locale set zh/en` 切换界面语言
23
+ - 🔌 **cc-switch Integration** — 直接读取 `cc-switch` 数据库,无需迁移
24
+ - 🧙 **Interactive Wizard** — `ccm add` 逐步引导,输入 `<` 可返回上一步
25
+ - ⚡ **One-command Switch** — `ccm use OpenRouter` 或 `ccm ls` 方向键选择
26
+ - 🛡️ **Safe Switching** — 自动保留 `language`、`permissions` 等个人设置
27
+ - 🚀 **Zero Config** — 直接 `ccm init`,跟着提示走,无需阅读文档
28
+ - 🌍 **i18n** — `ccm locale set zh/en` 切换界面语言
29
29
 
30
30
  ## 📦 安装
31
31
 
@@ -202,7 +202,11 @@ Claude Code 启动时读取 `~/.claude/settings.json`,`env` 字段控制 API
202
202
  - `~/.ccm/config.json` — 配置方案
203
203
  - `~/.claude/settings.json` — 可能仍包含 ccm 写入的 `env` 配置
204
204
 
205
- > 除非你也卸载了 cc-switch,否则**不要**删除 `~/.cc-switch/cc-switch.db`;该数据库由 cc-switch 管理。
205
+ 然后移除 CLI:
206
+
207
+ ```bash
208
+ npm uninstall -g @daylenjeez/ccm-switch
209
+ ```
206
210
 
207
211
  ## 📄 License
208
212
 
package/dist/claude.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export declare function readClaudeSettings(): Record<string, unknown>;
2
2
  export declare function applyProfile(settingsConfig: Record<string, unknown>): void;
3
- export declare function clearEnvFromSettings(): void;
4
3
  export declare function getSettingsPath(): string;
package/dist/claude.js CHANGED
@@ -20,15 +20,6 @@ export function applyProfile(settingsConfig) {
20
20
  const merged = { ...preserved, ...settingsConfig };
21
21
  writeFileSync(SETTINGS_PATH, JSON.stringify(merged, null, 2));
22
22
  }
23
- export function clearEnvFromSettings() {
24
- if (!existsSync(SETTINGS_PATH))
25
- return;
26
- const current = readClaudeSettings();
27
- if (!("env" in current))
28
- return;
29
- delete current.env;
30
- writeFileSync(SETTINGS_PATH, JSON.stringify(current, null, 2));
31
- }
32
23
  export function getSettingsPath() {
33
24
  return SETTINGS_PATH;
34
25
  }
package/dist/i18n/en.js CHANGED
@@ -121,8 +121,6 @@ const en = {
121
121
  "clear.confirm": "Delete all ccm data files? (y/N) ",
122
122
  "clear.cancelled": "Cancelled",
123
123
  "clear.removed": "✓ Deleted {path}",
124
- "clear.clear_env": "Also clear env config in ~/.claude/settings.json? (y/N) ",
125
- "clear.env_cleared": "✓ Cleared env config",
126
124
  "clear.done": "✓ Cleanup complete",
127
125
  // store errors
128
126
  "store.db_not_found": "cc-switch database not found: {path}",
package/dist/i18n/zh.d.ts CHANGED
@@ -102,8 +102,6 @@ declare const zh: {
102
102
  readonly "clear.confirm": "确认删除所有 ccm 数据文件?(y/N) ";
103
103
  readonly "clear.cancelled": "已取消清理";
104
104
  readonly "clear.removed": "✓ 已删除 {path}";
105
- readonly "clear.clear_env": "是否同时清除 ~/.claude/settings.json 中的 env 配置?(y/N) ";
106
- readonly "clear.env_cleared": "✓ 已清除 env 配置";
107
105
  readonly "clear.done": "✓ 清理完成";
108
106
  readonly "store.db_not_found": "cc-switch 数据库不存在: {path}";
109
107
  };
package/dist/i18n/zh.js CHANGED
@@ -121,8 +121,6 @@ const zh = {
121
121
  "clear.confirm": "确认删除所有 ccm 数据文件?(y/N) ",
122
122
  "clear.cancelled": "已取消清理",
123
123
  "clear.removed": "✓ 已删除 {path}",
124
- "clear.clear_env": "是否同时清除 ~/.claude/settings.json 中的 env 配置?(y/N) ",
125
- "clear.env_cleared": "✓ 已清除 env 配置",
126
124
  "clear.done": "✓ 清理完成",
127
125
  // store errors
128
126
  "store.db_not_found": "cc-switch 数据库不存在: {path}",
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { Command } from "commander";
3
3
  import chalk from "chalk";
4
4
  import { readRc, writeRc, getStore } from "./utils.js";
5
5
  import { ccSwitchExists } from "./store/cc-switch.js";
6
- import { readClaudeSettings, applyProfile, clearEnvFromSettings, getSettingsPath } from "./claude.js";
6
+ import { readClaudeSettings, applyProfile } from "./claude.js";
7
7
  import { createInterface } from "readline";
8
8
  import { spawnSync } from "child_process";
9
9
  import { writeFileSync, readFileSync, unlinkSync, existsSync } from "fs";
@@ -240,17 +240,6 @@ program
240
240
  unlinkSync(rcPath);
241
241
  console.log(chalk.green(t("clear.removed", { path: rcPath })));
242
242
  }
243
- const settingsPath = getSettingsPath();
244
- if (existsSync(settingsPath)) {
245
- const settings = readClaudeSettings();
246
- if ("env" in settings) {
247
- const clearEnv = await ask(t("clear.clear_env"));
248
- if (clearEnv.toLowerCase() === "y") {
249
- clearEnvFromSettings();
250
- console.log(chalk.green(t("clear.env_cleared")));
251
- }
252
- }
253
- }
254
243
  console.log(chalk.green(t("clear.done")));
255
244
  });
256
245
  // ccm list
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daylenjeez/ccm-switch",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Claude Code Model Switcher - 快速切换 Claude Code 自定义模型配置",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/claude.ts CHANGED
@@ -25,14 +25,6 @@ export function applyProfile(settingsConfig: Record<string, unknown>): void {
25
25
  writeFileSync(SETTINGS_PATH, JSON.stringify(merged, null, 2));
26
26
  }
27
27
 
28
- export function clearEnvFromSettings(): void {
29
- if (!existsSync(SETTINGS_PATH)) return;
30
- const current = readClaudeSettings();
31
- if (!("env" in current)) return;
32
- delete current.env;
33
- writeFileSync(SETTINGS_PATH, JSON.stringify(current, null, 2));
34
- }
35
-
36
28
  export function getSettingsPath(): string {
37
29
  return SETTINGS_PATH;
38
30
  }
package/src/i18n/en.ts CHANGED
@@ -141,8 +141,6 @@ const en: Record<TranslationKey, string> = {
141
141
  "clear.confirm": "Delete all ccm data files? (y/N) ",
142
142
  "clear.cancelled": "Cancelled",
143
143
  "clear.removed": "✓ Deleted {path}",
144
- "clear.clear_env": "Also clear env config in ~/.claude/settings.json? (y/N) ",
145
- "clear.env_cleared": "✓ Cleared env config",
146
144
  "clear.done": "✓ Cleanup complete",
147
145
 
148
146
  // store errors
package/src/i18n/zh.ts CHANGED
@@ -139,8 +139,6 @@ const zh = {
139
139
  "clear.confirm": "确认删除所有 ccm 数据文件?(y/N) ",
140
140
  "clear.cancelled": "已取消清理",
141
141
  "clear.removed": "✓ 已删除 {path}",
142
- "clear.clear_env": "是否同时清除 ~/.claude/settings.json 中的 env 配置?(y/N) ",
143
- "clear.env_cleared": "✓ 已清除 env 配置",
144
142
  "clear.done": "✓ 清理完成",
145
143
 
146
144
  // store errors
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@ import { Command } from "commander";
4
4
  import chalk from "chalk";
5
5
  import { readRc, writeRc, getStore } from "./utils.js";
6
6
  import { ccSwitchExists } from "./store/cc-switch.js";
7
- import { readClaudeSettings, applyProfile, clearEnvFromSettings, getSettingsPath } from "./claude.js";
7
+ import { readClaudeSettings, applyProfile } from "./claude.js";
8
8
  import { createInterface } from "readline";
9
9
  import { spawnSync } from "child_process";
10
10
  import { writeFileSync, readFileSync, unlinkSync, existsSync } from "fs";
@@ -270,18 +270,6 @@ program
270
270
  console.log(chalk.green(t("clear.removed", { path: rcPath })));
271
271
  }
272
272
 
273
- const settingsPath = getSettingsPath();
274
- if (existsSync(settingsPath)) {
275
- const settings = readClaudeSettings();
276
- if ("env" in settings) {
277
- const clearEnv = await ask(t("clear.clear_env"));
278
- if (clearEnv.toLowerCase() === "y") {
279
- clearEnvFromSettings();
280
- console.log(chalk.green(t("clear.env_cleared")));
281
- }
282
- }
283
- }
284
-
285
273
  console.log(chalk.green(t("clear.done")));
286
274
  });
287
275