@antfly/cli 0.0.0

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 (3) hide show
  1. package/README.md +12 -0
  2. package/bin/antfly.js +45 -0
  3. package/package.json +41 -0
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @antfly/cli
2
+
3
+ npm package for installing the native Antfly CLI.
4
+
5
+ ```bash
6
+ npm install -g @antfly/cli
7
+ antfly --version
8
+ ```
9
+
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 and Antfarm dashboard assets.
package/bin/antfly.js ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from "node:child_process";
4
+ import { existsSync } from "node:fs";
5
+ import { createRequire } from "node:module";
6
+ import { join } from "node:path";
7
+
8
+ const require = createRequire(import.meta.url);
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
+ };
15
+
16
+ const platformKey = `${process.platform}-${process.arch}`;
17
+ const packageName = packageByPlatform[platformKey];
18
+
19
+ if (!packageName) {
20
+ console.error(`Unsupported Antfly CLI platform: ${platformKey}`);
21
+ process.exit(1);
22
+ }
23
+
24
+ let packageJsonPath;
25
+ try {
26
+ packageJsonPath = require.resolve(`${packageName}/package.json`);
27
+ } catch {
28
+ console.error(`Missing Antfly CLI platform package: ${packageName}`);
29
+ console.error("Reinstall @antfly/cli and verify optional dependencies were not disabled.");
30
+ process.exit(1);
31
+ }
32
+
33
+ const executable = join(packageJsonPath, "..", "bin", process.platform === "win32" ? "antfly.exe" : "antfly");
34
+ if (!existsSync(executable)) {
35
+ console.error(`Antfly CLI executable is missing: ${executable}`);
36
+ process.exit(1);
37
+ }
38
+
39
+ const result = spawnSync(executable, process.argv.slice(2), { stdio: "inherit" });
40
+ if (result.error) {
41
+ console.error(result.error.message);
42
+ process.exit(1);
43
+ }
44
+
45
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@antfly/cli",
3
+ "version": "0.0.0",
4
+ "description": "Native Antfly CLI installer package",
5
+ "license": "Elastic-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/antflydb/antfly.git",
9
+ "directory": "ts/packages/cli"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/antflydb/antfly/issues"
13
+ },
14
+ "homepage": "https://antfly.io",
15
+ "bin": {
16
+ "antfly": "./bin/antfly.js"
17
+ },
18
+ "files": [
19
+ "bin",
20
+ "README.md"
21
+ ],
22
+ "scripts": {
23
+ "test": "node --check ./bin/antfly.js"
24
+ },
25
+ "optionalDependencies": {
26
+ "@antfly/cli-darwin-arm64": "0.0.0",
27
+ "@antfly/cli-linux-arm64": "0.0.0",
28
+ "@antfly/cli-linux-x64": "0.0.0"
29
+ },
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "os": [
34
+ "darwin",
35
+ "linux"
36
+ ],
37
+ "cpu": [
38
+ "arm64",
39
+ "x64"
40
+ ]
41
+ }