ralph-hero-mcp-server 2.5.72 → 2.5.73
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/dist/index.js +14 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* plugin's bundled MCP server.
|
|
8
8
|
*/
|
|
9
9
|
import { execSync } from "node:child_process";
|
|
10
|
+
import { realpathSync } from "node:fs";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
10
12
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
13
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
12
14
|
import { createGitHubClient } from "./github-client.js";
|
|
@@ -406,18 +408,22 @@ async function main() {
|
|
|
406
408
|
console.error("[ralph-hero] MCP server connected and ready.");
|
|
407
409
|
}
|
|
408
410
|
// Run only when invoked as the entry point (not when imported by tests).
|
|
409
|
-
// `process.argv[1]` is the script path Node was started with
|
|
410
|
-
//
|
|
411
|
-
//
|
|
411
|
+
// `process.argv[1]` is the script path Node was started with. When npm/npx
|
|
412
|
+
// invokes a `bin` script it sets argv[1] to the bin-shim symlink (e.g.
|
|
413
|
+
// `node_modules/.bin/ralph-hero-mcp-server`), not the resolved target — so
|
|
414
|
+
// a string-suffix match on `/dist/index.js` would miss the bin-shim case
|
|
415
|
+
// and silently skip main(). Compare realpath(argv[1]) to this module's
|
|
416
|
+
// own URL instead; that's the canonical ESM "am I the entry point?" check.
|
|
412
417
|
const isEntryPoint = (() => {
|
|
413
418
|
try {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
419
|
+
if (!process.argv[1])
|
|
420
|
+
return process.env.RALPH_HERO_RUN_MAIN === "true";
|
|
421
|
+
const argvReal = realpathSync(process.argv[1]);
|
|
422
|
+
const moduleReal = fileURLToPath(import.meta.url);
|
|
423
|
+
return argvReal === moduleReal || process.env.RALPH_HERO_RUN_MAIN === "true";
|
|
418
424
|
}
|
|
419
425
|
catch {
|
|
420
|
-
return
|
|
426
|
+
return process.env.RALPH_HERO_RUN_MAIN === "true";
|
|
421
427
|
}
|
|
422
428
|
})();
|
|
423
429
|
if (isEntryPoint) {
|