@runsec/mcp 1.0.69 → 1.0.70
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/bin/engine-resolve.cjs +49 -0
- package/package.json +3 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Shared optional @runsec/engine-* resolution (runsec-mcp.cjs + binaryResolver must agree).
|
|
5
|
+
*/
|
|
6
|
+
const fs = require("node:fs");
|
|
7
|
+
const path = require("node:path");
|
|
8
|
+
const { createRequire } = require("node:module");
|
|
9
|
+
|
|
10
|
+
const PKG_ROOT = path.join(__dirname, "..");
|
|
11
|
+
|
|
12
|
+
function packageRequire() {
|
|
13
|
+
return createRequire(path.join(PKG_ROOT, "package.json"));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function binCandidates(engine) {
|
|
17
|
+
const pkg = `@runsec/engine-${engine}-${process.platform}-${process.arch}`;
|
|
18
|
+
const posixBin = path.posix.join("bin", engine);
|
|
19
|
+
if (process.platform === "win32") {
|
|
20
|
+
return [`${pkg}/${posixBin}.exe`, `${pkg}/${posixBin}`];
|
|
21
|
+
}
|
|
22
|
+
return [`${pkg}/${posixBin}`];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** @returns {string | null} absolute path to binary */
|
|
26
|
+
function resolveOptionalEngineBinary(engine) {
|
|
27
|
+
const req = packageRequire();
|
|
28
|
+
for (const candidate of binCandidates(engine)) {
|
|
29
|
+
try {
|
|
30
|
+
const resolved = req.resolve(candidate);
|
|
31
|
+
if (fs.existsSync(resolved) && fs.statSync(resolved).size >= 1024) {
|
|
32
|
+
return resolved;
|
|
33
|
+
}
|
|
34
|
+
} catch {
|
|
35
|
+
// try next candidate
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function hasOptionalEngine(engine) {
|
|
42
|
+
return Boolean(resolveOptionalEngineBinary(engine));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = {
|
|
46
|
+
PKG_ROOT,
|
|
47
|
+
resolveOptionalEngineBinary,
|
|
48
|
+
hasOptionalEngine,
|
|
49
|
+
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runsec/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.70",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"bin/runsec-mcp.cjs",
|
|
8
|
-
"bin/ensure-binaries.cjs"
|
|
8
|
+
"bin/ensure-binaries.cjs",
|
|
9
|
+
"bin/engine-resolve.cjs"
|
|
9
10
|
],
|
|
10
11
|
"bin": {
|
|
11
12
|
"runsec-mcp": "bin/runsec-mcp.cjs"
|