@simonyea/holysheep-cli 1.5.4 โ 1.5.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/README.md +5 -0
- package/package.json +2 -2
- package/src/commands/upgrade.js +154 -0
- package/src/index.js +11 -0
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/@simonyea/holysheep-cli)
|
|
8
8
|
[](https://www.npmjs.com/package/@simonyea/holysheep-cli)
|
|
9
9
|
[](LICENSE)
|
|
10
|
+
[](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.
|
|
3
|
+
"version": "1.5.5",
|
|
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
|
+
}
|
|
@@ -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`))
|