yzcode-cli 1.0.4 → 1.0.5

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/bin/yzcode.js +10 -18
  2. package/package.json +1 -1
package/bin/yzcode.js CHANGED
@@ -3,29 +3,21 @@
3
3
  * YZcode CLI entry point
4
4
  */
5
5
 
6
- import { hasApiKey, applyConfigToEnv } from '../utils/userConfig.js'
6
+ import { hasApiKey, applyConfigToEnv, firstRunWizard } from '../utils/userConfig.js'
7
7
 
8
8
  // 检查是否配置了 API key
9
9
  const hasKey = await hasApiKey()
10
10
 
11
11
  if (!hasKey) {
12
- console.error('\n⚠️ 未检测到 API 配置\n')
13
- console.error('请先配置你的 API 凭证:\n')
14
- console.error('方式 1: 设置环境变量')
15
- console.error(' export ANTHROPIC_AUTH_TOKEN="your-token"')
16
- console.error(' export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"\n')
17
- console.error('方式 2: 创建配置文件')
18
- console.error(` mkdir -p ~/Library/Preferences/yzcode-nodejs`)
19
- console.error(` cat > ~/Library/Preferences/yzcode-nodejs/config.json << 'EOF'`)
20
- console.error(` {`)
21
- console.error(` "authToken": "your-token",`)
22
- console.error(` "baseUrl": "https://open.bigmodel.cn/api/anthropic"`)
23
- console.error(` }`)
24
- console.error(` EOF\n`)
25
- console.error('获取 API Key:')
26
- console.error(' - 智谱 AI: https://open.bigmodel.cn/usercenter/apikeys')
27
- console.error(' - Anthropic: https://console.anthropic.com/\n')
28
- process.exit(1)
12
+ // 启动交互式配置向导
13
+ await firstRunWizard()
14
+
15
+ // 重新检查是否配置成功
16
+ const stillNoKey = !(await hasApiKey())
17
+ if (stillNoKey) {
18
+ console.error('\n未完成配置,退出。\n')
19
+ process.exit(1)
20
+ }
29
21
  }
30
22
 
31
23
  // 将配置应用到环境变量(环境变量优先级更高)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yzcode-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "YZcode - AI编程助手命令行工具",
5
5
  "type": "module",
6
6
  "bin": {