@sansavision/vektor 0.1.0-alpha.1
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 +5 -0
- package/bin/your-tool-mcp.js +24 -0
- package/bin/your-tool.js +24 -0
- package/index.js +47 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require("child_process");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const { resolveBin } = require("../index");
|
|
7
|
+
|
|
8
|
+
const exe = os.platform() === "win32" ? "your-tool-mcp.exe" : "your-tool-mcp";
|
|
9
|
+
const bin = resolveBin(exe);
|
|
10
|
+
|
|
11
|
+
if (!bin) {
|
|
12
|
+
console.error(
|
|
13
|
+
"your-tool-mcp: native binary not found for this platform.\n" +
|
|
14
|
+
"Reinstall to ensure optionalDependencies are installed: npm install @YOUR_SCOPE/YOUR_TOOL\n",
|
|
15
|
+
);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
20
|
+
if (r.error) {
|
|
21
|
+
console.error("your-tool-mcp: failed to launch:", r.error.message);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
process.exit(r.status ?? 0);
|
package/bin/your-tool.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require("child_process");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const { resolveBin } = require("../index");
|
|
7
|
+
|
|
8
|
+
const exe = os.platform() === "win32" ? "your-tool.exe" : "your-tool";
|
|
9
|
+
const bin = resolveBin(exe);
|
|
10
|
+
|
|
11
|
+
if (!bin) {
|
|
12
|
+
console.error(
|
|
13
|
+
"your-tool: native binary not found for this platform.\n" +
|
|
14
|
+
"Reinstall to ensure optionalDependencies are installed: npm install @YOUR_SCOPE/YOUR_TOOL\n",
|
|
15
|
+
);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
20
|
+
if (r.error) {
|
|
21
|
+
console.error("your-tool: failed to launch:", r.error.message);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
process.exit(r.status ?? 0);
|
package/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Optional: expose programmatic helpers (paths, spawn helpers, etc.)
|
|
4
|
+
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
|
|
9
|
+
function platformPackageName() {
|
|
10
|
+
const p = os.platform();
|
|
11
|
+
const a = os.arch();
|
|
12
|
+
|
|
13
|
+
if (p === "darwin" && a === "arm64")
|
|
14
|
+
return "@YOUR_SCOPE/YOUR_TOOL-darwin-arm64";
|
|
15
|
+
if (p === "darwin" && a === "x64") return "@YOUR_SCOPE/YOUR_TOOL-darwin-x64";
|
|
16
|
+
if (p === "linux" && a === "x64")
|
|
17
|
+
return "@YOUR_SCOPE/YOUR_TOOL-linux-x64-musl";
|
|
18
|
+
if (p === "linux" && a === "arm64")
|
|
19
|
+
return "@YOUR_SCOPE/YOUR_TOOL-linux-arm64-musl";
|
|
20
|
+
if (p === "win32" && a === "x64")
|
|
21
|
+
return "@YOUR_SCOPE/YOUR_TOOL-win32-x64-msvc";
|
|
22
|
+
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function resolveBin(name) {
|
|
27
|
+
const pkg = platformPackageName();
|
|
28
|
+
if (!pkg) return null;
|
|
29
|
+
|
|
30
|
+
let pkgJsonPath;
|
|
31
|
+
try {
|
|
32
|
+
pkgJsonPath = require.resolve(`${pkg}/package.json`);
|
|
33
|
+
} catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const root = path.dirname(pkgJsonPath);
|
|
38
|
+
const p = path.join(root, "bin", name);
|
|
39
|
+
try {
|
|
40
|
+
fs.accessSync(p);
|
|
41
|
+
return p;
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = { platformPackageName, resolveBin };
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sansavision/vektor",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "Native-binary wrapper (optionalDependencies distribution)",
|
|
5
|
+
"private": false,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "restricted",
|
|
9
|
+
"registry": "https://registry.npmjs.org"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"vektor": "bin/vektor.js"
|
|
16
|
+
},
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@sansavision/vektor-darwin-arm64": "0.1.0-alpha.1",
|
|
19
|
+
"@sansavision/vektor-darwin-x64": "0.1.0-alpha.1",
|
|
20
|
+
"@sansavision/vektor-linux-x64-musl": "0.1.0-alpha.1",
|
|
21
|
+
"@sansavision/vektor-linux-arm64-musl": "0.1.0-alpha.1",
|
|
22
|
+
"@sansavision/vektor-win32-x64-msvc": "0.1.0-alpha.1"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/",
|
|
26
|
+
"index.js",
|
|
27
|
+
"README.md"
|
|
28
|
+
]
|
|
29
|
+
}
|