@simonyea/holysheep-cli 1.7.27 → 1.7.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "1.7.27",
3
+ "version": "1.7.28",
4
4
  "description": "Claude Code/Cursor/Cline API relay for China — ¥1=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
5
5
  "keywords": [
6
6
  "openai-china",
@@ -329,20 +329,12 @@ async function setup(options) {
329
329
  }
330
330
  }
331
331
 
332
- // Step 5: 写入环境变量
333
- // 策略:所有工具尽量用各自 JSON/config 文件,减少 shell 污染。
334
- // 例外:Codex Rust 版必须通过 env_key 读取一个环境变量,使用 HOLYSHEEP_API_KEY。
335
- const needsCodexEnv = toConfigureTools.some(t => t.id === 'codex')
336
- if (needsCodexEnv) {
337
- Object.assign(envVarsToWrite, { HOLYSHEEP_API_KEY: apiKey })
338
- }
339
-
340
- // 清理旧版本写入的过时 shell 变量(ANTHROPIC_API_KEY / OPENAI_API_KEY 等)
332
+ // Step 5: 清理 shell 环境变量(所有工具改用 JSON/config 文件配置,不再写 shell)
341
333
  const staleKeys = ['ANTHROPIC_API_KEY', 'ANTHROPIC_BASE_URL', 'OPENAI_API_KEY', 'OPENAI_BASE_URL']
342
334
  try {
343
335
  const cleaned = removeEnvFromShell(staleKeys)
344
336
  if (cleaned.length > 0) {
345
- console.log(chalk.gray(`已清理过时 shell 变量: ${cleaned.map(f => chalk.cyan(f)).join(', ')}`))
337
+ console.log(chalk.gray(`已清理 shell 中的过时变量: ${cleaned.map(f => chalk.cyan(f)).join(', ')}`))
346
338
  }
347
339
  } catch {}
348
340
  if (process.platform === 'win32') {
@@ -352,16 +344,6 @@ async function setup(options) {
352
344
  }
353
345
  }
354
346
 
355
- if (Object.keys(envVarsToWrite).length > 0) {
356
- const spinner = ora('写入环境变量到 shell 配置文件...').start()
357
- try {
358
- const written = writeEnvToShell(envVarsToWrite)
359
- spinner.succeed(`环境变量已写入: ${written.map(f => chalk.cyan(f)).join(', ')}`)
360
- } catch (e) {
361
- spinner.fail(`写入环境变量失败: ${e.message}`)
362
- }
363
- }
364
-
365
347
  if (process.platform === 'win32' && windowsCliArtifacts.length > 0) {
366
348
  console.log(chalk.gray(`Windows 启动器已就绪: ${windowsCliArtifacts.map(item => chalk.cyan(item)).join(', ')}`))
367
349
  console.log()
@@ -70,4 +70,9 @@ model: openai/${model}
70
70
  launchCmd: 'aider',
71
71
  installCmd: 'pip install aider-chat',
72
72
  docsUrl: 'https://aider.chat',
73
+ envVars: (apiKey, baseUrlOpenAI) => ({
74
+ OPENAI_API_KEY: apiKey,
75
+ OPENAI_BASE_URL: baseUrlOpenAI,
76
+ AIDER_OPENAI_API_BASE: baseUrlOpenAI,
77
+ }),
73
78
  }
@@ -90,7 +90,7 @@ function isConfiguredInToml() {
90
90
  return content.includes('model_provider = "holysheep"') &&
91
91
  content.includes('base_url') &&
92
92
  content.includes('holysheep.ai') &&
93
- (content.includes('env_key = "HOLYSHEEP_API_KEY"') || content.includes('env_key = "OPENAI_API_KEY"'))
93
+ content.includes('env_key = "OPENAI_API_KEY"')
94
94
  }
95
95
 
96
96
  /**
@@ -113,7 +113,7 @@ function writeTomlConfig(apiKey, baseUrlOpenAI, model) {
113
113
  `[model_providers.holysheep]`,
114
114
  `name = "HolySheep"`,
115
115
  `base_url = "${baseUrlOpenAI}"`,
116
- `env_key = "HOLYSHEEP_API_KEY"`,
116
+ `env_key = "OPENAI_API_KEY"`,
117
117
  `wire_api = "responses"`,
118
118
  '',
119
119
  ].join('\n')
@@ -138,7 +138,7 @@ function writeJsonConfigIfNeeded(apiKey, baseUrlOpenAI, model) {
138
138
  jsonConfig.model_providers.holysheep = {
139
139
  name: 'HolySheep',
140
140
  base_url: baseUrlOpenAI,
141
- env_key: 'HOLYSHEEP_API_KEY',
141
+ env_key: 'OPENAI_API_KEY',
142
142
  wire_api: 'responses',
143
143
  }
144
144
  jsonConfig.providers.holysheep = {
@@ -171,6 +171,7 @@ module.exports = {
171
171
  return {
172
172
  file: CONFIG_FILE,
173
173
  hot: false,
174
+ envVars: { OPENAI_API_KEY: apiKey },
174
175
  }
175
176
  },
176
177
  reset() {