opencode
opencode copied to clipboard
Persistent shell mode - keep shell session alive after executing commands
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
Description
Problem
Currently, when using the ! command to enter shell mode in opencode TUI, the shell session exits immediately after executing a single command. This requires users to repeatedly type ! to execute multiple shell commands, which disrupts workflow efficiency.
Current Behavior
- Type
!to enter shell mode - Execute a command (e.g.,
ls -la) - Shell automatically exits and returns to opencode TUI
- Must type
!again for the next command
Expected Behavior
Option to keep shell session persistent:
- Type
!to enter shell mode - Execute multiple commands without re-entering shell mode
- Use
exitorctrl+dto manually exit shell mode
Use Cases
- Rapid file system exploration requiring multiple
ls,cd,findcommands - Git operations requiring multiple commands (
git status,git log,git diff) - Development workflow with multiple build/test commands
- System administration tasks requiring multiple shell commands
Proposed Solutions
- Persistent Shell Mode Toggle: Add a configuration option to enable persistent shell mode
- Shell Mode Indicator: Visual indicator showing when in shell mode
-
Graceful Exit: Use
exitcommand orctrl+dto leave persistent shell mode - Command History: Maintain shell command history across sessions
Implementation Ideas
- Environment variable:
OPENCODE_PERSISTENT_SHELL=true - Config file option:
tui.persistent_shell: true - Command toggle:
/persistent-shellto enable/disable mode - Visual indicator in status bar when in persistent shell mode
Benefits
- Improved workflow efficiency for multi-command operations
- Reduced context switching between opencode and shell
- Better user experience for shell-heavy workflows
- Maintains opencode's integration benefits while providing shell flexibility
Operating System
All platforms (Linux, macOS, Windows)
Terminal
All supported terminals
OpenCode Version
Latest version (1.x)
Additional Notes
This issue is related to the current shell mode implementation where the ! command provides temporary shell access but exits after each command execution. The request is to enhance this feature to support persistent shell sessions for improved developer productivity.
References
- Related to issue #6248 about shell mode selection problems
- Complements the existing bash command functionality documented at https://opencode.ai/docs/tui#bash-commands
- Aligns with opencode's goal of providing seamless development workflow integration