Skip to content

Conversation

@fifthfrankie
Copy link
Contributor

Fixes #4700

  • added submit() method to allow external code to trigger submit
  • move submit function before ref assignment to avoid circular reference
  • add auto-submit logic in home component with 100ms delay

output: when --prompt is provided, it now both populates input AND auto-submits

Fixes sst#4700

- Add submit() method to PromptRef interface to expose internal submit function
- Move submit function definition before ref assignment to avoid circular reference
- Add auto-submit logic in Home component with 100ms delay after setting prompt
- When --prompt is provided, it now both populates input AND auto-submits

Changes:
- packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx: Add submit() to PromptRef and expose in ref
- packages/opencode/src/cli/cmd/tui/routes/home.tsx: Add setTimeout to auto-submit prompt after setting
@dgunay
Copy link

dgunay commented Nov 24, 2025

@fifthfrankie Thanks for getting on this so fast. I'm not familiar with the codebase; is it easy to write a regression test for this? If it regressed once, it may regress again later.

@rekram1-node
Copy link
Collaborator

it only regressed because the whole tui was rewritten I wouldn't sweat a test may be more work than it's worth

Also we don't wanna use setTimeout if we can help it

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.

opencode --prompt does not begin the session

3 participants