@simonyea/holysheep-cli 1.1.4 → 1.1.6

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/README.md CHANGED
@@ -58,7 +58,7 @@ npm install -g @simonyea/holysheep-cli
58
58
  No npm? Try npx (no install needed):
59
59
 
60
60
  ```bash
61
- npx @simonyea/holysheep-cli setup
61
+ npx @simonyea/holysheep-cli@latest setup
62
62
  ```
63
63
 
64
64
  ### Quick Start
@@ -152,7 +152,7 @@ npm install -g @simonyea/holysheep-cli
152
152
  没有 npm?用 npx 免安装直接运行:
153
153
 
154
154
  ```bash
155
- npx @simonyea/holysheep-cli setup
155
+ npx @simonyea/holysheep-cli@latest setup
156
156
  ```
157
157
 
158
158
  ### 快速开始
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "一键配置所有 AI 编程工具接入 HolySheep API — Claude Code / Codex / Gemini CLI / OpenCode / OpenClaw / Aider / Cursor",
5
5
  "keywords": [
6
6
  "claude",
@@ -45,19 +45,13 @@ async function tryAutoInstall(tool) {
45
45
  spinner.fail(`安装失败,请手动运行: ${chalk.cyan(info.cmd)}`)
46
46
  return false
47
47
  }
48
- // Windows PATH 在当前进程内不会刷新,安装成功即认为可用
49
- if (process.platform === 'win32') {
50
- spinner.succeed(`${tool.name} 安装完成(请重新开一个终端窗口后运行 hs setup 完成配置)`)
51
- return false // 返回 false 跳过配置,让用户重开终端再来
52
- }
53
- // 安装后重新检测
54
- if (tool.checkInstalled()) {
55
- spinner.succeed(`${tool.name} 安装成功`)
56
- return true
57
- } else {
58
- spinner.fail(`${tool.name} 安装后仍未检测到,请手动安装: ${chalk.cyan(info.cmd)}`)
59
- return false
48
+ spinner.succeed(`${tool.name} 安装成功`)
49
+ // Windows PATH 在当前进程内不会刷新,但安装已成功,直接继续配置
50
+ // Windows 再额外做一次检测
51
+ if (process.platform !== 'win32' && !tool.checkInstalled()) {
52
+ console.log(chalk.yellow(` ⚠ 安装后未检测到命令,尝试直接配置...`))
60
53
  }
54
+ return true // 安装成功就视为可配置
61
55
  } catch (e) {
62
56
  spinner.fail(`安装失败: ${e.message}`)
63
57
  return false
@@ -138,6 +132,7 @@ async function setup(options) {
138
132
  const selectedTools = TOOLS.filter(t => toolIds.includes(t.id))
139
133
  const needInstall = selectedTools.filter(t => !t.checkInstalled() && canAutoInstall(t.id))
140
134
  const cantInstall = selectedTools.filter(t => !t.checkInstalled() && !canAutoInstall(t.id))
135
+ const justInstalled = new Set() // 记录本次刚安装成功的工具 id
141
136
 
142
137
  // 提示不能自动安装的工具
143
138
  if (cantInstall.length) {
@@ -157,16 +152,17 @@ async function setup(options) {
157
152
 
158
153
  if (doInstall) {
159
154
  for (const tool of needInstall) {
160
- await tryAutoInstall(tool)
155
+ const ok = await tryAutoInstall(tool)
156
+ if (ok) justInstalled.add(tool.id)
161
157
  }
162
158
  console.log()
163
159
  }
164
160
  }
165
161
 
166
- // Step 4: 配置每个已安装的工具
162
+ // Step 4: 配置每个已安装的工具(包含刚刚安装成功的)
167
163
  const envVarsToWrite = {}
168
164
  const results = []
169
- const toConfigureTools = selectedTools.filter(t => t.checkInstalled())
165
+ const toConfigureTools = selectedTools.filter(t => t.checkInstalled() || justInstalled.has(t.id))
170
166
 
171
167
  if (toConfigureTools.length === 0) {
172
168
  console.log(chalk.yellow('没有可配置的工具(请先安装),退出。'))
package/src/index.js CHANGED
@@ -13,6 +13,34 @@ if (process.platform === 'win32') {
13
13
  } catch {}
14
14
  }
15
15
 
16
+ // 异步检查最新版本(不阻塞主流程)
17
+ function checkLatestVersion() {
18
+ try {
19
+ const https = require('https')
20
+ const req = https.get(
21
+ `https://registry.npmjs.org/@simonyea/holysheep-cli/latest`,
22
+ { timeout: 3000 },
23
+ (res) => {
24
+ let data = ''
25
+ res.on('data', chunk => { data += chunk })
26
+ res.on('end', () => {
27
+ try {
28
+ const latest = JSON.parse(data).version
29
+ if (latest && latest !== pkg.version) {
30
+ console.log()
31
+ console.log(chalk.yellow(`⚠️ 发现新版本 v${latest}(当前 v${pkg.version})`))
32
+ console.log(chalk.cyan(` 建议运行: npx @simonyea/holysheep-cli@latest setup`))
33
+ console.log(chalk.gray(` 或更新: npm install -g @simonyea/holysheep-cli@latest`))
34
+ }
35
+ } catch {}
36
+ })
37
+ }
38
+ )
39
+ req.on('error', () => {})
40
+ req.setTimeout(3000, () => req.destroy())
41
+ } catch {}
42
+ }
43
+
16
44
  // Banner
17
45
  function printBanner() {
18
46
  console.log()
@@ -66,6 +94,7 @@ program
66
94
  .option('-a, --all', '配置所有已安装的工具(跳过选择)')
67
95
  .action(async (opts) => {
68
96
  printBanner()
97
+ checkLatestVersion() // 异步检查版本,不阻塞
69
98
  await require('./commands/setup')(opts)
70
99
  })
71
100