Skip to content

Conversation

@aryasaatvik
Copy link
Contributor

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()

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

- Extract shell execution logic from prompt.ts to shell.ts
- Add Shell.execute method to centralize shell command execution
- Simplify bash.ts by using Shell.execute
- Ensure proper user environment variable handling across shells
@aryasaatvik aryasaatvik force-pushed the feat/bash-tool-user-env branch from 606c4a5 to db95476 Compare January 8, 2026 08:56
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.

1 participant