@antfly/cli 0.2.1-rc2 → 0.2.2

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 CHANGED
@@ -8,6 +8,9 @@ antfly --version
8
8
  ```
9
9
 
10
10
  This package is separate from `@antfly/sdk`, which contains the TypeScript SDK.
11
- The CLI package depends on a platform-specific package that carries the native
12
- `antfly` executable, Antfarm dashboard assets, and the Antfly C ABI
13
- header/library.
11
+ The CLI package selects a platform-specific package by OS and CPU. Linux npm
12
+ installations require glibc 2.28 or newer, matching the supported Node.js 24
13
+ runtime. On musl systems, install the portable archive with
14
+ `https://releases.antfly.io/antfly/latest/install.sh` instead. The platform
15
+ package carries the native `antfly` executable, Antfarm dashboard assets, and
16
+ the Antfly C ABI header/library.
package/bin/antfly.js CHANGED
@@ -5,18 +5,21 @@ import { existsSync } from "node:fs";
5
5
  import { createRequire } from "node:module";
6
6
  import { join } from "node:path";
7
7
 
8
- const require = createRequire(import.meta.url);
8
+ import { detectLinuxLibc, resolvePlatformPackage } from "./platform.js";
9
9
 
10
- const packageByPlatform = {
11
- "darwin-arm64": "@antfly/cli-darwin-arm64",
12
- "linux-arm64": "@antfly/cli-linux-arm64",
13
- "linux-x64": "@antfly/cli-linux-x64"
14
- };
10
+ const require = createRequire(import.meta.url);
15
11
 
16
12
  const platformKey = `${process.platform}-${process.arch}`;
17
- const packageName = packageByPlatform[platformKey];
13
+ const packageName = resolvePlatformPackage(process.platform, process.arch);
18
14
 
19
15
  if (!packageName) {
16
+ if (process.platform === "linux" && detectLinuxLibc() !== "glibc") {
17
+ console.error("The npm Antfly CLI supports glibc Linux only.");
18
+ console.error(
19
+ "Install the portable musl build with https://releases.antfly.io/antfly/latest/install.sh instead."
20
+ );
21
+ process.exit(1);
22
+ }
20
23
  console.error(`Unsupported Antfly CLI platform: ${platformKey}`);
21
24
  process.exit(1);
22
25
  }
@@ -30,7 +33,12 @@ try {
30
33
  process.exit(1);
31
34
  }
32
35
 
33
- const executable = join(packageJsonPath, "..", "bin", process.platform === "win32" ? "antfly.exe" : "antfly");
36
+ const executable = join(
37
+ packageJsonPath,
38
+ "..",
39
+ "bin",
40
+ process.platform === "win32" ? "antfly.exe" : "antfly"
41
+ );
34
42
  if (!existsSync(executable)) {
35
43
  console.error(`Antfly CLI executable is missing: ${executable}`);
36
44
  process.exit(1);
@@ -0,0 +1,24 @@
1
+ export function detectLinuxLibc(report = process.report) {
2
+ try {
3
+ // Node 24's supported GNU/Linux floor is glibc 2.28, matching the GNU
4
+ // Antfly archive. The shell installer separately handles older glibc by
5
+ // selecting the portable musl build.
6
+ return report?.getReport()?.header?.glibcVersionRuntime ? "glibc" : "musl";
7
+ } catch {
8
+ return "musl";
9
+ }
10
+ }
11
+
12
+ export function resolvePlatformPackage(platform, arch, report = process.report) {
13
+ if (platform === "darwin" && arch === "arm64") {
14
+ return "@antfly/cli-darwin-arm64";
15
+ }
16
+ if (platform !== "linux" || (arch !== "arm64" && arch !== "x64")) {
17
+ return undefined;
18
+ }
19
+
20
+ if (detectLinuxLibc(report) !== "glibc") {
21
+ return undefined;
22
+ }
23
+ return `@antfly/cli-linux-${arch}`;
24
+ }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@antfly/cli",
3
- "version": "0.2.1-rc2",
3
+ "version": "0.2.2",
4
+ "type": "module",
4
5
  "description": "Native Antfly CLI installer package",
5
6
  "license": "Elastic-2.0",
6
7
  "repository": {
@@ -20,12 +21,12 @@
20
21
  "README.md"
21
22
  ],
22
23
  "scripts": {
23
- "test": "node --check ./bin/antfly.js"
24
+ "test": "node --test ./test/*.test.js && node --check ./bin/antfly.js"
24
25
  },
25
26
  "optionalDependencies": {
26
- "@antfly/cli-darwin-arm64": "0.2.1-rc2",
27
- "@antfly/cli-linux-arm64": "0.2.1-rc2",
28
- "@antfly/cli-linux-x64": "0.2.1-rc2"
27
+ "@antfly/cli-darwin-arm64": "0.2.2",
28
+ "@antfly/cli-linux-arm64": "0.2.2",
29
+ "@antfly/cli-linux-x64": "0.2.2"
29
30
  },
30
31
  "engines": {
31
32
  "node": ">=24.0"