From c1b21a2a3a177d37bcd2c9122bbcaed1d3c4e93d Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Wed, 22 Apr 2026 10:16:04 +0530 Subject: [PATCH] fix(cli): skip configure preaction bootstrap --- src/cli/command-catalog.ts | 2 +- src/cli/command-path-policy.test.ts | 7 +++++++ src/cli/program/preaction.test.ts | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/cli/command-catalog.ts b/src/cli/command-catalog.ts index 521e7922ab3..21820438302 100644 --- a/src/cli/command-catalog.ts +++ b/src/cli/command-catalog.ts @@ -37,7 +37,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [ { commandPath: ["channels"], policy: { loadPlugins: "always" } }, { commandPath: ["directory"], policy: { loadPlugins: "always" } }, { commandPath: ["agents"], policy: { loadPlugins: "always" } }, - { commandPath: ["configure"], policy: { loadPlugins: "always" } }, + { commandPath: ["configure"], policy: { bypassConfigGuard: true, loadPlugins: "never" } }, { commandPath: ["status"], policy: { diff --git a/src/cli/command-path-policy.test.ts b/src/cli/command-path-policy.test.ts index a8019f2ca4f..484c14a4533 100644 --- a/src/cli/command-path-policy.test.ts +++ b/src/cli/command-path-policy.test.ts @@ -44,6 +44,13 @@ describe("command-path-policy", () => { }); it("resolves mixed startup-only rules", () => { + expect(resolveCliCommandPathPolicy(["configure"])).toEqual({ + bypassConfigGuard: true, + routeConfigGuard: "never", + loadPlugins: "never", + hideBanner: false, + ensureCliPath: true, + }); expect(resolveCliCommandPathPolicy(["config", "validate"])).toEqual({ bypassConfigGuard: true, routeConfigGuard: "never", diff --git a/src/cli/program/preaction.test.ts b/src/cli/program/preaction.test.ts index 5c85fd32c5c..49342b01ab9 100644 --- a/src/cli/program/preaction.test.ts +++ b/src/cli/program/preaction.test.ts @@ -266,6 +266,16 @@ describe("registerPreActionHooks", () => { expect(ensurePluginRegistryLoadedMock).not.toHaveBeenCalled(); }); + it("lets configure own config validation and plugin loading", async () => { + await runPreAction({ + parseArgv: ["configure"], + processArgv: ["node", "openclaw", "configure"], + }); + + expect(ensureConfigReadyMock).not.toHaveBeenCalled(); + expect(ensurePluginRegistryLoadedMock).not.toHaveBeenCalled(); + }); + it("only allows invalid config for explicit Matrix reinstall requests", async () => { await runPreAction({ parseArgv: ["plugins", "install", "@openclaw/matrix"],