@sys9/smith9-cli 0.1.3 → 0.1.5-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/package.json +10 -16
- package/vendor/x86_64-apple-darwin/smith9/smith9 +0 -0
- package/bin/smith9.js +0 -127
package/package.json
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sys9/smith9-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5-darwin-x64",
|
|
4
4
|
"description": "smith9 CLI with platform-native npm packages for Linux and macOS",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
6
|
+
"os": [
|
|
7
|
+
"darwin"
|
|
8
|
+
],
|
|
9
|
+
"cpu": [
|
|
10
|
+
"x64"
|
|
11
|
+
],
|
|
12
12
|
"files": [
|
|
13
|
-
"
|
|
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/smith9.git",
|
|
21
18
|
"directory": "npm"
|
|
22
19
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"@sys9/smith9-cli-linux-arm64": "npm:@sys9/smith9-cli@0.1.3-linux-arm64",
|
|
26
|
-
"@sys9/smith9-cli-darwin-x64": "npm:@sys9/smith9-cli@0.1.3-darwin-x64",
|
|
27
|
-
"@sys9/smith9-cli-darwin-arm64": "npm:@sys9/smith9-cli@0.1.3-darwin-arm64"
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=16"
|
|
28
22
|
}
|
|
29
23
|
}
|
|
Binary file
|
package/bin/smith9.js
DELETED
|
@@ -1,127 +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/smith9-cli-linux-x64",
|
|
9
|
-
"aarch64-unknown-linux-musl": "@sys9/smith9-cli-linux-arm64",
|
|
10
|
-
"x86_64-apple-darwin": "@sys9/smith9-cli-darwin-x64",
|
|
11
|
-
"aarch64-apple-darwin": "@sys9/smith9-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" ? "smith9.exe" : "smith9";
|
|
63
|
-
const binaryPath = path.join(vendorRoot, targetTriple, "smith9", 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(path.join(path.dirname(packageJsonPath), "vendor"), targetTriple);
|
|
81
|
-
} catch {
|
|
82
|
-
binaryPath = resolveBinaryPath(path.join(__dirname, "..", "vendor"), targetTriple);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (!binaryPath) {
|
|
86
|
-
const packageManager = detectPackageManager();
|
|
87
|
-
const updateCommand =
|
|
88
|
-
packageManager === "bun"
|
|
89
|
-
? "bun install -g @sys9/smith9-cli@latest"
|
|
90
|
-
: "npm install -g @sys9/smith9-cli@latest";
|
|
91
|
-
throw new Error(
|
|
92
|
-
`Missing optional dependency ${platformPackage}. Reinstall smith9: ${updateCommand}`,
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
97
|
-
stdio: "inherit",
|
|
98
|
-
env: process.env,
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
child.on("error", (err) => {
|
|
102
|
-
console.error(err);
|
|
103
|
-
process.exit(1);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
const forwardSignal = (signal) => {
|
|
107
|
-
if (child.killed) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
child.kill(signal);
|
|
112
|
-
} catch {
|
|
113
|
-
// Ignore failures while the child is already exiting.
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
["SIGINT", "SIGTERM", "SIGHUP"].forEach((signal) => {
|
|
118
|
-
process.on(signal, () => forwardSignal(signal));
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
child.on("exit", (code, signal) => {
|
|
122
|
-
if (signal) {
|
|
123
|
-
process.kill(process.pid, signal);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
process.exit(code ?? 1);
|
|
127
|
-
});
|