Repository navigation
feat(tui): add custom statusline command - #52764
Closed
rudolf-blue wants to merge 2 commits into
Closed
rudolf-blue wants to merge 2 commits into
rudolf-blue wants to merge 2 commits into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
3 of 6 tasks
1 task done
Contributor
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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 #37464
Type of change
What does this PR do?
Adds a
statuslineoption to the TUI config. It takes a shell command; the TUI pipes session state to it as JSON on stdin and shows the first line of stdout in the prompt footer.{ "statusline": { "command": "~/.config/opencode/statusline.sh", "interval": 60 } }It is a built-in TUI plugin that appends to the existing
prompt.footer.statusslot, so there is no new footer system. The command reruns when the payload changes (debounced 300ms) and, ifintervalis set, every that many seconds. A run still in flight is killed when a newer one starts, and each run times out after 5s. ANSI codes are stripped.The stdin payload uses Claude Code's statusLine field names so scripts written for it work as they are. Filled in:
session_id,cwd,version,model.id,model.display_name,workspace.current_dir,workspace.project_dir,cost.total_cost_usd, andcontext_window.{context_window_size,used_percentage,remaining_percentage,current_usage}. Anything opencode has no value for is left out.The config key is
statusline.command/intervalinstead of the issue'sstatusLine/refreshSeconds, to match the other keys in this config. Happy to rename.I did not touch the docs.
tui.mdxstill describes the v1 config, so I was not sure where this belongs.How did you verify your code works?
test/feature-plugins/prompt-statusline.test.tsx: the payload shape, a session ID that does not exist yet, stdin piping and first-line/ANSI handling against real commands, abort, and a full app fixture run that checks the output lands in the footer.bun run testandbun typecheckinpackages/tuipass (1441 pass, 0 fail).Screenshots / recordings
From the app fixture, with a command that prints the model name in brackets:
Checklist