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.
Files changed (2) hide show
  1. package/dist/index.js +14 -8
  2. 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; if it ends with
410
- // this module's compiled filename, we're the entry point. The fallback covers
411
- // edge cases (e.g. argv[1] missing) by also accepting an environment opt-in.
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
- const argv1 = process.argv[1] ?? "";
415
- return (argv1.endsWith("/dist/index.js") ||
416
- argv1.endsWith("\\dist\\index.js") ||
417
- process.env.RALPH_HERO_RUN_MAIN === "true");
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 false;
426
+ return process.env.RALPH_HERO_RUN_MAIN === "true";
421
427
  }
422
428
  })();
423
429
  if (isEntryPoint) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ralph-hero-mcp-server",
3
- "version": "2.5.72",
3
+ "version": "2.5.73",
4
4
  "description": "MCP server for GitHub Projects V2 - Ralph workflow automation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",