feat(tui): configurable custom home placeholders#25387
Closed
wyMinLwin wants to merge 1 commit intoanomalyco:devfrom
Closed
feat(tui): configurable custom home placeholders#25387wyMinLwin wants to merge 1 commit intoanomalyco:devfrom
wyMinLwin wants to merge 1 commit intoanomalyco:devfrom
Conversation
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Contributor
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Contributor
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #
Type of change
What does this PR do?
Adds a
placeholdersfield totui.jsonso users can overridethe rotating placeholder text inside the prompt input on the
home screen.
placeholders.inputreplaces the normal-mode placeholderpool.
placeholders.shellreplaces the shell-mode placeholderpool.
array, the built-in
Ask anything... "..."/Run a command... "..."framing is dropped so the strings show as-is.Without this the user's strings would still be wrapped in the
prefix, which I didn't want for my own setup.
default. Omitting
placeholdersentirely keeps the existingbehavior.
Why this works: the placeholder string is built in one place —
placeholderTextincomponent/prompt/index.tsx— whichalready reads the rotating index off
props.placeholders.normal/shell. I added two internal-onlyflags (
rawNormal,rawShell) on that same prop. When set,placeholderTextreturns the rotated item literally instead ofwrapping it in the prefix.
home.tsxis the only caller thatturns the flags on, and it does so based on whether the user
supplied an array. Existing random-pick rotation (on mount, on
session change, on entering shell mode) is preserved unchanged.
Files touched:
packages/opencode/src/cli/cmd/tui/config/tui-schema.ts—schema entry.
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx—
rawNormal/rawShellflags + branching inplaceholderText.packages/opencode/src/cli/cmd/tui/routes/home.tsx— readsuseTuiConfig().placeholdersand forwards arrays with the rawflags set.
How did you verify your code works?
Ran
bunx tsgo --noEmitinpackages/opencodeandpackages/plugin— both clean.Manually with
bun run dev:placeholdersintui.json→ home showsAsk anything... "Fix broken tests"rotation as before.placeholders.input: ["foo", "bar"]→ input rotates throughfoo/barliterally, no prefix.placeholders.shell: ["git status"]→ entering shell modewith
!showsgit statusliterally.inputleft shell on its default and viceversa.
randomly across new sessions.
Screenshots / recordings
Before:
Ask anything... "Fix broken tests"
After (
tui.json):{ "$schema": "https://opencode.ai/tui.json", "placeholders": { "input": ["whatever I want here", "another literal"], "shell": ["git command?"] } }Renders:
whatever I want here
(no Ask anything... prefix, no quotes)
Checklist