Problem
When the Copilot CLI bash tool runs commands, it doesn't respect user shell configurations like BASH_ENV, ~/.bashrc, or custom functions/aliases.
Use Case
I have a safety wrapper function in ~/.funcs.sh that overrides rm to use trash (move to macOS Trash instead of permanent deletion):
function rm() {
local files=()
for arg in "$@"; do
if [[ "$arg" != -* ]]; then
files+=("$arg")
fi
done
trash "${files[@]}" 2>/dev/null || true
}
I set export BASH_ENV=~/.bash_env.sh in ~/.zshenv, which sources my functions. This works for bash -c 'type rm' in subshells, but the Copilot CLI's bash tool doesn't pick it up.
Current Behavior
BASH_ENV is inherited by the Copilot CLI process
- But bash commands run via the tool still use
/bin/rm instead of my function
- User safety wrappers and aliases are ignored
Expected Behavior
Option to source user config before running commands, e.g.:
- Respect
BASH_ENV for command execution
- Or add a flag/config like
--rc-file ~/.bash_env.sh
- Or a config option in
~/.config/github-copilot/config.json
Environment
- macOS (Darwin)
- Copilot CLI version: 0.0.365
- Shell: zsh (launching copilot), bash (tool execution)
Workaround
Currently documenting in my AGENTS.md to use trash instead of rm, but this requires remembering to instruct the AI agent explicitly.
Problem
When the Copilot CLI bash tool runs commands, it doesn't respect user shell configurations like
BASH_ENV,~/.bashrc, or custom functions/aliases.Use Case
I have a safety wrapper function in
~/.funcs.shthat overridesrmto usetrash(move to macOS Trash instead of permanent deletion):I set
export BASH_ENV=~/.bash_env.shin~/.zshenv, which sources my functions. This works forbash -c 'type rm'in subshells, but the Copilot CLI's bash tool doesn't pick it up.Current Behavior
BASH_ENVis inherited by the Copilot CLI process/bin/rminstead of my functionExpected Behavior
Option to source user config before running commands, e.g.:
BASH_ENVfor command execution--rc-file ~/.bash_env.sh~/.config/github-copilot/config.jsonEnvironment
Workaround
Currently documenting in my
AGENTS.mdto usetrashinstead ofrm, but this requires remembering to instruct the AI agent explicitly.