@kahinmcp/kahin 0.1.5 → 0.1.6
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/kahin.mjs +28 -3
- package/package.json +1 -1
package/bin/kahin.mjs
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// kahin launcher — kahin MCP server'ı
|
|
2
|
+
// kahin global launcher — kod tabanındaki kahin MCP server'ı çalıştırır.
|
|
3
3
|
// Kurulum: pnpm add -g @kahinmcp/kahin
|
|
4
4
|
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { homedir } from "node:os";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
|
|
10
|
+
const HOME = process.env.KAHIN_HOME || join(homedir(), ".local", "share", "kahin");
|
|
11
|
+
const VENV = join(HOME, "venv");
|
|
12
|
+
const PY = process.platform === "win32" ? join(VENV, "Scripts", "python.exe") : join(VENV, "bin", "python");
|
|
13
|
+
|
|
14
|
+
function sh(cmd, args, opts = {}) {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
const c = spawn(cmd, args, { stdio: ["ignore", "ignore", "pipe"], ...opts });
|
|
17
|
+
c.stderr.on("data", (d) => process.stderr.write(`[kahin] ${d}`));
|
|
18
|
+
c.on("close", (code) => resolve(code));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function setup() {
|
|
23
|
+
const python = existsSync(PY) ? PY : (process.env.KAHIN_PY || "python3");
|
|
24
|
+
const check = await sh(python, ["-c", "import kahin"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
25
|
+
if (check !== 0) {
|
|
26
|
+
process.stderr.write(`[kahin] kahin Python paketi bulunamadı. ${python} ile çalıştırılamıyor.\n`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
return python;
|
|
30
|
+
}
|
|
6
31
|
|
|
7
32
|
const args = process.argv.slice(2);
|
|
8
|
-
const
|
|
9
|
-
const child = spawn(
|
|
33
|
+
const python = await setup();
|
|
34
|
+
const child = spawn(python, ["-m", "kahin.oracle", ...args], { stdio: "inherit" });
|
|
10
35
|
child.on("exit", (code, signal) => {
|
|
11
36
|
if (signal) process.kill(process.pid, signal);
|
|
12
37
|
process.exit(code ?? 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kahinmcp/kahin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Kahin — CDP ansiklopedisi + anti-detect browser otomasyon MCP sunucusu. Obscura ve Camoufox motorlarını kullanır, motor seçimini ajana bırakır.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"kahin": "bin/kahin.mjs"
|