From cc88bedd9c78942c8d6caa3f626a634b459f6e69 Mon Sep 17 00:00:00 2001 From: PeterPonyu Date: Fri, 15 May 2026 10:30:45 -0400 Subject: [PATCH] fix(doctor): emit warning when tui.json is registered but opencode.json is not MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the tui-plugin-config check returned PASS when the server plugin (oh-my-openagent in opencode.json) was missing but the TUI plugin entry was present in tui.json. The plugin can't function with only half of the registration — the server side handles tool dispatch, hook execution, and SDK integration; the TUI side only ships the sidebar. Now we emit a clear warning with the fix suggestion. Addresses cubic-dev-ai's review on PR #4048 (severity 3/10). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../doctor/checks/tui-plugin-config.test.ts | 16 ++++++++++++++ src/cli/doctor/checks/tui-plugin-config.ts | 22 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/cli/doctor/checks/tui-plugin-config.test.ts b/src/cli/doctor/checks/tui-plugin-config.test.ts index 2211c6440..86f47def5 100644 --- a/src/cli/doctor/checks/tui-plugin-config.test.ts +++ b/src/cli/doctor/checks/tui-plugin-config.test.ts @@ -114,6 +114,22 @@ describe("tui-plugin-config check", () => { expect(result.issues).toHaveLength(0) }) + it("warns when tui.json has our entry but server plugin is missing from opencode.json", async () => { + //#given tui.json has the TUI entry but opencode.json does not have the server entry + writeOpenCodeConfig(["some-other-plugin"]) + writeTuiConfig([`${PLUGIN_NAME}/tui`]) + + //#when running the check + const result = await checkTuiPluginConfig() + + //#then status is warn — TUI-only registration can't function without the server side + expect(result.status).toBe("warn") + expect(result.issues).toHaveLength(1) + expect(result.issues[0].severity).toBe("warning") + expect(result.issues[0].title).toContain("Server plugin entry missing") + expect(result.issues[0].fix).toBeDefined() + }) + it("skips when neither config registers the plugin", async () => { //#given an opencode.json and tui.json with no oh-my-openagent entries writeOpenCodeConfig(["some-other-plugin"]) diff --git a/src/cli/doctor/checks/tui-plugin-config.ts b/src/cli/doctor/checks/tui-plugin-config.ts index 83eb84a59..8fe07024e 100644 --- a/src/cli/doctor/checks/tui-plugin-config.ts +++ b/src/cli/doctor/checks/tui-plugin-config.ts @@ -149,6 +149,28 @@ export async function checkTuiPluginConfig(): Promise { } } + if (!server.registered && tui.registered) { + issues.push({ + title: "Server plugin entry missing from opencode.json", + description: + `The TUI plugin entry ("${PLUGIN_NAME}/${TUI_SUBPATH}") is registered in tui.json, ` + + "but the server plugin (oh-my-openagent) is missing from opencode.json. " + + "The plugin cannot function correctly without both halves — the server side " + + "handles tool dispatch, hook execution, and SDK integration.", + fix: "Re-run the installer (`npx oh-my-openagent install`) to auto-write opencode.json, " + + `or add "${PLUGIN_NAME}" to the "plugin" array in ${server.configPath ?? "opencode.json"}.`, + affects: ["tool dispatch", "hook execution", "SDK integration"], + severity: "warning", + }) + return { + name, + status: "warn", + message: "Server plugin entry missing from opencode.json", + details: details.length > 0 ? details : undefined, + issues, + } + } + return { name, status: "pass",