-
Notifications
You must be signed in to change notification settings - Fork 28
🤖 feat: add ~/.mux/bashrc for shell environment customization #830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
9e62ba3 to
1f91268
Compare
1f91268 to
a48b2b7
Compare
When mux launches from Applications (not terminal), agent bash commands get a minimal PATH missing user tools. The standard ~/.bashrc isn't sourced because: 1. `bash -c` creates a non-interactive shell 2. Most bashrc files have interactivity guards that skip content This adds a dedicated ~/.mux/bashrc file that is always sourced before every bash command, allowing users to set up: - PATH modifications (Homebrew, ~/bin, etc.) - Nix profile sourcing - direnv hooks (auto-loads .envrc per directory) - pyenv/rbenv/nvm/asdf initialization Implementation: - LocalBaseRuntime.exec() prepends bashrc sourcing to all commands - SSHRuntime.exec() prepends bashrc sourcing (uses remote ~/.mux/bashrc) - Init hooks also source bashrc for consistency The snippet uses `[ -f $HOME/.mux/bashrc ] && . $HOME/.mux/bashrc || true` to ensure commands don't fail when the file doesn't exist. Fixes #797 _Generated with mux_
a48b2b7 to
7e379f2
Compare
tko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever. I can see this can potentially make all kinds of things convenient if it works.
| # Enable direnv (auto-loads .envrc per directory) | ||
| eval "$(direnv hook bash)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
direnv hook bash sets PROMPT_COMMAND which I believe means that direnv will not be activated until bash prompt is shown, which is never when running commands with bash -c
Assuming bashrc is sourced from the project directory with .envrc file then I guess running direnv export bash instead might work better (it's what direnv hook seems to run.)
Summary
When mux launches from Applications (not terminal), agent bash commands get a minimal PATH (
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin) missing user tools like Homebrew, nix, direnv, pyenv, etc.The standard
~/.bashrcisn't sourced because:bash -ccreates a non-interactive shell[[ $- != *i* ]] && returnguards that skip contentSolution
Add a dedicated
~/.mux/bashrcfile that is always sourced before every bash command, following the existing pattern of:~/.mux/AGENTS.md— global agent instructions<project>/.mux/init— project initialization hooksUse Cases
Implementation
LocalRuntime.exec()prepends bashrc sourcing to all commandsSSHRuntime.exec()prepends bashrc sourcing (uses remote~/.mux/bashrc)Testing
Fixes #797
Generated with
mux