fix(setup): register explicit MCP runtimes and preserve launcher identity

This commit is contained in:
morluto
2026-10-26 02:31:41 +08:00
parent b8ce3c74cd
commit d69a54d592
19 changed files with 637 additions and 100 deletions
+10 -2
View File
@@ -1,13 +1,21 @@
import { resolve } from "node:path";
import {
javaScriptRuntime,
type JavaScriptRuntime,
} from "../domain/runtimeVersion.js";
import { absoluteCallerPath } from "../filesystem/callerPath.js";
/** Node's absolute argv script selection, or undefined when none was supplied.
/** Runtime-specific absolute argv script selection, or undefined when none was supplied.
* Native executable paths have different traversal semantics and must not use this.
*/
export const normalizeEntrypointPath = (
entrypoint: string | undefined,
runtime: JavaScriptRuntime["id"] = javaScriptRuntime(process.versions).id,
): string | undefined =>
entrypoint === undefined || entrypoint.length === 0
? undefined
: resolve(entrypoint);
: runtime === "bun"
? absoluteCallerPath(entrypoint)
: resolve(entrypoint);
export const CURRENT_ENTRYPOINT_PATH = normalizeEntrypointPath(process.argv[1]);