mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 16:30:42 +00:00
fix(cli): skip plugin preload for json agent runs
This commit is contained in:
@@ -145,6 +145,10 @@ describe("registerPreActionHooks", () => {
|
||||
program.command("onboard").action(() => {});
|
||||
const channels = program.command("channels");
|
||||
channels.command("add").action(() => {});
|
||||
channels
|
||||
.command("send")
|
||||
.option("--json")
|
||||
.action(() => {});
|
||||
program
|
||||
.command("plugins")
|
||||
.command("install")
|
||||
@@ -229,7 +233,7 @@ describe("registerPreActionHooks", () => {
|
||||
processTitleSetSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("loads plugins for local agent runs", async () => {
|
||||
it("loads plugins for text local agent runs", async () => {
|
||||
await runPreAction({
|
||||
parseArgv: ["agent"],
|
||||
processArgv: ["node", "openclaw", "agent", "--local", "--message", "hi"],
|
||||
@@ -242,6 +246,20 @@ describe("registerPreActionHooks", () => {
|
||||
expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledWith({ scope: "all" });
|
||||
});
|
||||
|
||||
it("skips broad plugin preload for json local agent runs", async () => {
|
||||
await runPreAction({
|
||||
parseArgv: ["agent"],
|
||||
processArgv: ["node", "openclaw", "agent", "--local", "--message", "hi", "--json"],
|
||||
});
|
||||
|
||||
expect(ensureConfigReadyMock).toHaveBeenCalledWith({
|
||||
runtime: runtimeMock,
|
||||
commandPath: ["agent", "hi"],
|
||||
suppressDoctorStdout: true,
|
||||
});
|
||||
expect(ensurePluginRegistryLoadedMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("keeps setup alias and channels add manifest-first", async () => {
|
||||
await runPreAction({
|
||||
parseArgv: ["onboard"],
|
||||
@@ -394,8 +412,8 @@ describe("registerPreActionHooks", () => {
|
||||
|
||||
it("routes logs to stderr in --json mode so stdout stays clean", async () => {
|
||||
await runPreAction({
|
||||
parseArgv: ["agent"],
|
||||
processArgv: ["node", "openclaw", "agent", "--message", "hi", "--json"],
|
||||
parseArgv: ["channels", "send"],
|
||||
processArgv: ["node", "openclaw", "channels", "send", "--json"],
|
||||
});
|
||||
|
||||
expect(routeLogsToStderrMock).toHaveBeenCalledOnce();
|
||||
@@ -484,8 +502,8 @@ describe("registerPreActionHooks", () => {
|
||||
});
|
||||
|
||||
await runPreAction({
|
||||
parseArgv: ["agent"],
|
||||
processArgv: ["node", "openclaw", "agent", "--local", "--message", "hi", "--json"],
|
||||
parseArgv: ["channels", "send"],
|
||||
processArgv: ["node", "openclaw", "channels", "send", "--json"],
|
||||
});
|
||||
|
||||
expect(ensurePluginRegistryLoadedMock).toHaveBeenCalled();
|
||||
|
||||
Reference in New Issue
Block a user