Skip to content

doctor: stop planning a TUI config entry on OpenCode 2 - #368

Merged
ualtinok merged 1 commit into
cortexkit:mainfrom
coleleavitt:fix/doctor-v2-tui-plan
Sep 27, 2026
Merged

ualtinok merged 1 commit into
cortexkit:mainfrom
coleleavitt:fix/doctor-v2-tui-plan

Conversation

@coleleavitt

@coleleavitt coleleavitt commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue

Approved issue: #367

What changes

  • HarnessAdapter gains an optional tuiPluginEntryApplies(). OpenCode answers configGeneration() !== "v2"; adapters that don't implement it keep today's behaviour.
  • buildDoctorFixPlan skips the "(TUI sidebar)" item when it returns false, and the --fix apply loop skips calling ensureTuiPluginEntry for the same case, so the plan and the applied changes agree.
  • hasTuiPluginEntry() is untouched, so diagnostics still report what the file contains.

How it was checked

  • bun test in packages/aft-cli: 360 pass.
  • New tests: the plan has no TUI item when the adapter says it doesn't apply, still has it when it applies or doesn't say (doctor.test.ts); OpenCodeAdapter.tuiPluginEntryApplies() is true for V1 and false for V2 (opencode-generation-config.test.ts). The V2 plan test fails without the doctor.ts change.
  • tsc --noEmit and biome check packages/aft-cli/src clean.
  • By hand: on OpenCode 2.0.18, doctor --fix previously listed "Will add … to tui.json (TUI sidebar)"; with this change that line is gone.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Stops doctor from planning a TUI sidebar entry on OpenCode 2, where the plugin is loaded from the package's own entrypoint and no tui.json is read, so the plan no longer offers a repair that writes nothing (issue #367).

  • HarnessAdapter gains an optional tuiPluginEntryApplies(); OpenCode returns configGeneration() !== "v2", and adapters that don't implement it keep today's behavior.
  • buildDoctorFixPlan and the --fix apply loop skip the TUI entry when it returns false, so the plan and applied changes agree.
  • hasTuiPluginEntry() is untouched, so diagnostics still report what the file contains.

Written for commit 5d4cd1a. Summary will update on new commits.

Review in cubic

OpenCode 2 loads the TUI plugin from the package's own entrypoint and reads
no tui.json, and ensureTuiPluginEntry already writes nothing there. The fix
plan still listed "Will add ... to tui.json (TUI sidebar)" because it gated
on hasTuiPluginEntry(), which is always false on V2. Let the adapter say
whether a TUI config entry applies, and skip the plan item and the apply step
when it does not.
@cortexkit-ci

cortexkit-ci Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

#367 has the design-approved label; this PR can be reviewed.

@ualtinok
ualtinok merged commit 60f9ea4 into cortexkit:main Sep 27, 2026
37 of 40 checks passed
@aft-alfonso

aft-alfonso Bot commented Sep 27, 2026

Copy link
Copy Markdown

Merged, thanks @coleleavitt. doctor --fix on OpenCode 2 no longer lists a tui.json change. It ships in the next release, where the release notes credit you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants