@liuzijian625/code-cli 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/lib/config.js +7 -4
  2. package/package.json +1 -1
package/lib/config.js CHANGED
@@ -57,8 +57,9 @@ async function applyClaude(preset) {
57
57
  if (fs.existsSync(claudeFile)) {
58
58
  config = JSON.parse(fs.readFileSync(claudeFile, 'utf-8'));
59
59
  }
60
- config.apiKey = preset.key;
61
- config.baseUrl = preset.url;
60
+ if (!config.env) config.env = {};
61
+ config.env.ANTHROPIC_BASE_URL = preset.url;
62
+ config.env.ANTHROPIC_AUTH_TOKEN = preset.key;
62
63
  fs.writeFileSync(claudeFile, JSON.stringify(config, null, 2));
63
64
  } else {
64
65
  // Linux/macOS: 修改 ~/.claude/settings.json
@@ -134,8 +135,10 @@ async function clearClaude() {
134
135
  const claudeFile = path.join(os.homedir(), '.claude.json');
135
136
  if (fs.existsSync(claudeFile)) {
136
137
  let config = JSON.parse(fs.readFileSync(claudeFile, 'utf-8'));
137
- delete config.apiKey;
138
- delete config.baseUrl;
138
+ if (config.env) {
139
+ delete config.env.ANTHROPIC_BASE_URL;
140
+ delete config.env.ANTHROPIC_AUTH_TOKEN;
141
+ }
139
142
  fs.writeFileSync(claudeFile, JSON.stringify(config, null, 2));
140
143
  }
141
144
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liuzijian625/code-cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "AI CLI 配置管理工具 - 管理 Codex、Claude Code、Gemini CLI 的配置",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {