mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 15:30:43 +00:00
fix: restore ci gates on main
This commit is contained in:
@@ -203,6 +203,23 @@ describe("resolveBundledRuntimeDepsNpmRunner", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the Node-adjacent POSIX npm shim when npm-cli.js is unavailable", () => {
|
||||
const execPath = "/opt/node/bin/node";
|
||||
const npmPath = "/opt/node/bin/npm";
|
||||
const runner = resolveBundledRuntimeDepsNpmRunner({
|
||||
env: {},
|
||||
execPath,
|
||||
existsSync: (candidate) => candidate === npmPath,
|
||||
npmArgs: ["install", "acpx@0.5.3"],
|
||||
platform: "linux",
|
||||
});
|
||||
|
||||
expect(runner).toEqual({
|
||||
command: npmPath,
|
||||
args: ["install", "acpx@0.5.3"],
|
||||
});
|
||||
});
|
||||
|
||||
it("refuses Windows shell fallback when no safe npm executable is available", () => {
|
||||
expect(() =>
|
||||
resolveBundledRuntimeDepsNpmRunner({
|
||||
@@ -222,7 +239,7 @@ describe("resolveBundledRuntimeDepsNpmRunner", () => {
|
||||
PATH: "/repo/evil/bin:/usr/bin:/bin",
|
||||
},
|
||||
execPath: "/opt/node/bin/node",
|
||||
existsSync: (candidate) => candidate === "/opt/node/bin/npm",
|
||||
existsSync: (candidate) => candidate === "/usr/bin/npm",
|
||||
npmArgs: ["install"],
|
||||
platform: "linux",
|
||||
}),
|
||||
|
||||
@@ -1325,6 +1325,14 @@ export function resolveBundledRuntimeDepsNpmRunner(params: {
|
||||
throw new Error("Unable to resolve a safe npm executable on Windows");
|
||||
}
|
||||
|
||||
const npmExePath = pathImpl.resolve(nodeDir, "npm");
|
||||
if (existsSync(npmExePath)) {
|
||||
return {
|
||||
command: npmExePath,
|
||||
args: params.npmArgs,
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error("Unable to resolve a safe npm executable");
|
||||
}
|
||||
type BundledPluginRuntimeDepsManifest = {
|
||||
|
||||
@@ -45,6 +45,7 @@ function collectBundledChannelOwnerPluginIds(params: {
|
||||
config: OpenClawConfig;
|
||||
channelIds: readonly string[];
|
||||
env: NodeJS.ProcessEnv;
|
||||
bundledPluginsDir?: string;
|
||||
}): string[] {
|
||||
const plugins = normalizePluginsConfig(params.config.plugins);
|
||||
const channelIds = new Set(
|
||||
@@ -55,7 +56,7 @@ function collectBundledChannelOwnerPluginIds(params: {
|
||||
if (channelIds.size === 0) {
|
||||
return [];
|
||||
}
|
||||
const bundledDir = resolveBundledPluginsDir(params.env);
|
||||
const bundledDir = params.bundledPluginsDir ?? resolveBundledPluginsDir(params.env);
|
||||
if (!bundledDir) {
|
||||
return [];
|
||||
}
|
||||
@@ -126,6 +127,7 @@ export function resolveEffectivePluginIds(params: {
|
||||
config: OpenClawConfig;
|
||||
env: NodeJS.ProcessEnv;
|
||||
workspaceDir?: string;
|
||||
bundledPluginsDir?: string;
|
||||
}): string[] {
|
||||
const autoEnabled = applyPluginAutoEnable({
|
||||
config: params.config,
|
||||
@@ -150,6 +152,7 @@ export function resolveEffectivePluginIds(params: {
|
||||
config: effectiveConfig,
|
||||
channelIds: configuredChannelIds,
|
||||
env: params.env,
|
||||
...(params.bundledPluginsDir ? { bundledPluginsDir: params.bundledPluginsDir } : {}),
|
||||
})) {
|
||||
ids.add(pluginId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user