fix(doctor): emit warning when tui.json is registered but opencode.json is not

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) <noreply@anthropic.com>
This commit is contained in:
PeterPonyu
2026-05-15 10:30:45 -04:00
parent 08959d634e
commit cc88bedd9c
2 changed files with 38 additions and 0 deletions
@@ -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"])
@@ -149,6 +149,28 @@ export async function checkTuiPluginConfig(): Promise<CheckResult> {
}
}
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",