yzcode-cli 1.0.0 → 1.0.2
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-config.js +25 -0
- package/bin/yzcode.js +9 -16
- package/package.json +6 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* YZcode 配置命令
|
|
4
|
+
* 用于配置 API 凭证
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { firstRunWizard, readConfig, getConfigPath } from '../utils/userConfig.js'
|
|
8
|
+
|
|
9
|
+
console.log('YZcode 配置向导')
|
|
10
|
+
console.log('================\n')
|
|
11
|
+
|
|
12
|
+
const config = await readConfig()
|
|
13
|
+
|
|
14
|
+
if (config.authToken) {
|
|
15
|
+
console.log('当前配置:')
|
|
16
|
+
console.log(` Token: ${config.authToken.slice(0, 8)}...${config.authToken.slice(-4)}`)
|
|
17
|
+
if (config.baseUrl) {
|
|
18
|
+
console.log(` Base URL: ${config.baseUrl}`)
|
|
19
|
+
}
|
|
20
|
+
console.log(`\n配置文件: ${getConfigPath()}`)
|
|
21
|
+
console.log('\n如需重新配置,请先删除配置文件:')
|
|
22
|
+
console.log(` rm ${getConfigPath()}`)
|
|
23
|
+
} else {
|
|
24
|
+
await firstRunWizard()
|
|
25
|
+
}
|
package/bin/yzcode.js
CHANGED
|
@@ -9,22 +9,15 @@ import { hasApiKey, applyConfigToEnv } from '../utils/userConfig.js'
|
|
|
9
9
|
const hasKey = await hasApiKey()
|
|
10
10
|
|
|
11
11
|
if (!hasKey) {
|
|
12
|
-
console.
|
|
13
|
-
console.
|
|
14
|
-
console.
|
|
15
|
-
console.
|
|
16
|
-
console.
|
|
17
|
-
console.
|
|
18
|
-
console.
|
|
19
|
-
console.
|
|
20
|
-
console.
|
|
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')
|
|
12
|
+
console.log('\n👋 欢迎使用 YZcode!')
|
|
13
|
+
console.log('====================\n')
|
|
14
|
+
console.log('❌ 未检测到 API 配置\n')
|
|
15
|
+
console.log('请先配置 API 凭证:')
|
|
16
|
+
console.log('\n方式 1:交互式配置(推荐)')
|
|
17
|
+
console.log(' yzcode-config')
|
|
18
|
+
console.log('\n方式 2:环境变量')
|
|
19
|
+
console.log(' export ANTHROPIC_AUTH_TOKEN="your-token"')
|
|
20
|
+
console.log(' export ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic"\n')
|
|
28
21
|
process.exit(1)
|
|
29
22
|
}
|
|
30
23
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yzcode-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "YZcode - AI编程助手命令行工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"yzcode": "./bin/yzcode.js"
|
|
7
|
+
"yzcode": "./bin/yzcode.js",
|
|
8
|
+
"yzcode-config": "./bin/yzcode-config.js"
|
|
8
9
|
},
|
|
9
10
|
"dependencies": {
|
|
10
|
-
"@anthropic-ai/claude-agent-sdk": "
|
|
11
|
-
"@anthropic-ai/mcpb": "
|
|
12
|
-
"@anthropic-ai/sdk": "
|
|
11
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.88",
|
|
12
|
+
"@anthropic-ai/mcpb": "2.1.2",
|
|
13
|
+
"@anthropic-ai/sdk": "0.80.0",
|
|
13
14
|
"@aws-sdk/client-bedrock-runtime": "^3.709.0",
|
|
14
15
|
"@commander-js/extra-typings": "^12.1.0",
|
|
15
16
|
"@growthbook/growthbook": "^0.33.0",
|