Skip to content

Commit 4154129

Browse files
committed
fix(cli): sync official plugins during update all
1 parent 22ddf87 commit 4154129

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/cli/plugins-cli.update.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,30 @@ describe("plugins cli update", () => {
978978
const updateParams = expectSingleCallParams(updateNpmInstalledPlugins);
979979
expect(updateParams.pluginIds).toEqual(["codex"]);
980980
expect(updateParams.syncOfficialPluginInstalls).toBeUndefined();
981+
expect(updateParams.updateChannel).toBeUndefined();
982+
});
983+
984+
it("syncs official catalog specs with beta channel context for update --all", async () => {
985+
const config = createTrackedPluginConfig({
986+
pluginId: "codex",
987+
spec: "@openclaw/[email protected]",
988+
resolvedName: "@openclaw/codex",
989+
});
990+
config.update = { channel: "beta" };
991+
loadConfig.mockReturnValue(config);
992+
setInstalledPluginIndexInstallRecords(config.plugins?.installs ?? {});
993+
updateNpmInstalledPlugins.mockResolvedValue({
994+
config,
995+
changed: false,
996+
outcomes: [],
997+
});
998+
999+
await runPluginsCommand(["plugins", "update", "--all"]);
1000+
1001+
const updateParams = expectSingleCallParams(updateNpmInstalledPlugins);
1002+
expect(updateParams.pluginIds).toEqual(["codex"]);
1003+
expect(updateParams.syncOfficialPluginInstalls).toBe(true);
1004+
expect(updateParams.updateChannel).toBe("beta");
9811005
});
9821006

9831007
it("writes updated config when updater reports changes", async () => {

src/cli/plugins-update-command.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { extractShippedPluginInstallConfigRecords } from "../config/plugin-insta
1212
import type { OpenClawConfig } from "../config/types.openclaw.js";
1313
import type { PluginInstallRecord } from "../config/types.plugins.js";
1414
import { updateNpmInstalledHookPacks } from "../hooks/update.js";
15+
import { normalizeUpdateChannel } from "../infra/update-channels.js";
1516
import {
1617
loadInstalledPluginIndexInstallRecords,
1718
withoutPluginInstallRecords,
@@ -260,6 +261,10 @@ export async function runPluginUpdateCommand(params: {
260261
pluginIds: pluginSelection.pluginIds,
261262
specOverrides: pluginSelection.specOverrides,
262263
dryRun: params.opts.dryRun,
264+
updateChannel: params.opts.all
265+
? (normalizeUpdateChannel(cfg.update?.channel) ?? undefined)
266+
: undefined,
267+
syncOfficialPluginInstalls: params.opts.all ? true : undefined,
263268
dangerouslyForceUnsafeInstall: params.opts.dangerouslyForceUnsafeInstall,
264269
logger,
265270
onIntegrityDrift: async (drift) => {

0 commit comments

Comments
 (0)