opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(bash): load user shell RC files for alias support

Open aryasaatvik opened this issue 1 week ago • 1 comments

Summary

  • Adds Shell.execute() unified function for shell command execution with RC file loading support
  • Bash tool now loads user shell RC files (.bashrc, .zshrc, etc.) enabling access to aliases
  • Refactors shell escape (! prefix) to use the same shared execution logic

Changes

src/shell/shell.ts

  • Added Shell.execute() function with options for loadRcFiles, timeout, abort, onOutput
  • Added getInvocationArgs() helper for shell-specific invocation patterns (zsh, bash, fish, nu, cmd, powershell)

src/tool/bash.ts

  • Replaced inline spawn logic with Shell.execute({ loadRcFiles: true })
  • Bash tool now has access to user aliases and shell functions
  • Added TERM: "dumb" for cleaner output

src/session/prompt.ts

  • Refactored shell() function to use Shell.execute()
  • Removed duplicated spawn logic

Behavior Changes

Feature Before After
Bash tool RC files Not loaded Loaded (aliases work)
Bash tool TERM Inherited "dumb"
Code duplication Separate implementations Shared Shell.execute()

aryasaatvik avatar Jan 07 '26 06:01 aryasaatvik