grok-search-rs-pc 0.2.0
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 +16 -0
- package/package.json +49 -0
- package/run.js +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# grok-search-rs-pc
|
|
2
|
+
|
|
3
|
+
personal-compat GrokSearch-rs — **no npm org required**.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx -y grok-search-rs-pc@latest
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Hermes:
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
command: npx
|
|
13
|
+
args: [-y, "grok-search-rs-pc@latest"]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Platforms: macOS (universal), Windows x64.
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "grok-search-rs-pc",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "personal-compat GrokSearch-rs (macOS + Windows x64): time inject, no double web_search tool, GROK_API_* aliases",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/ZJ-zhangcn/GrokSearch-rs.git"
|
|
11
|
+
},
|
|
12
|
+
"author": "ZJ-zhangcn",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/ZJ-zhangcn/GrokSearch-rs/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/ZJ-zhangcn/GrokSearch-rs#readme",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"mcp",
|
|
20
|
+
"grok",
|
|
21
|
+
"xai",
|
|
22
|
+
"tavily",
|
|
23
|
+
"search",
|
|
24
|
+
"rust",
|
|
25
|
+
"personal-compat"
|
|
26
|
+
],
|
|
27
|
+
"bin": {
|
|
28
|
+
"grok-search-rs": "run.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"run.js",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=14.14.0"
|
|
36
|
+
},
|
|
37
|
+
"os": [
|
|
38
|
+
"darwin",
|
|
39
|
+
"win32"
|
|
40
|
+
],
|
|
41
|
+
"cpu": [
|
|
42
|
+
"x64",
|
|
43
|
+
"arm64"
|
|
44
|
+
],
|
|
45
|
+
"optionalDependencies": {
|
|
46
|
+
"grok-search-rs-pc-darwin-universal": "0.2.0",
|
|
47
|
+
"grok-search-rs-pc-win32-x64": "0.2.0"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
|
|
7
|
+
const PACKAGE_NAME = "grok-search-rs-pc";
|
|
8
|
+
const BIN_NAME = "grok-search-rs";
|
|
9
|
+
const PLATFORMS = {
|
|
10
|
+
"darwin-x64": "grok-search-rs-pc-darwin-universal",
|
|
11
|
+
"darwin-arm64": "grok-search-rs-pc-darwin-universal",
|
|
12
|
+
"win32-x64": "grok-search-rs-pc-win32-x64",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function getBinaryPath() {
|
|
16
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
17
|
+
const pkgName = PLATFORMS[platformKey];
|
|
18
|
+
|
|
19
|
+
if (!pkgName) {
|
|
20
|
+
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
21
|
+
console.error(`Supported: ${Object.keys(PLATFORMS).join(", ")} (macOS / Windows x64)`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const pkgPath = require.resolve(`${pkgName}/package.json`);
|
|
27
|
+
const binName = process.platform === "win32" ? `${BIN_NAME}.exe` : BIN_NAME;
|
|
28
|
+
return path.join(path.dirname(pkgPath), "bin", binName);
|
|
29
|
+
} catch (_) {
|
|
30
|
+
console.error(`Failed to find platform package: ${pkgName}`);
|
|
31
|
+
console.error("Try: npm install grok-search-rs-pc");
|
|
32
|
+
console.error(`Or: npm install ${pkgName}`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function run() {
|
|
38
|
+
const binaryPath = getBinaryPath();
|
|
39
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
40
|
+
stdio: "inherit",
|
|
41
|
+
env: process.env,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
45
|
+
process.on(signal, () => {
|
|
46
|
+
if (!child.killed) child.kill(signal);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
child.on("error", (err) => {
|
|
51
|
+
console.error(`Failed to start ${BIN_NAME}: ${err.message}`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
child.on("exit", (code, signal) => {
|
|
56
|
+
if (signal) process.exit(128 + (os.constants.signals[signal] || 0));
|
|
57
|
+
process.exit(code ?? 0);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
run();
|