mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
fix(cli): validate plugin drift update target
This commit is contained in:
@@ -373,4 +373,17 @@ describe("resolvePluginVersionDriftUpdateCommand", () => {
|
||||
}),
|
||||
).toBe("openclaw plugins update brave");
|
||||
});
|
||||
|
||||
it("keeps plugin-id updates when the gateway version is not a registry version", () => {
|
||||
expect(
|
||||
resolvePluginVersionDriftUpdateCommand({
|
||||
pluginId: "brave",
|
||||
installedVersion: "2026.6.9",
|
||||
gatewayVersion: "unknown",
|
||||
source: "npm",
|
||||
packageName: "@openclaw/brave-plugin",
|
||||
spec: "@openclaw/brave-plugin@2026.6.9",
|
||||
}),
|
||||
).toBe("openclaw plugins update brave");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,7 +38,10 @@ function resolveExactNpmPinPackageName(entry: PluginVersionDriftEntry): string |
|
||||
export function resolvePluginVersionDriftUpdateCommand(entry: PluginVersionDriftEntry): string {
|
||||
const exactNpmPackageName = resolveExactNpmPinPackageName(entry);
|
||||
if (exactNpmPackageName) {
|
||||
return `openclaw plugins update ${exactNpmPackageName}@${entry.gatewayVersion}`;
|
||||
const exactNpmTarget = `${exactNpmPackageName}@${entry.gatewayVersion}`;
|
||||
if (parseRegistryNpmSpec(exactNpmTarget)?.selectorKind === "exact-version") {
|
||||
return `openclaw plugins update ${exactNpmTarget}`;
|
||||
}
|
||||
}
|
||||
return `openclaw plugins update ${entry.pluginId}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user