copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Support sourcing user shell config (BASH_ENV/bashrc) for bash tool

Open kyle-ingka opened this issue 1 month ago • 0 comments

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.

kyle-ingka avatar Dec 01 '25 05:12 kyle-ingka