@kelceyp/swic 0.2.9 → 0.2.10

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.
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "child_process";
3
+ import { fileURLToPath } from "url";
4
+ import { dirname, resolve } from "path";
5
+ import { existsSync } from "fs";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ // package root when this file is installed at <pkg>/bin/swic-mcp.js
11
+ const pkgRoot = resolve(__dirname, "..");
12
+ const serverJs = resolve(pkgRoot, "dist/server/Server.js");
13
+
14
+ if (!existsSync(serverJs)) {
15
+ console.error(`[swic-mcp] server bundle not found at ${serverJs}`);
16
+ console.error(`[swic-mcp] Did you run the build? Expecting dist/server/Server.js in the published package.`);
17
+ process.exit(1);
18
+ }
19
+
20
+ // allow overriding bun path if needed (e.g. CLAUDE env)
21
+ const bunBin =
22
+ process.env.BUN_BIN ||
23
+ process.env.BUN ||
24
+ process.env.BUN_PATH ||
25
+ "bun";
26
+
27
+ const child = spawn(bunBin, [serverJs, ...process.argv.slice(2)], {
28
+ stdio: "inherit",
29
+ });
30
+
31
+ child.on("exit", (code, signal) => {
32
+ if (signal) process.kill(process.pid, signal);
33
+ else process.exit(code ?? 1);
34
+ });
35
+
36
+ child.on("error", (err) => {
37
+ console.error("[swic-mcp] failed to spawn bun:", err);
38
+ process.exit(1);
39
+ });