@simonyea/holysheep-cli 1.7.85 → 1.7.87
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/tools/antigravity.js +96 -0
- package/src/tools/index.js +1 -0
- package/src/webui/server.js +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.87",
|
|
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",
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antigravity 适配器 (Google Antigravity IDE)
|
|
3
|
+
*
|
|
4
|
+
* CLI 命令:agy(macOS/Linux),Windows 为桌面应用无 CLI
|
|
5
|
+
* 配置文件:~/.gemini/settings.json(与 Gemini CLI 共享,只 merge 不覆盖)
|
|
6
|
+
* 通过 apiEndpoint + apiKeyHeader 字段配置 HolySheep 代理
|
|
7
|
+
*/
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
const fs = require('fs')
|
|
11
|
+
const path = require('path')
|
|
12
|
+
const os = require('os')
|
|
13
|
+
const { commandExists } = require('../utils/which')
|
|
14
|
+
|
|
15
|
+
const GEMINI_DIR = path.join(os.homedir(), '.gemini')
|
|
16
|
+
const SETTINGS_FILE = path.join(GEMINI_DIR, 'settings.json')
|
|
17
|
+
|
|
18
|
+
function readSettings() {
|
|
19
|
+
try {
|
|
20
|
+
if (fs.existsSync(SETTINGS_FILE)) {
|
|
21
|
+
return JSON.parse(fs.readFileSync(SETTINGS_FILE, 'utf8'))
|
|
22
|
+
}
|
|
23
|
+
} catch {}
|
|
24
|
+
return {}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function writeSettings(data) {
|
|
28
|
+
if (!fs.existsSync(GEMINI_DIR)) fs.mkdirSync(GEMINI_DIR, { recursive: true })
|
|
29
|
+
fs.writeFileSync(SETTINGS_FILE, JSON.stringify(data, null, 2), 'utf8')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const INSTALL_CMD = process.platform === 'win32'
|
|
33
|
+
? 'winget install Google.Antigravity'
|
|
34
|
+
: process.platform === 'darwin'
|
|
35
|
+
? 'brew install --cask antigravity'
|
|
36
|
+
: 'flatpak install flathub com.google.Antigravity'
|
|
37
|
+
|
|
38
|
+
// Windows 常见安装路径(桌面应用,无 CLI)
|
|
39
|
+
function findWindowsApp() {
|
|
40
|
+
const localAppData = process.env.LOCALAPPDATA || ''
|
|
41
|
+
const programFiles = process.env.ProgramFiles || 'C:\\Program Files'
|
|
42
|
+
const candidates = [
|
|
43
|
+
path.join(localAppData, 'Antigravity'),
|
|
44
|
+
path.join(localAppData, 'Google', 'Antigravity'),
|
|
45
|
+
path.join(localAppData, 'Programs', 'Antigravity'),
|
|
46
|
+
path.join(localAppData, 'Programs', 'Google Antigravity'),
|
|
47
|
+
path.join(programFiles, 'Antigravity'),
|
|
48
|
+
path.join(programFiles, 'Google', 'Antigravity'),
|
|
49
|
+
]
|
|
50
|
+
return candidates.find(p => fs.existsSync(p)) || null
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
name: 'Antigravity',
|
|
55
|
+
id: 'antigravity',
|
|
56
|
+
|
|
57
|
+
checkInstalled() {
|
|
58
|
+
// CLI in PATH
|
|
59
|
+
if (commandExists('agy')) return true
|
|
60
|
+
// Windows: 桌面应用检测
|
|
61
|
+
if (process.platform === 'win32') return !!findWindowsApp()
|
|
62
|
+
// macOS: .app 检测
|
|
63
|
+
if (process.platform === 'darwin') return fs.existsSync('/Applications/Antigravity.app')
|
|
64
|
+
return false
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
isConfigured() {
|
|
68
|
+
const s = readSettings()
|
|
69
|
+
return !!(s.apiKey?.startsWith('cr_') && s.apiEndpoint?.includes('holysheep.ai'))
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
configure(apiKey, _baseUrlAnthropic, baseUrlOpenAI) {
|
|
73
|
+
const settings = readSettings()
|
|
74
|
+
settings.selectedAuthType = 'api-key'
|
|
75
|
+
settings.apiKey = apiKey
|
|
76
|
+
settings.apiEndpoint = baseUrlOpenAI // https://api.holysheep.ai/v1
|
|
77
|
+
settings.apiKeyHeader = 'authorization'
|
|
78
|
+
writeSettings(settings)
|
|
79
|
+
return { file: SETTINGS_FILE, hot: true }
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
reset() {
|
|
83
|
+
const s = readSettings()
|
|
84
|
+
delete s.apiKey
|
|
85
|
+
delete s.apiEndpoint
|
|
86
|
+
delete s.apiKeyHeader
|
|
87
|
+
if (s.selectedAuthType === 'api-key') delete s.selectedAuthType
|
|
88
|
+
writeSettings(s)
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
getConfigPath() { return SETTINGS_FILE },
|
|
92
|
+
launchCmd: process.platform === 'win32' ? null : 'agy',
|
|
93
|
+
installCmd: INSTALL_CMD,
|
|
94
|
+
hint: '配置写入 ~/.gemini/settings.json',
|
|
95
|
+
docsUrl: 'https://antigravity.google',
|
|
96
|
+
}
|
package/src/tools/index.js
CHANGED
package/src/webui/server.js
CHANGED
|
@@ -122,6 +122,13 @@ const AUTO_INSTALL = {
|
|
|
122
122
|
'opencode': { cmd: 'npm install -g opencode-ai' },
|
|
123
123
|
'openclaw': { cmd: 'npm install -g openclaw@latest --ignore-scripts' },
|
|
124
124
|
'aider': { cmd: 'pip install aider-chat' },
|
|
125
|
+
'antigravity': {
|
|
126
|
+
cmd: process.platform === 'win32'
|
|
127
|
+
? 'winget install Google.Antigravity'
|
|
128
|
+
: process.platform === 'darwin'
|
|
129
|
+
? 'brew install --cask antigravity'
|
|
130
|
+
: 'flatpak install flathub com.google.Antigravity',
|
|
131
|
+
},
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
// ── UPGRADABLE_TOOLS (from upgrade.js) ───────────────────────────────────────
|
|
@@ -140,6 +147,15 @@ const UPGRADABLE_TOOLS = [
|
|
|
140
147
|
{ name: 'OpenCode', id: 'opencode', command: 'opencode', versionCmd: 'opencode --version', npmPkg: 'opencode-ai', installCmd: 'npm install -g opencode-ai@latest' },
|
|
141
148
|
{ name: 'OpenClaw', id: 'openclaw', command: 'openclaw', versionCmd: 'openclaw --version', npmPkg: 'openclaw', installCmd: 'npm install -g openclaw@latest --ignore-scripts' },
|
|
142
149
|
{ name: 'Gemini CLI', id: 'gemini-cli', command: 'gemini', versionCmd: 'gemini --version', npmPkg: '@google/gemini-cli', installCmd: 'npm install -g @google/gemini-cli@latest' },
|
|
150
|
+
{
|
|
151
|
+
name: 'Antigravity', id: 'antigravity', command: 'agy',
|
|
152
|
+
versionCmd: 'agy --version', npmPkg: null,
|
|
153
|
+
installCmd: process.platform === 'win32'
|
|
154
|
+
? 'winget install Google.Antigravity'
|
|
155
|
+
: process.platform === 'darwin'
|
|
156
|
+
? 'brew install --cask antigravity'
|
|
157
|
+
: 'flatpak install flathub com.google.Antigravity',
|
|
158
|
+
},
|
|
143
159
|
]
|
|
144
160
|
|
|
145
161
|
// ── Update check (cached, refreshes every 30min) ────────────────────────────
|