refactor: switch browser ownership to bundled plugin

This commit is contained in:
Peter Steinberger
2026-03-26 22:18:41 +00:00
parent 197510f693
commit 8eeb7f0829
255 changed files with 16981 additions and 21074 deletions

View File

@@ -0,0 +1,50 @@
import { Command } from "commander";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { registerPluginCliCommands } from "./cli.js";
import { clearPluginLoaderCache } from "./loader.js";
import { clearPluginManifestRegistryCache } from "./manifest-registry.js";
import { resetPluginRuntimeStateForTest } from "./runtime.js";
function resetPluginState() {
clearPluginLoaderCache();
clearPluginManifestRegistryCache();
resetPluginRuntimeStateForTest();
}
describe("registerPluginCliCommands browser plugin integration", () => {
beforeEach(() => {
resetPluginState();
});
afterEach(() => {
resetPluginState();
});
it("registers the browser command from the bundled browser plugin", () => {
const program = new Command();
registerPluginCliCommands(program, {
plugins: {
allow: ["browser"],
},
} as OpenClawConfig);
expect(program.commands.map((command) => command.name())).toContain("browser");
});
it("omits the browser command when the bundled browser plugin is disabled", () => {
const program = new Command();
registerPluginCliCommands(program, {
plugins: {
allow: ["browser"],
entries: {
browser: {
enabled: false,
},
},
},
} as OpenClawConfig);
expect(program.commands.map((command) => command.name())).not.toContain("browser");
});
});