From 48247f280be2f4e9ce0b47d32e9d67a4b1deb5a6 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Mon, 31 Aug 2026 09:16:43 -0700 Subject: [PATCH 1/2] Project effective plugin enablement in the Plugins surface --- src/tui/plugin-surface.test.ts | 33 +++++++++++++++++++++++++++++++++ src/tui/plugin-surface.ts | 10 ++++++++++ src/tui/runner.ts | 3 ++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/tui/plugin-surface.test.ts create mode 100644 src/tui/plugin-surface.ts diff --git a/src/tui/plugin-surface.test.ts b/src/tui/plugin-surface.test.ts new file mode 100644 index 00000000..bbae65ea --- /dev/null +++ b/src/tui/plugin-surface.test.ts @@ -0,0 +1,33 @@ +import { describe, expect, test } from "bun:test"; + +import type { PluginModule } from "../plugins/loader.js"; +import { isPluginEnabledForSurface } from "./plugin-surface.js"; + +const bundledSkills: PluginModule = { + origin: "repo", + manifest: { + id: "corbits-skills", + name: "Corbits Skills", + kind: "command", + defaultEnabled: true, + }, +}; + +describe("isPluginEnabledForSurface", () => { + test("projects a bundled default-on plugin as enabled without settings", () => { + expect(isPluginEnabledForSurface(bundledSkills, {})).toBe(true); + }); + + test("projects explicit disabled and enabled settings", () => { + expect( + isPluginEnabledForSurface(bundledSkills, { + "corbits-skills": { enabled: false }, + }), + ).toBe(false); + expect( + isPluginEnabledForSurface(bundledSkills, { + "corbits-skills": { enabled: true }, + }), + ).toBe(true); + }); +}); diff --git a/src/tui/plugin-surface.ts b/src/tui/plugin-surface.ts new file mode 100644 index 00000000..9d5c82a9 --- /dev/null +++ b/src/tui/plugin-surface.ts @@ -0,0 +1,10 @@ +import type { PluginConfig } from "../config/settings.js"; +import type { PluginModule } from "../plugins/loader.js"; +import { isPluginModuleEnabled } from "../plugins/register.js"; + +export function isPluginEnabledForSurface( + plugin: PluginModule | undefined, + config: Record, +): boolean { + return plugin !== undefined && isPluginModuleEnabled(plugin, config); +} diff --git a/src/tui/runner.ts b/src/tui/runner.ts index 82ac5ae5..409b32b7 100644 --- a/src/tui/runner.ts +++ b/src/tui/runner.ts @@ -120,6 +120,7 @@ import { TELEMETRY_NOTICE } from "../telemetry/index.js"; import { captureSlashCommand } from "../telemetry/product-events.js"; import { getTelemetry, liveTelemetry } from "../telemetry/singleton.js"; import { createTelemetryToggleHandler } from "../telemetry/toggle.js"; +import { isPluginEnabledForSurface } from "./plugin-surface.js"; import { loadStartupChangelogMarkdown, stampVersionAfterStartup } from "../changelog/index.js"; import { scheduleUpgradeNotice } from "../upgrade/index.js"; @@ -2511,7 +2512,7 @@ export async function runTUI(initialConfig: Config): Promise { return { id: p.id, name: p.name, - enabled: cfg[p.id]?.enabled === true, + enabled: isPluginEnabledForSurface(mod, cfg), credentials: p.credentials, credentialValues: cfg[p.id]?.credentials ?? {}, ...(p.kind !== undefined ? { kind: p.kind } : {}), From 689249f6a38820ecb8ff76588db8b081f250b86e Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Mon, 31 Aug 2026 19:00:51 -0700 Subject: [PATCH 2/2] Cover unknown plugin modules as disabled on the Plugins surface --- src/tui/plugin-surface.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tui/plugin-surface.test.ts b/src/tui/plugin-surface.test.ts index bbae65ea..c818f56b 100644 --- a/src/tui/plugin-surface.test.ts +++ b/src/tui/plugin-surface.test.ts @@ -14,6 +14,10 @@ const bundledSkills: PluginModule = { }; describe("isPluginEnabledForSurface", () => { + test("projects an unknown plugin as disabled", () => { + expect(isPluginEnabledForSurface(undefined, {})).toBe(false); + }); + test("projects a bundled default-on plugin as enabled without settings", () => { expect(isPluginEnabledForSurface(bundledSkills, {})).toBe(true); });