Skip to content

Commit 623e3df

Browse files
committed
fix(cli): derive drift command from exact npm spec
1 parent 031b454 commit 623e3df

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/plugins/plugin-version-drift.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,19 @@ describe("resolvePluginVersionDriftUpdateCommand", () => {
348348
).toBe("openclaw plugins update @openclaw/[email protected]");
349349
});
350350

351+
it("prefers the parsed exact npm spec package over inconsistent drift metadata", () => {
352+
expect(
353+
resolvePluginVersionDriftUpdateCommand({
354+
pluginId: "brave",
355+
installedVersion: "2026.6.9",
356+
gatewayVersion: "2026.6.10-beta.1",
357+
source: "npm",
358+
packageName: "@openclaw/other-plugin",
359+
spec: "@openclaw/[email protected]",
360+
}),
361+
).toBe("openclaw plugins update @openclaw/[email protected]");
362+
});
363+
351364
it("keeps plugin-id updates for floating npm install records", () => {
352365
expect(
353366
resolvePluginVersionDriftUpdateCommand({

src/plugins/plugin-version-drift.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function resolveExactNpmPinPackageName(entry: PluginVersionDriftEntry): string |
3131
if (parsed?.selectorKind !== "exact-version") {
3232
return undefined;
3333
}
34-
return entry.packageName ?? parsed.name;
34+
return parsed.name;
3535
}
3636

3737
/** Exact npm pins need a package@version target; id-only updates preserve the old pin. */

0 commit comments

Comments
 (0)