@sylphai/adal-cli 1.2.1 → 1.2.2-beta.1

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/bin/adal-cli.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * This wrapper uses cached platform package path for better performance
6
6
  */
7
7
 
8
- const { spawn } = require('child_process');
8
+ const { spawn, spawnSync } = require('child_process');
9
9
  const path = require('path');
10
10
  const fs = require('fs');
11
11
  const os = require('os');
@@ -14,18 +14,33 @@ const os = require('os');
14
14
  const platform = os.platform();
15
15
  const arch = os.arch();
16
16
 
17
- // Map Node.js platform/arch to our package naming
18
- // Map Node.js platform/arch to our package naming
17
+ // Detect Linux libc flavour. On musl distros (Alpine and similar) we need
18
+ // the -musl platform package; the glibc-linked Bun in the regular linux-x64
19
+ // tarball fails to load because /lib64/ld-linux-x86-64.so.2 is absent.
20
+ function detectLinuxLibc() {
21
+ if (platform !== 'linux') return null;
22
+ if (fs.existsSync('/etc/alpine-release')) return 'musl';
23
+ try {
24
+ const out = spawnSync('ldd', ['--version'], { encoding: 'utf8' });
25
+ if (/musl/i.test((out.stdout || '') + (out.stderr || ''))) return 'musl';
26
+ } catch (_) {}
27
+ return 'glibc';
28
+ }
29
+
30
+ const libc = detectLinuxLibc();
31
+
32
+ // Map Node.js platform/arch (+ libc on Linux) to our package naming
19
33
  const platformMap = {
20
34
  'darwin-arm64': '@sylphai/adal-cli-darwin-arm64',
21
35
  'darwin-x64': '@sylphai/adal-cli-darwin-x64',
22
36
  'linux-x64': '@sylphai/adal-cli-linux-x64',
37
+ 'linux-x64-musl': '@sylphai/adal-cli-linux-x64-musl',
23
38
  'linux-arm64': '@sylphai/adal-cli-linux-arm64',
24
39
  'win32-x64': '@sylphai/adal-cli-win32-x64',
25
40
  'win32-ia32': '@sylphai/adal-cli-win32-x64', // Use x64 for 32-bit Windows too
26
41
  };
27
42
 
28
- const platformKey = `${platform}-${arch}`;
43
+ const platformKey = libc === 'musl' ? `${platform}-${arch}-musl` : `${platform}-${arch}`;
29
44
  const packageName = platformMap[platformKey];
30
45
 
