@inference/cli 0.0.2 → 0.0.3

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/bin/inf.cjs +61 -0
  2. package/package.json +9 -5
package/bin/inf.cjs ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const { execFileSync } = require("child_process");
6
+ const { existsSync } = require("fs");
7
+ const path = require("path");
8
+
9
+ const PLATFORM_PACKAGES = {
10
+ darwin_arm64: "@inference/cli-darwin-arm64",
11
+ darwin_x64: "@inference/cli-darwin-x64",
12
+ linux_x64: "@inference/cli-linux-x64",
13
+ linux_arm64: "@inference/cli-linux-arm64",
14
+ };
15
+
16
+ function getBinaryPath() {
17
+ const platformKey = `${process.platform}_${process.arch}`;
18
+ const packageName = PLATFORM_PACKAGES[platformKey];
19
+
20
+ if (!packageName) {
21
+ console.error(
22
+ `Unsupported platform: ${process.platform} ${process.arch}\n` +
23
+ `@inference/cli supports: darwin arm64, darwin x64, linux x64, linux arm64`,
24
+ );
25
+ process.exit(1);
26
+ }
27
+
28
+ // Try require.resolve first
29
+ try {
30
+ return require.resolve(`${packageName}/bin/inf`);
31
+ } catch {}
32
+
33
+ // Fallback: walk up node_modules
34
+ let dir = __dirname;
35
+ for (let i = 0; i < 5; i++) {
36
+ const candidate = path.join(dir, "node_modules", packageName, "bin", "inf");
37
+ if (existsSync(candidate)) return candidate;
38
+ dir = path.dirname(dir);
39
+ }
40
+
41
+ console.error(
42
+ `Could not find the @inference/cli binary for ${process.platform} ${process.arch}.\n\n` +
43
+ `Try reinstalling:\n` +
44
+ ` npm install @inference/cli\n\n` +
45
+ `Or install the platform package directly:\n` +
46
+ ` npm install ${packageName}`,
47
+ );
48
+ process.exit(1);
49
+ }
50
+
51
+ try {
52
+ execFileSync(getBinaryPath(), process.argv.slice(2), {
53
+ stdio: "inherit",
54
+ env: process.env,
55
+ });
56
+ } catch (err) {
57
+ if (err && typeof err.status === "number") {
58
+ process.exit(err.status);
59
+ }
60
+ process.exit(1);
61
+ }
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@inference/cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Inference.net CLI - manage training runs, evals, datasets, and inferences from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "bin": {
8
+ "inf": "bin/inf.cjs"
9
+ },
7
10
  "files": [
11
+ "bin/inf.cjs",
8
12
  "package.json",
9
13
  "README.md"
10
14
  ],
@@ -22,10 +26,10 @@
22
26
  "ai"
23
27
  ],
24
28
  "optionalDependencies": {
25
- "@inference/cli-darwin-arm64": "0.0.2",
26
- "@inference/cli-darwin-x64": "0.0.2",
27
- "@inference/cli-linux-x64": "0.0.2",
28
- "@inference/cli-linux-arm64": "0.0.2"
29
+ "@inference/cli-darwin-arm64": "0.0.3",
30
+ "@inference/cli-darwin-x64": "0.0.3",
31
+ "@inference/cli-linux-x64": "0.0.3",
32
+ "@inference/cli-linux-arm64": "0.0.3"
29
33
  },
30
34
  "scripts": {
31
35
  "build": "bun run clean:bin && bun run build:cli",