@simonyea/holysheep-cli 1.5.4 โ†’ 1.5.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
@@ -7,6 +7,7 @@
7
7
  [![npm version](https://img.shields.io/npm/v/@simonyea/holysheep-cli?color=orange&label=npm)](https://www.npmjs.com/package/@simonyea/holysheep-cli)
8
8
  [![npm downloads](https://img.shields.io/npm/dm/@simonyea/holysheep-cli?color=blue)](https://www.npmjs.com/package/@simonyea/holysheep-cli)
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
+ [![Register](https://img.shields.io/badge/๐Ÿ”‘_Get_API_Key-holysheep.ai-brightgreen)](https://holysheep.ai/register)
10
11
 
11
12
  <br/>
12
13
 
@@ -46,6 +47,8 @@ Instead of manually editing config files for each tool, run one command and you'
46
47
 
47
48
  ### Quick Start
48
49
 
50
+ > ๐Ÿ”‘ **First, get your free API Key** โ†’ [**holysheep.ai/register**](https://holysheep.ai/register) (free signup, pay-as-you-go from ยฅ10)
51
+
49
52
  ```bash
50
53
  npx @simonyea/holysheep-cli@latest setup
51
54
  ```
@@ -119,6 +122,8 @@ npx openclaw gateway --port 18789
119
122
 
120
123
  ### ๅฟซ้€Ÿๅผ€ๅง‹
121
124
 
125
+ > ๐Ÿ”‘ **็ฌฌไธ€ๆญฅ๏ผšๆณจๅ†Œ่Žทๅ– API Key** โ†’ [**holysheep.ai/register**](https://holysheep.ai/register)๏ผˆๅ…่ดนๆณจๅ†Œ๏ผŒยฅ10 ่ตทๅ……๏ผŒๆŒ‰้‡่ฎก่ดน๏ผ‰
126
+
122
127
  ```bash
123
128
  npx @simonyea/holysheep-cli@latest setup
124
129
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "ไธ€้”ฎ้…็ฝฎๆ‰€ๆœ‰ AI ็ผ–็จ‹ๅทฅๅ…ทๆŽฅๅ…ฅ HolySheep API โ€” Claude Code / Codex / Gemini CLI / OpenCode / OpenClaw / Aider / Cursor",
5
5
  "keywords": [
6
6
  "claude",
@@ -39,4 +39,4 @@
39
39
  "node-fetch": "^2.7.0",
40
40
  "ora": "^5.4.1"
41
41
  }
42
- }
42
+ }
@@ -73,6 +73,7 @@ async function setup(options) {
73
73
  if (!apiKey) {
74
74
  console.log(chalk.yellow('้œ€่ฆ API Key ๆ‰่ƒฝ้…็ฝฎๅทฅๅ…ทใ€‚'))
75
75
  console.log(chalk.cyan(`๐Ÿ‘‰ ๅ…่ดนๆณจๅ†Œ่Žทๅ– Key๏ผš${SHOP_URL}/register`))
76
+ console.log(chalk.gray(` ๆ”ฏๆŒๅพฎไฟก/ๆ”ฏไป˜ๅฎๅ……ๅ€ผ๏ผŒๆŒ‰้‡่ฎก่ดน`))
76
77
  console.log(chalk.gray(` ๏ผˆยฅ10 ่ตทๅ……๏ผŒๆŒ‰้‡่ฎก่ดน๏ผŒๆ”ฏๆŒๅพฎไฟก/ๆ”ฏไป˜ๅฎ๏ผ‰`))
77
78
  console.log(chalk.gray(`ๆ็คบ๏ผšๅฏๅ…ˆ่ฟ่กŒ ${chalk.cyan('hs login')} ็™ปๅฝ•ๅนถไฟๅญ˜ Key๏ผŒไน‹ๅŽ setup ๅฐ†่‡ชๅŠจ่ฏปๅ–ใ€‚`))
78
79
  if (process.platform === 'win32') {
@@ -316,6 +317,13 @@ async function setup(options) {
316
317
  console.log(chalk.gray('ๆŸฅ็œ‹ไฝ™้ข: hs balance'))
317
318
  console.log(chalk.gray('ๆฃ€ๆŸฅ้…็ฝฎ: hs doctor'))
318
319
  console.log()
320
+
321
+ // ๆณจๅ†Œๅผ•ๅฏผ banner
322
+ console.log(chalk.cyan('โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—'))
323
+ console.log(chalk.cyan('โ•‘') + chalk.bold(' ๐ŸŽ ่ฟ˜ๆฒกๆœ‰ Key๏ผŸๅ…่ดนๆณจๅ†Œๅณๅฏไฝฟ็”จ ') + chalk.cyan('โ•‘'))
324
+ console.log(chalk.cyan('โ•‘') + chalk.green(' ๐Ÿ‘‰ https://holysheep.ai/register ') + chalk.cyan('โ•‘'))
325
+ console.log(chalk.cyan('โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•'))
326
+ console.log()
319
327
  }
320
328
 
321
329
  function maskKey(key) {
@@ -0,0 +1,154 @@
1
+ /**
2
+ * hs upgrade โ€” ่‡ชๅŠจๅ‡็บง AI ็ผ–็จ‹ๅทฅๅ…ทๅˆฐๆœ€ๆ–ฐ็‰ˆๆœฌ
3
+ */
4
+ const chalk = require('chalk')
5
+ const { execSync } = require('child_process')
6
+ const { commandExists } = require('../utils/which')
7
+
8
+ // ๆ”ฏๆŒๅ‡็บง็š„ๅทฅๅ…ทๅˆ—่กจ
9
+ const UPGRADABLE_TOOLS = [
10
+ {
11
+ name: 'Claude Code',
12
+ id: 'claude-code',
13
+ command: 'claude',
14
+ versionCmd: 'claude --version',
15
+ npmPkg: '@anthropic-ai/claude-code',
16
+ installCmd: 'npm install -g @anthropic-ai/claude-code@latest',
17
+ },
18
+ {
19
+ name: 'Codex CLI',
20
+ id: 'codex',
21
+ command: 'codex',
22
+ versionCmd: 'codex --version',
23
+ npmPkg: '@openai/codex',
24
+ installCmd: 'npm install -g @openai/codex@latest',
25
+ },
26
+ {
27
+ name: 'Gemini CLI',
28
+ id: 'gemini-cli',
29
+ command: 'gemini',
30
+ versionCmd: 'gemini --version',
31
+ npmPkg: '@google/gemini-cli',
32
+ installCmd: 'npm install -g @google/gemini-cli@latest',
33
+ },
34
+ ]
35
+
36
+ /**
37
+ * ่Žทๅ–ๆœฌๅœฐๅทฒๅฎ‰่ฃ…็‰ˆๆœฌ
38
+ */
39
+ function getLocalVersion(tool) {
40
+ try {
41
+ const output = execSync(tool.versionCmd, { stdio: 'pipe', timeout: 10000 })
42
+ .toString().trim()
43
+ // ๆๅ–็‰ˆๆœฌๅท๏ผˆๅŒน้… x.y.z ๆ ผๅผ๏ผ‰
44
+ const match = output.match(/(\d+\.\d+\.\d+[\w.-]*)/)
45
+ return match ? match[1] : output.split('\n')[0].slice(0, 30)
46
+ } catch {
47
+ return null
48
+ }
49
+ }
50
+
51
+ /**
52
+ * ไปŽ npm registry ่Žทๅ–ๆœ€ๆ–ฐ็‰ˆๆœฌ
53
+ */
54
+ async function getLatestVersion(npmPkg) {
55
+ try {
56
+ const https = require('https')
57
+ return new Promise((resolve) => {
58
+ const req = https.get(
59
+ `https://registry.npmjs.org/${npmPkg}/latest`,
60
+ { timeout: 8000 },
61
+ (res) => {
62
+ let data = ''
63
+ res.on('data', chunk => { data += chunk })
64
+ res.on('end', () => {
65
+ try {
66
+ resolve(JSON.parse(data).version || null)
67
+ } catch { resolve(null) }
68
+ })
69
+ }
70
+ )
71
+ req.on('error', () => resolve(null))
72
+ req.setTimeout(8000, () => { req.destroy(); resolve(null) })
73
+ })
74
+ } catch {
75
+ return null
76
+ }
77
+ }
78
+
79
+ /**
80
+ * ๆ‰ง่กŒๅ‡็บง
81
+ */
82
+ function runUpgrade(tool) {
83
+ try {
84
+ console.log(chalk.gray(` ่ฟ่กŒ: ${tool.installCmd}`))
85
+ execSync(tool.installCmd, { stdio: 'inherit', timeout: 120000 })
86
+ return true
87
+ } catch (e) {
88
+ console.log(chalk.red(` โœ— ๅ‡็บงๅคฑ่ดฅ: ${e.message}`))
89
+ return false
90
+ }
91
+ }
92
+
93
+ async function upgrade() {
94
+ console.log()
95
+ console.log(chalk.bold('๐Ÿ”„ HolySheep Upgrade โ€” ๅ‡็บง AI ็ผ–็จ‹ๅทฅๅ…ท'))
96
+ console.log(chalk.gray('โ”'.repeat(50)))
97
+ console.log()
98
+
99
+ let hasInstalled = false
100
+ let upgraded = 0
101
+ let alreadyLatest = 0
102
+
103
+ for (const tool of UPGRADABLE_TOOLS) {
104
+ const installed = commandExists(tool.command)
105
+
106
+ if (!installed) {
107
+ console.log(` ${chalk.gray('โ—‹')} ${chalk.gray(tool.name.padEnd(18))} ${chalk.gray('ๆœชๅฎ‰่ฃ…')} ${chalk.gray(`โ€” ${tool.installCmd}`)}`)
108
+ continue
109
+ }
110
+
111
+ hasInstalled = true
112
+ const localVer = getLocalVersion(tool)
113
+ process.stdout.write(` ${chalk.cyan('โ—Œ')} ${tool.name.padEnd(18)} ${chalk.gray('v' + (localVer || '?'))} โ†’ ๆฃ€ๆŸฅๆœ€ๆ–ฐ็‰ˆๆœฌ...`)
114
+
115
+ const latestVer = await getLatestVersion(tool.npmPkg)
116
+
117
+ if (!latestVer) {
118
+ console.log(chalk.yellow(' ๆ— ๆณ•่Žทๅ–ๆœ€ๆ–ฐ็‰ˆๆœฌ'))
119
+ continue
120
+ }
121
+
122
+ if (localVer === latestVer) {
123
+ // ็”จ \r ่ฆ†็›–ๅฝ“ๅ‰่กŒ
124
+ console.log(`\r ${chalk.green('โœ“')} ${chalk.green(tool.name.padEnd(18))} ${chalk.gray('v' + localVer)} ${chalk.green('ๅทฒๆ˜ฏๆœ€ๆ–ฐ็‰ˆๆœฌ')} `)
125
+ alreadyLatest++
126
+ continue
127
+ }
128
+
129
+ console.log(`\r ${chalk.yellow('โ†‘')} ${chalk.yellow(tool.name.padEnd(18))} ${chalk.gray('v' + (localVer || '?'))} โ†’ ${chalk.cyan('v' + latestVer)} `)
130
+
131
+ const success = runUpgrade(tool)
132
+ if (success) {
133
+ const newVer = getLocalVersion(tool)
134
+ console.log(` ${chalk.green('โœ“')} ${chalk.green(tool.name)} ๅ‡็บงๆˆๅŠŸ โ†’ ${chalk.cyan('v' + (newVer || latestVer))}`)
135
+ upgraded++
136
+ }
137
+ console.log()
138
+ }
139
+
140
+ // ๆ€ป็ป“
141
+ console.log()
142
+ if (!hasInstalled) {
143
+ console.log(chalk.yellow('ๆฒกๆœ‰ๆฃ€ๆต‹ๅˆฐๅทฒๅฎ‰่ฃ…็š„ AI ็ผ–็จ‹ๅทฅๅ…ทใ€‚'))
144
+ console.log(chalk.gray('ๆ”ฏๆŒ็š„ๅทฅๅ…ท: Claude Code, Codex CLI, Gemini CLI'))
145
+ console.log(chalk.gray('ๅฎ‰่ฃ…็คบไพ‹: npm install -g @anthropic-ai/claude-code'))
146
+ } else if (upgraded > 0) {
147
+ console.log(chalk.green(`โœ“ ๅ‡็บงไบ† ${upgraded} ไธชๅทฅๅ…ท`))
148
+ } else if (alreadyLatest > 0) {
149
+ console.log(chalk.green('โœ“ ๆ‰€ๆœ‰ๅทฅๅ…ทๅทฒๆ˜ฏๆœ€ๆ–ฐ็‰ˆๆœฌ'))
150
+ }
151
+ console.log()
152
+ }
153
+
154
+ module.exports = upgrade
package/src/index.js CHANGED
@@ -125,6 +125,16 @@ program
125
125
  await require('./commands/reset')(opts)
126
126
  })
127
127
 
128
+ // โ”€โ”€ upgrade โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
129
+ program
130
+ .command('upgrade')
131
+ .alias('update')
132
+ .description('ๅ‡็บง Claude Code / Codex / Gemini CLI ๅˆฐๆœ€ๆ–ฐ็‰ˆๆœฌ')
133
+ .action(async () => {
134
+ printBanner()
135
+ await require('./commands/upgrade')()
136
+ })
137
+
128
138
  // โ”€โ”€ tools โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
129
139
  program
130
140
  .command('tools')
@@ -155,6 +165,7 @@ program
155
165
  console.log(` ${chalk.bold('hs whoami')} ๆŸฅ็œ‹ๅฝ“ๅ‰็™ปๅฝ•็Šถๆ€`)
156
166
  console.log(` ${chalk.bold('hs doctor')} ๆฃ€ๆŸฅ้…็ฝฎ็Šถๆ€`)
157
167
  console.log(` ${chalk.bold('hs balance')} ๆŸฅ็œ‹่ดฆๆˆทไฝ™้ข`)
168
+ console.log(` ${chalk.bold('hs upgrade')} ๅ‡็บง Claude Code / Codex / Gemini CLI`)
158
169
  console.log(` ${chalk.bold('hs tools')} ๆŸฅ็œ‹ๆ”ฏๆŒ็š„ๅทฅๅ…ทๅˆ—่กจ`)
159
170
  console.log()
160
171
  console.log(chalk.gray(`ๆณจๅ†Œ่ดฆๅท: https://holysheep.ai`))