@sys9/run9-cli 0.8.1 → 0.8.2-darwin-x64

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
@@ -1,25 +1,19 @@
1
1
  # @sys9/run9-cli
2
2
 
3
- Install:
3
+ Prefer `@sys9/cli`. It runs run9 as `sys9 run`.
4
4
 
5
- ```sh
6
- npm install -g @sys9/run9-cli
7
- ```
5
+ Install:
8
6
 
9
7
  ```sh
10
- bun install -g @sys9/run9-cli
8
+ npm install -g @sys9/cli
9
+ # or
10
+ bun install -g @sys9/cli
11
11
  ```
12
12
 
13
- The published npm layout mirrors Codex: `@sys9/run9-cli` is a lightweight
14
- launcher package, and the actual native binary arrives through one
15
- platform-specific optional dependency. That keeps installs small because each
16
- machine only downloads its own Linux/macOS `x64` or `arm64` binary.
17
-
18
13
  Run:
19
14
 
20
15
  ```sh
21
- run9 auth login \
22
- --endpoint https://api.run.sys9.ai \
23
- --ak ak-... \
24
- --sk sk-...
16
+ sys9 run --help
25
17
  ```
18
+
19
+ `@sys9/run9-cli` remains the run9 package used by `@sys9/cli`.
package/package.json CHANGED
@@ -1,29 +1,23 @@
1
1
  {
2
2
  "name": "@sys9/run9-cli",
3
- "version": "0.8.1",
4
- "description": "run9 CLI with platform-native npm packages for Linux and macOS",
3
+ "version": "0.8.2-darwin-x64",
4
+ "description": "run9 CLI package used by @sys9/cli",
5
5
  "license": "MIT",
6
- "bin": {
7
- "run9": "bin/run9.js"
8
- },
9
- "engines": {
10
- "node": ">=16"
11
- },
6
+ "os": [
7
+ "darwin"
8
+ ],
9
+ "cpu": [
10
+ "x64"
11
+ ],
12
12
  "files": [
13
- "bin/run9.js"
13
+ "vendor"
14
14
  ],
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
15
  "repository": {
19
16
  "type": "git",
20
17
  "url": "https://github.com/sys9-ai/run9.git",
21
18
  "directory": "run9cli/npm"
22
19
  },
23
- "optionalDependencies": {
24
- "@sys9/run9-cli-linux-x64": "npm:@sys9/run9-cli@0.8.1-linux-x64",
25
- "@sys9/run9-cli-linux-arm64": "npm:@sys9/run9-cli@0.8.1-linux-arm64",
26
- "@sys9/run9-cli-darwin-x64": "npm:@sys9/run9-cli@0.8.1-darwin-x64",
27
- "@sys9/run9-cli-darwin-arm64": "npm:@sys9/run9-cli@0.8.1-darwin-arm64"
20
+ "engines": {
21
+ "node": ">=16"
28
22
  }
29
23
  }
package/bin/run9.js DELETED
@@ -1,130 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { spawn } = require("node:child_process");
4
- const { existsSync } = require("node:fs");
5
- const path = require("node:path");
6
-
7
- const PLATFORM_PACKAGE_BY_TARGET = {
8
- "x86_64-unknown-linux-musl": "@sys9/run9-cli-linux-x64",
9
- "aarch64-unknown-linux-musl": "@sys9/run9-cli-linux-arm64",
10
- "x86_64-apple-darwin": "@sys9/run9-cli-darwin-x64",
11
- "aarch64-apple-darwin": "@sys9/run9-cli-darwin-arm64",
12
- };
13
-
14
- function detectPackageManager() {
15
- const userAgent = process.env.npm_config_user_agent || "";
16
- if (/\bbun\//.test(userAgent)) {
17
- return "bun";
18
- }
19
-
20
- const execPath = process.env.npm_execpath || "";
21
- if (execPath.includes("bun")) {
22
- return "bun";
23
- }
24
-
25
- if (
26
- __dirname.includes(".bun/install/global") ||
27
- __dirname.includes(".bun\\install\\global")
28
- ) {
29
- return "bun";
30
- }
31
-
32
- return userAgent ? "npm" : null;
33
- }
34
-
35
- function resolveTargetTriple(platformName, archName) {
36
- switch (platformName) {
37
- case "linux":
38
- case "android":
39
- switch (archName) {
40
- case "x64":
41
- return "x86_64-unknown-linux-musl";
42
- case "arm64":
43
- return "aarch64-unknown-linux-musl";
44
- default:
45
- return null;
46
- }
47
- case "darwin":
48
- switch (archName) {
49
- case "x64":
50
- return "x86_64-apple-darwin";
51
- case "arm64":
52
- return "aarch64-apple-darwin";
53
- default:
54
- return null;
55
- }
56
- default:
57
- return null;
58
- }
59
- }
60
-
61
- function resolveBinaryPath(vendorRoot, targetTriple) {
62
- const binaryName = process.platform === "win32" ? "run9.exe" : "run9";
63
- const binaryPath = path.join(vendorRoot, targetTriple, "run9", binaryName);
64
- return existsSync(binaryPath) ? binaryPath : null;
65
- }
66
-
67
- const targetTriple = resolveTargetTriple(process.platform, process.arch);
68
- if (!targetTriple) {
69
- throw new Error(`Unsupported platform: ${process.platform} (${process.arch})`);
70
- }
71
-
72
- const platformPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];
73
- if (!platformPackage) {
74
- throw new Error(`Unsupported target triple: ${targetTriple}`);
75
- }
76
-
77
- let binaryPath = null;
78
- try {
79
- const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
80
- binaryPath = resolveBinaryPath(
81
- path.join(path.dirname(packageJsonPath), "vendor"),
82
- targetTriple,
83
- );
84
- } catch {
85
- binaryPath = resolveBinaryPath(path.join(__dirname, "..", "vendor"), targetTriple);
86
- }
87
-
88
- if (!binaryPath) {
89
- const packageManager = detectPackageManager();
90
- const updateCommand =
91
- packageManager === "bun"
92
- ? "bun install -g @sys9/run9-cli@latest"
93
- : "npm install -g @sys9/run9-cli@latest";
94
- throw new Error(
95
- `Missing optional dependency ${platformPackage}. Reinstall run9: ${updateCommand}`,
96
- );
97
- }
98
-
99
- const child = spawn(binaryPath, process.argv.slice(2), {
100
- stdio: "inherit",
101
- env: process.env,
102
- });
103
-
104
- child.on("error", (err) => {
105
- console.error(err);
106
- process.exit(1);
107
- });
108
-
109
- const forwardSignal = (signal) => {
110
- if (child.killed) {
111
- return;
112
- }
113
- try {
114
- child.kill(signal);
115
- } catch {
116
- // Ignore failures while the child is already exiting.
117
- }
118
- };
119
-
120
- ["SIGINT", "SIGTERM", "SIGHUP"].forEach((signal) => {
121
- process.on(signal, () => forwardSignal(signal));
122
- });
123
-
124
- child.on("exit", (code, signal) => {
125
- if (signal) {
126
- process.kill(process.pid, signal);
127
- return;
128
- }
129
- process.exit(code ?? 1);
130
- });