@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.
- package/lib/config.js +7 -4
- 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.
|
|
61
|
-
config.
|
|
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
|
-
|
|
138
|
-
|
|
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 {
|