Repository navigation
feat(tui): add logo setting to hide or replace the home logo - #65358
martinwangjian wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
The setting works as described. I checked it by running the TUI from source on the base and on this branch with a custom logo in cli.json (screenshots below). The new tests pass here and fail on the base, and type-checking finds no new errors.
Public API: adds an optional logo key to cli.json (false or string[]) and a row in the settings docs. This is backwards compatible: existing configs don't change.
Concerns (details are in the inline comments):
<Logo />is also rendered by/stats, so the setting replaces or hides the logo there too, not only on the home screen. The docs only mention the home screen, so either document this or limit the setting to home.- With
"logo": false, the home screen measures the logo's width as 0. The update notification uses that width, so it would likely disappear for users who hide the logo. - Custom lines go through the same renderer as the built-in logo, so
_ , ^ ~are always drawn as shaded blocks. A plain-text logo such asacme_codeorHello, worldwould come out garbled. - Design: in #51916 the plugin-slot approach was the one suggested to maintainers. Whether a config setting is also wanted is up to them.
…t fit Address review: custom lines no longer get the built-in shading marks, a custom logo wider than the terminal is hidden like the built-in one falls back, the update notice keeps its width when the logo is hidden, and the docs say the setting also applies to /stats.
There was a problem hiding this comment.
All four points from my last review are fixed in abcecc0:
- Custom lines render as plain text, so
_ , ^ ~show as typed. - A custom logo that is wider than the terminal is hidden. Width is measured with
stringWidth, so wide characters count properly. - With
"logo": false, the update notice sizes to its own text instead of getting a zero width. - The docs and schema now say the setting also applies to
/stats.
I checked it with the 5 tests in logo-config.test.tsx (all pass), a type check (no new errors compared with the base), and by running the TUI on this branch with a custom logo (screenshots below). I didn't open /stats or see the update notice with the logo hidden; for those two I read the code.
Public API: adds an optional logo key to cli.json (false or an array of lines). This is backwards compatible.
I have no remaining code concerns. The one open question is for maintainers: whether they want this config setting as well as, or instead of, the plugin slot discussed in #51916.
|
On the open question: either works for us, and they compose. The setting covers the simple case without code, and the |



Issue for this PR
Part of #51916 (the setting option; #65354 is the slot option) and #54947 (the logo part only). Covers what #12016 asked for (a
logosetting). Removes the logo from the source patches described in #55986. Complements #65354, which adds ahome.logoplugin slot. The two PRs don't touch the same lines and work together: the setting changes the default logo, a plugin can still replace it.Type of change
What does this PR do?
Adds a
logosetting tocli.jsonso the logo (home screen and/stats) can be changed without writing a plugin:"logo": falsehides it"logo": ["line 1", "line 2"]replaces it with these lines, rendered as plain text. Like the built-in logo, it's hidden when it doesn't fit: when its widest line is wider than the terminal, or the terminal is shorter than 12 rows.It's a schema field in
packages/tui/src/configand a branch incomponent/logo.tsx, plus a row and an example incli/config.mdx. We ship OpenCode with our own branding, and a config value is easier to manage centrally than a plugin.How did you verify your code works?
test/logo-config.test.tsx: custom lines replace the logo,falsehides it, the default logo shows without the setting, text with_ , ^ ~renders as typed, and a logo wider than the terminal is hidden. Each fails without the matchinglogo.tsxchange.bun run typecheck,oxlintand the pre-push hook pass.packages/cliconfig tests pass. The fullpackages/tuisuite has the same 3 failures asdevon my machine (shell output timeouts and a colour test).Screenshots / recordings
Captured from the test fixture with
"logo": ["▄▀█ █▀▀ █▀▄▀█ █▀▀", "█▀█ █▄▄ █ ▀ █ ██▄"]:Checklist
Added by the opencode bot (AI-generated).
Fixes #51916
Related: #54947, #39368
Public API: adds the optional
logosetting to cli.json (falseor an array of lines) (backwards compatible)