fix(cli): derive drift command from exact npm spec

This commit is contained in:
luyifan
2026-06-21 19:32:23 +08:00
committed by Vincent Koc
parent dc0e91df36
commit a45544acf8
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -348,6 +348,19 @@ describe("resolvePluginVersionDriftUpdateCommand", () => {
).toBe("openclaw plugins update @openclaw/brave-plugin@2026.6.10-beta.1");
});
it("prefers the parsed exact npm spec package over inconsistent drift metadata", () => {
expect(
resolvePluginVersionDriftUpdateCommand({
pluginId: "brave",
installedVersion: "2026.6.9",
gatewayVersion: "2026.6.10-beta.1",
source: "npm",
packageName: "@openclaw/other-plugin",
spec: "@openclaw/brave-plugin@2026.6.9",
}),
).toBe("openclaw plugins update @openclaw/brave-plugin@2026.6.10-beta.1");
});
it("keeps plugin-id updates for floating npm install records", () => {
expect(
resolvePluginVersionDriftUpdateCommand({
+1 -1
View File
@@ -31,7 +31,7 @@ function resolveExactNpmPinPackageName(entry: PluginVersionDriftEntry): string |
if (parsed?.selectorKind !== "exact-version") {
return undefined;
}
return entry.packageName ?? parsed.name;
return parsed.name;
}
/** Exact npm pins need a package@version target; id-only updates preserve the old pin. */