opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Add a TUI flag/endpoint that auto-submits the initial prompt

Open 2mawi2 opened this issue 2 months ago • 0 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

We’re integrating the OpenCode TUI inside our own IDE-style workspace. When a user clicks “start OpenCode,” we launch the CLI in a terminal pane and feed it an initial task so it can begin coding immediately. Other agent CLIs let us do this by piping stdin or using a flag that both injects and submits the first prompt. OpenCode’s --prompt/-p flag only pre-fills the textbox, so the text just sits there until someone manually presses Enter. To work around that, we currently simulate bracketed paste + Enter from outside the process, but that’s brittle and timing-sensitive.

Could you provide a supported way to auto-submit the initial prompt when launching the TUI (e.g., opencode --prompt "…" --auto-submit, or a documented /tui/submit-prompt hook we can call immediately)? That would let IDE integrations start OpenCode sessions deterministically without faking user keystrokes.

2mawi2 avatar Nov 05 '25 11:11 2mawi2