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.
- package/bin/yzcode.js +10 -18
- 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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
// 将配置应用到环境变量(环境变量优先级更高)
|