fix(plugins): separate source and package launcher modules

This commit is contained in:
morluto
2026-10-14 01:34:42 +08:00
parent a85bfed8dc
commit 9de80b4deb
3 changed files with 16 additions and 6 deletions
-2
View File
@@ -63,8 +63,6 @@
"bridge/mitmproxy/capture.py",
"scripts/rea.mjs",
"scripts/plugin-mcp-launcher.mjs",
"src/application/PackageRunnerCommand.mjs",
"src/application/PackageRunnerCommand.d.mts",
"scripts/rea-android-workspace-guardian.mjs",
"scripts/electron-active-hook.cjs",
"scripts/electron-active-hook-boundaries.cjs",
+16 -2
View File
@@ -7,8 +7,6 @@ import { constants, tmpdir } from "node:os";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { packageRunnerCommand } from "../src/application/PackageRunnerCommand.mjs";
// Keep the package name at the launcher boundary so release automation updates
// only a scalar version in plugin JSON, never a compound package specifier.
// No build, dependency installation or ambient latest-version lookup is needed
@@ -53,6 +51,12 @@ async function launch(packageSpecifier) {
return;
}
const runnerModule = await import(
(await isGitSourceCheckout())
? "../src/application/PackageRunnerCommand.mjs"
: "../dist/application/PackageRunnerCommand.mjs",
);
const { packageRunnerCommand } = runnerModule;
const [command, ...args] = packageRunnerCommand(
"npx",
packageSpecifier,
@@ -137,6 +141,16 @@ async function launch(packageSpecifier) {
});
}
async function isGitSourceCheckout() {
try {
await access(new URL("../.git", import.meta.url));
return true;
} catch (cause) {
if (isMissing(cause)) return false;
throw cause;
}
}
async function launchWindowsFallback(command, args, workingDirectory) {
let spawnOwnedProviderProcess;
try {
-2
View File
@@ -100,8 +100,6 @@ export async function verifyPackagePack({ root, workspace }) {
throw new Error("Packaged Codex MCP server declaration is missing");
for (const path of [
"scripts/plugin-mcp-launcher.mjs",
"src/application/PackageRunnerCommand.mjs",
"src/application/PackageRunnerCommand.d.mts",
"dist/application/PackageRunnerCommand.mjs",
])
if (!packedFiles.includes(`package/${path}`))