@zyzheal/ola-cc 0.3.15 → 0.3.16

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.
Files changed (2) hide show
  1. package/install.cjs +40 -1
  2. package/package.json +9 -9
package/install.cjs CHANGED
@@ -37,6 +37,8 @@ function detectPlatform() {
37
37
  const arch = process.arch
38
38
 
39
39
  let isMusl = false
40
+ let isRedHatCompatible = false
41
+
40
42
  if (platform === 'linux') {
41
43
  try {
42
44
  const report = typeof process.report?.getReport === 'function'
@@ -46,11 +48,48 @@ function detectPlatform() {
46
48
  } catch {
47
49
  try {
48
50
  const ldd = require('child_process').execSync('ldd --version 2>&1', { encoding: 'utf8' })
49
- isMusl = ldd.toLowerCase().includes('musl')
51
+ const lddLower = ldd.toLowerCase()
52
+ isMusl = lddLower.includes('musl')
53
+ // 检测 glibc 版本 - RHEL/Rocky/AlmaLinux 8+ 使用 glibc 2.28
54
+ // CentOS 7 使用 glibc 2.17
55
+ const glibcMatch = ldd.match(/glibc(?:64)?\s+(\d+)\.(\d+)/)
56
+ if (glibcMatch) {
57
+ const major = parseInt(glibcMatch[1], 10)
58
+ const minor = parseInt(glibcMatch[2], 10)
59
+ // glibc 2.28+ (RHEL 8+, Rocky 8+, AlmaLinux 8+)
60
+ isRedHatCompatible = major > 2 || (major === 2 && minor >= 28)
61
+ }
50
62
  } catch {
51
63
  // Assume glibc if we can't determine
52
64
  }
53
65
  }
66
+
67
+ // 尝试读取 /etc/os-release 获取更精确的发行版信息
68
+ try {
69
+ const osRelease = require('fs').readFileSync('/etc/os-release', 'utf8')
70
+ const idMatch = osRelease.match(/^ID="?([^"\n]+)"?/m)
71
+ if (idMatch) {
72
+ const id = idMatch[1].toLowerCase()
73
+ // Rocky Linux, AlmaLinux, RHEL, CentOS Stream 都使用 glibc 2.28+ (version 8+)
74
+ if (id === 'rocky' || id === 'alma' || id === 'rhel' || id === 'centos') {
75
+ const versionMatch = osRelease.match(/^VERSION_ID="?(\d+)"?/m)
76
+ if (versionMatch) {
77
+ const majorVersion = parseInt(versionMatch[1], 10)
78
+ if (majorVersion >= 8) {
79
+ isRedHatCompatible = true
80
+ }
81
+ }
82
+ }
83
+ }
84
+ } catch {
85
+ // 无法读取 os-release
86
+ }
87
+ }
88
+
89
+ // 对于 Red Hat 兼容系统 (Rock8, Alma8, RHEL 8+) 使用标准 glibc 版本
90
+ // 而不是 musl 版本
91
+ if (platform === 'linux' && isRedHatCompatible && !isMusl) {
92
+ return `${platform}-${arch}`
54
93
  }
55
94
 
56
95
  return platform === 'linux'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyzheal/ola-cc",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "Ola CC - AI coding assistant in your terminal",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "commonjs",
@@ -20,14 +20,14 @@
20
20
  },
21
21
  "dependencies": {},
22
22
  "optionalDependencies": {
23
- "@zyzheal/ola-cc-darwin-arm64": "0.3.15",
24
- "@zyzheal/ola-cc-darwin-x64": "0.3.15",
25
- "@zyzheal/ola-cc-linux-x64": "0.3.15",
26
- "@zyzheal/ola-cc-linux-arm64": "0.3.15",
27
- "@zyzheal/ola-cc-linux-x64-musl": "0.3.15",
28
- "@zyzheal/ola-cc-linux-arm64-musl": "0.3.15",
29
- "@zyzheal/ola-cc-win32-x64": "0.3.15",
30
- "@zyzheal/ola-cc-win32-arm64": "0.3.15"
23
+ "@zyzheal/ola-cc-darwin-arm64": "0.3.16",
24
+ "@zyzheal/ola-cc-darwin-x64": "0.3.16",
25
+ "@zyzheal/ola-cc-linux-x64": "0.3.16",
26
+ "@zyzheal/ola-cc-linux-arm64": "0.3.16",
27
+ "@zyzheal/ola-cc-linux-x64-musl": "0.3.16",
28
+ "@zyzheal/ola-cc-linux-arm64-musl": "0.3.16",
29
+ "@zyzheal/ola-cc-win32-x64": "0.3.16",
30
+ "@zyzheal/ola-cc-win32-arm64": "0.3.16"
31
31
  },
32
32
  "files": [
33
33
  "bin/ola-cc.js",