@liuzijian625/code-cli 1.0.2 → 1.0.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/lib/config.js +6 -9
- package/package.json +1 -1
package/lib/config.js
CHANGED
|
@@ -51,11 +51,9 @@ async function applyCodex(preset) {
|
|
|
51
51
|
// Claude Code 配置
|
|
52
52
|
async function applyClaude(preset) {
|
|
53
53
|
if (isWindows) {
|
|
54
|
-
// Windows:
|
|
55
|
-
await execAsync(`
|
|
56
|
-
await execAsync(`
|
|
57
|
-
await execAsync(`powershell -Command "Start-Process powershell -Verb RunAs -ArgumentList '-Command', '[System.Environment]::SetEnvironmentVariable(''ANTHROPIC_BASE_URL'', ''${preset.url}'', [System.EnvironmentVariableTarget]::Machine)'"`);
|
|
58
|
-
await execAsync(`powershell -Command "Start-Process powershell -Verb RunAs -ArgumentList '-Command', '[System.Environment]::SetEnvironmentVariable(''ANTHROPIC_AUTH_TOKEN'', ''${preset.key}'', [System.EnvironmentVariableTarget]::Machine)'"`);
|
|
54
|
+
// Windows: 使用 setx 命令设置环境变量
|
|
55
|
+
await execAsync(`setx ANTHROPIC_BASE_URL "${preset.url}"`);
|
|
56
|
+
await execAsync(`setx ANTHROPIC_AUTH_TOKEN "${preset.key}"`);
|
|
59
57
|
} else {
|
|
60
58
|
// Linux/macOS: 修改 settings.json
|
|
61
59
|
const claudeDir = path.join(os.homedir(), '.claude');
|
|
@@ -126,10 +124,9 @@ async function clearCodex() {
|
|
|
126
124
|
|
|
127
125
|
async function clearClaude() {
|
|
128
126
|
if (isWindows) {
|
|
129
|
-
|
|
130
|
-
await execAsync(`
|
|
131
|
-
await execAsync(`
|
|
132
|
-
await execAsync(`powershell -Command "Start-Process powershell -Verb RunAs -ArgumentList '-Command', '[System.Environment]::SetEnvironmentVariable(''ANTHROPIC_AUTH_TOKEN'', $null, [System.EnvironmentVariableTarget]::Machine)'"`);
|
|
127
|
+
// Windows: 使用 reg delete 删除环境变量
|
|
128
|
+
await execAsync(`reg delete "HKCU\\Environment" /v ANTHROPIC_BASE_URL /f`).catch(() => {});
|
|
129
|
+
await execAsync(`reg delete "HKCU\\Environment" /v ANTHROPIC_AUTH_TOKEN /f`).catch(() => {});
|
|
133
130
|
} else {
|
|
134
131
|
const claudeDir = path.join(os.homedir(), '.claude');
|
|
135
132
|
const settingsFile = path.join(claudeDir, 'settings.json');
|