31
46
  if (!packageName) {
@@ -34,7 +49,7 @@ if (!packageName) {
34
49
  console.error('AdaL CLI currently supports:');
35
50
  console.error(' • macOS (Apple Silicon)');
36
51
  console.error(' • macOS (Intel)');
37
- console.error(' • Linux (x64)');
52
+ console.error(' • Linux (x64, glibc or musl)');
38
53
  console.error(' • Linux (arm64)');
39
54
  console.error(' • Windows (x64)');
40
55
  console.error('');
@@ -6,20 +6,35 @@
6
6
  const os = require('os');
7
7
  const path = require('path');
8
8
  const fs = require('fs');
9
+ const { spawnSync } = require('child_process');
9
10
 
10
11
  const platformMap = {
11
12
  'darwin-arm64': '@sylphai/adal-cli-darwin-arm64',
12
13
  'darwin-x64': '@sylphai/adal-cli-darwin-x64',
13
14
  'linux-x64': '@sylphai/adal-cli-linux-x64',
15
+ 'linux-x64-musl': '@sylphai/adal-cli-linux-x64-musl',
14
16
  'linux-arm64': '@sylphai/adal-cli-linux-arm64',
15
17
  'win32-x64': '@sylphai/adal-cli-win32-x64',
16
18
  'win32-ia32': '@sylphai/adal-cli-win32-x64',
17
19
  };
18
20
 
21
+ // Detect Linux libc flavour. Keep in sync with the same helper in
22
+ // bin/adal-cli.js and lib/setup-cache.js.
23
+ function detectLinuxLibc(platform) {
24
+ if (platform !== 'linux') return null;
25
+ if (fs.existsSync('/etc/alpine-release')) return 'musl';
26
+ try {
27
+ const out = spawnSync('ldd', ['--version'], { encoding: 'utf8' });
28
+ if (/musl/i.test((out.stdout || '') + (out.stderr || ''))) return 'musl';
29
+ } catch (_) {}
30
+ return 'glibc';
31
+ }
32
+
19
33
  function getCurrentPlatformPackage() {
20
34
  const platform = os.platform();
21
35
  const arch = os.arch();
22
- const platformKey = `${platform}-${arch}`;
36
+ const libc = detectLinuxLibc(platform);
37
+ const platformKey = libc === 'musl' ? `${platform}-${arch}-musl` : `${platform}-${arch}`;
23
38
  return platformMap[platformKey];
24
39
  }
25
40
 
@@ -8,21 +8,38 @@
8
8
  const path = require('path');
9
9
  const fs = require('fs');
10
10
  const os = require('os');
11
+ const { spawnSync } = require('child_process');
11
12
 
12
13
  // Determine current platform
13
14
  const platform = os.platform();
14
15
  const arch = os.arch();
15
16
 
17
+ // Detect Linux libc flavour — same logic as bin/adal-cli.js. Keep these
18
+ // two in sync: postinstall caches the wrong path if libc detection differs
19
+ // from runtime.
20
+ function detectLinuxLibc() {
21
+ if (platform !== 'linux') return null;
22
+ if (fs.existsSync('/etc/alpine-release')) return 'musl';
23
+ try {
24
+ const out = spawnSync('ldd', ['--version'], { encoding: 'utf8' });
25
+ if (/musl/i.test((out.stdout || '') + (out.stderr || ''))) return 'musl';
26
+ } catch (_) {}
27
+ return 'glibc';
28
+ }
29
+
30
+ const libc = detectLinuxLibc();
31
+
16
32
  const platformMap = {
17
33
  'darwin-arm64': '@sylphai/adal-cli-darwin-arm64',
18
34
  'darwin-x64': '@sylphai/adal-cli-darwin-x64',
19
35
  'linux-x64': '@sylphai/adal-cli-linux-x64',
36
+ 'linux-x64-musl': '@sylphai/adal-cli-linux-x64-musl',
20
37
  'linux-arm64': '@sylphai/adal-cli-linux-arm64',
21
38
  'win32-x64': '@sylphai/adal-cli-win32-x64',
22
39
  'win32-ia32': '@sylphai/adal-cli-win32-x64',
23
40
  };
24
41
 
25
- const platformKey = `${platform}-${arch}`;
42
+ const platformKey = libc === 'musl' ? `${platform}-${arch}-musl` : `${platform}-${arch}`;
26
43
  const packageName = platformMap[platformKey];
27
44
 
28
45
  if (!packageName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sylphai/adal-cli",
3
- "version": "1.2.1",
3
+ "version": "1.2.2-beta.1",
4
4
  "description": "AI-powered CLI for development and research tasks",
5
5
  "bin": {
6
6
  "adal": "bin/adal-cli.js"
@@ -9,11 +9,12 @@
9
9
  "postinstall": "node lib/setup-cache.js"
10
10
  },
11
11
  "optionalDependencies": {
12
- "@sylphai/adal-cli-darwin-arm64": "1.2.1",
13
- "@sylphai/adal-cli-darwin-x64": "1.2.1",
14
- "@sylphai/adal-cli-linux-x64": "1.2.1",
15
- "@sylphai/adal-cli-linux-arm64": "1.2.1",
16
- "@sylphai/adal-cli-win32-x64": "1.2.1"
12
+ "@sylphai/adal-cli-darwin-arm64": "1.2.2-beta.1",
13
+ "@sylphai/adal-cli-darwin-x64": "1.2.2-beta.1",
14
+ "@sylphai/adal-cli-linux-x64": "1.2.2-beta.1",
15
+ "@sylphai/adal-cli-linux-x64-musl": "1.2.2-beta.1",
16
+ "@sylphai/adal-cli-linux-arm64": "1.2.2-beta.1",
17
+ "@sylphai/adal-cli-win32-x64": "1.2.2-beta.1"
17
18
  },
18
19
  "files": [
19
20
  "bin/",