@simonyea/holysheep-cli 1.7.6 → 1.7.7
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 +1 -1
- package/src/commands/setup.js +24 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
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",
|
package/src/commands/setup.js
CHANGED
|
@@ -5,8 +5,10 @@ const inquirer = require('inquirer')
|
|
|
5
5
|
const chalk = require('chalk')
|
|
6
6
|
const ora = require('ora')
|
|
7
7
|
const { execSync, spawnSync } = require('child_process')
|
|
8
|
+
const pkg = require('../../package.json')
|
|
8
9
|
const { saveConfig, getApiKey, BASE_URL_ANTHROPIC, BASE_URL_OPENAI, SHOP_URL } = require('../utils/config')
|
|
9
10
|
const { writeEnvToShell, ensureWindowsUserPathHasNpmBin } = require('../utils/shell')
|
|
11
|
+
const { commandExists } = require('../utils/which')
|
|
10
12
|
const TOOLS = require('../tools')
|
|
11
13
|
|
|
12
14
|
// 工具的自动安装命令(npm/pip)
|
|
@@ -45,6 +47,19 @@ function getWindowsImmediateLaunchCmd(tool) {
|
|
|
45
47
|
return null
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
function getPreferredCliPrefix() {
|
|
51
|
+
return commandExists('hs')
|
|
52
|
+
? 'hs'
|
|
53
|
+
: `npx @simonyea/holysheep-cli@${pkg.version}`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getPreferredLaunchCmd(tool) {
|
|
57
|
+
if (!tool?.launchCmd) return null
|
|
58
|
+
if (!tool.launchCmd.startsWith('hs')) return tool.launchCmd
|
|
59
|
+
const prefix = getPreferredCliPrefix()
|
|
60
|
+
return tool.launchCmd.replace(/^hs\b/, prefix)
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
function canAutoInstall(toolId) {
|
|
49
64
|
return !!AUTO_INSTALL[toolId]
|
|
50
65
|
}
|
|
@@ -317,12 +332,13 @@ async function setup(options) {
|
|
|
317
332
|
console.log(` ${chalk.gray(` ${i + 1}.`)} ${chalk.cyan.bold(s.cmd)} ${chalk.gray(s.note)}`)
|
|
318
333
|
})
|
|
319
334
|
} else if (r.tool.launchCmd) {
|
|
335
|
+
const preferredLaunchCmd = getPreferredLaunchCmd(r.tool)
|
|
320
336
|
if (r.tool._winJustInstalled) {
|
|
321
|
-
const immediateCmd = getWindowsImmediateLaunchCmd(r.tool)
|
|
322
|
-
console.log(` ${chalk.gray('▶ 立即启动:')} ${chalk.cyan.bold(immediateCmd || r.tool.launchCmd)}`)
|
|
323
|
-
console.log(` ${chalk.gray('▶ 新开终端后:')} ${chalk.cyan.bold(r.tool.launchCmd)}`)
|
|
337
|
+
const immediateCmd = getWindowsImmediateLaunchCmd({ ...r.tool, launchCmd: preferredLaunchCmd || r.tool.launchCmd })
|
|
338
|
+
console.log(` ${chalk.gray('▶ 立即启动:')} ${chalk.cyan.bold(immediateCmd || preferredLaunchCmd || r.tool.launchCmd)}`)
|
|
339
|
+
console.log(` ${chalk.gray('▶ 新开终端后:')} ${chalk.cyan.bold(preferredLaunchCmd || r.tool.launchCmd)}`)
|
|
324
340
|
} else {
|
|
325
|
-
console.log(` ${chalk.gray('▶ 启动命令:')} ${chalk.cyan.bold(r.tool.launchCmd)}`)
|
|
341
|
+
console.log(` ${chalk.gray('▶ 启动命令:')} ${chalk.cyan.bold(preferredLaunchCmd || r.tool.launchCmd)}`)
|
|
326
342
|
}
|
|
327
343
|
if (r.tool.launchNote) console.log(` ${chalk.gray(' ' + r.tool.launchNote)}`)
|
|
328
344
|
} else if (r.tool.launchNote) {
|
|
@@ -343,9 +359,10 @@ async function setup(options) {
|
|
|
343
359
|
console.log()
|
|
344
360
|
}
|
|
345
361
|
|
|
346
|
-
|
|
347
|
-
console.log(chalk.gray(
|
|
348
|
-
console.log(chalk.gray(
|
|
362
|
+
const cliPrefix = getPreferredCliPrefix()
|
|
363
|
+
console.log(chalk.gray(`如需切换其他工具,运行: ${cliPrefix} setup`))
|
|
364
|
+
console.log(chalk.gray(`查看余额: ${cliPrefix} balance`))
|
|
365
|
+
console.log(chalk.gray(`检查配置: ${cliPrefix} doctor`))
|
|
349
366
|
console.log()
|
|
350
367
|
|
|
351
368
|
// 注册引导 banner
|