[PR #8696] feat: add interactive mode support for bash commands #12833

Closed
opened 2026-02-16 18:17:43 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8696

State: closed
Merged: No


Fixes #1180

Summary

Adds support for interactive bash commands (like opencode auth login, vim, ssh) by using the existing PTY infrastructure when interactive: true is set.

Changes

  • Added interactive parameter to bash tool with allowlist of supported commands
  • Created BashInteractive TUI component that connects to PTY via WebSocket
  • Falls back to regular spawn if PTY fails or command not in allowlist
  • ESC key exits interactive mode

How it works

When interactive: true and command is in allowlist → creates PTY session → TUI component captures keyboard input and streams it to/from PTY. Everything else works exactly as before.

Testing needed

  • Try opencode auth login with arrow keys
  • Verify vim test.txt works
  • Check ls -la still works (falls back to regular mode)

Allowlisted commands

vim, vi, nano, emacs, ssh, telnet, opencode, less, more, htop, top, man, psql, mysql, sqlite3, python, python3, node, irb

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8696 **State:** closed **Merged:** No --- Fixes #1180 ## Summary Adds support for interactive bash commands (like `opencode auth login`, `vim`, `ssh`) by using the existing PTY infrastructure when `interactive: true` is set. ## Changes - Added `interactive` parameter to bash tool with allowlist of supported commands - Created `BashInteractive` TUI component that connects to PTY via WebSocket - Falls back to regular spawn if PTY fails or command not in allowlist - ESC key exits interactive mode ## How it works When `interactive: true` and command is in allowlist → creates PTY session → TUI component captures keyboard input and streams it to/from PTY. Everything else works exactly as before. ## Testing needed - Try `opencode auth login` with arrow keys - Verify `vim test.txt` works - Check `ls -la` still works (falls back to regular mode) ## Allowlisted commands vim, vi, nano, emacs, ssh, telnet, opencode, less, more, htop, top, man, psql, mysql, sqlite3, python, python3, node, irb
yindo added the pull-request label 2026-02-16 18:17:43 -05:00
yindo closed this issue 2026-02-16 18:17:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12833