@simonyea/holysheep-cli 1.7.87 → 1.7.89

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "1.7.87",
3
+ "version": "1.7.89",
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",
@@ -35,30 +35,37 @@ const INSTALL_CMD = process.platform === 'win32'
35
35
  ? 'brew install --cask antigravity'
36
36
  : 'flatpak install flathub com.google.Antigravity'
37
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
38
+ // Windows:通过注册表检测已安装的桌面应用(winget/MSI 安装均会注册)
39
+ function isWindowsAppInstalled() {
40
+ const { execSync } = require('child_process')
41
+ for (const hive of ['HKLM', 'HKCU']) {
42
+ try {
43
+ const out = execSync(
44
+ `reg query "${hive}\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall" /s /f "Antigravity" /d`,
45
+ { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], timeout: 3000 }
46
+ )
47
+ if (out.includes('Antigravity')) return true
48
+ } catch {}
49
+ }
50
+ return false
51
51
  }
52
52
 
53
53
  module.exports = {
54
54
  name: 'Antigravity',
55
55
  id: 'antigravity',
56
56
 
57
+ // 桌面应用:即使检测不到也允许配置(只写 settings.json)
58
+ configOnly: true,
59
+
57
60
  checkInstalled() {
58
61
  // CLI in PATH
59
62
  if (commandExists('agy')) return true
60
- // Windows: 桌面应用检测
61
- if (process.platform === 'win32') return !!findWindowsApp()
63
+ // Windows: 注册表检测桌面应用
64
+ if (process.platform === 'win32') {
65
+ if (isWindowsAppInstalled()) return true
66
+ // 兜底:.gemini 目录存在说明 Antigravity/Gemini 曾运行过
67
+ if (fs.existsSync(GEMINI_DIR)) return true
68
+ }
62
69
  // macOS: .app 检测
63
70
  if (process.platform === 'darwin') return fs.existsSync('/Applications/Antigravity.app')
64
71
  return false
@@ -304,11 +304,12 @@ async function handleDoctor(_req, res) {
304
304
  async function handleTools(_req, res) {
305
305
  const tools = await Promise.all(TOOLS.map(async t => {
306
306
  const installed = t.checkInstalled()
307
+ const canConfigure = installed || !!t.configOnly
307
308
  return {
308
309
  id: t.id,
309
310
  name: t.name,
310
- installed,
311
- configured: installed ? (t.isConfigured?.() || false) : false,
311
+ installed: canConfigure,
312
+ configured: canConfigure ? (t.isConfigured?.() || false) : false,
312
313
  version: installed ? await getVersionAsync(t) : null,
313
314
  installCmd: t.installCmd,
314
315
  hint: t.hint || null,
@@ -536,7 +537,7 @@ async function handleToolConfigure(req, res) {
536
537
 
537
538
  sseStart(res)
538
539
 
539
- if (!tool.checkInstalled()) {
540
+ if (!tool.checkInstalled() && !tool.configOnly) {
540
541
  sseEmit(res, { type: 'error', message: `${tool.name} 未安装` })
541
542
  sseEmit(res, { type: 'done', success: false })
542
543
  return res.end()