Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

fix(installer): honor single Copilot destination override

Rudy Celekli3e7dda0ae7c0
diff --git a/scripts/install.sh b/scripts/install.sh
index 50f46893..035676d6 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -779,21 +779,27 @@ install_claude_code() {
install_copilot() {
local dest_github; dest_github="$(resolve_dest copilot "${HOME}/.github/agents")"
- local dest_copilot="${HOME}/.copilot/agents"
+ local dest_copilot=""
+ # The two default locations are intentional, but an explicit destination
+ # must not also write into the user's default Copilot directory.
+ if [[ -z "$OVERRIDE_PATH" && -z "${COPILOT_AGENT_DIR:-}" ]]; then
+ dest_copilot="${HOME}/.copilot/agents"
+ fi
local count=0 dir f slug
- mkdir -p "$dest_github" "$dest_copilot"
+ mkdir -p "$dest_github"
+ [[ -n "$dest_copilot" ]] && mkdir -p "$dest_copilot"
for dir in "${AGENT_DIRS[@]}"; do
[[ -d "$REPO_ROOT/$dir" ]] || continue
while IFS= read -r -d '' f; do
is_agent_file "$f" || continue
slug="$(agent_slug "$f")"; slug_allowed "$slug" || continue
install_file "$f" "$dest_github/"
- install_file "$f" "$dest_copilot/"
+ [[ -n "$dest_copilot" ]] && install_file "$f" "$dest_copilot/"
incr count
done < <(find "$REPO_ROOT/$dir" -name "*.md" -type f -print0)
done
ok "Copilot: $count agents -> $dest_github"
- ok "Copilot: $count agents -> $dest_copilot"
+ [[ -n "$dest_copilot" ]] && ok "Copilot: $count agents -> $dest_copilot"
warn "Copilot: Verify VS Code setting 'chat.agentFilesLocations' includes your install path."
dim " Open Settings (Ctrl/Cmd+,) -> search 'chat.agentFilesLocations'"
}
diff --git a/scripts/test-install.sh b/scripts/test-install.sh
index 769fb361..4d9ae3ed 100755
--- a/scripts/test-install.sh
+++ b/scripts/test-install.sh
@@ -173,18 +173,27 @@ run_install "$home" --tool claude-code --path "$dest"
assert_eq "$TOTAL_AGENTS" "$(count_md "$dest")" "--path overrides the default destination"
assert_eq 0 "$(count_md "$home/.claude/agents")" "--path leaves the default destination empty"
+home="$(sandbox copilot-default)"
+run_install "$home" --tool copilot --agent "$FIRST_ENG_SLUG"
+assert_eq 1 "$(count_md "$home/.github/agents")" "Copilot defaults to the GitHub agents directory"
+assert_eq 1 "$(count_md "$home/.copilot/agents")" "Copilot also installs into the Copilot agents directory by default"
+
# Env var override, and --path winning over it. COPILOT_AGENT_DIR is used here
# because it unambiguously names the agents directory itself.
home="$(sandbox env-override)"
dest="$home/from-env"
RUN_OUT="$(HOME="$home" COPILOT_AGENT_DIR="$dest" "$INSTALL" --no-interactive --tool copilot 2>&1)"
assert_eq "$TOTAL_AGENTS" "$(count_md "$dest")" "COPILOT_AGENT_DIR overrides the default destination"
+assert_eq 0 "$(count_md "$home/.github/agents")" "COPILOT_AGENT_DIR leaves the GitHub default empty"
+assert_eq 0 "$(count_md "$home/.copilot/agents")" "COPILOT_AGENT_DIR leaves the Copilot default empty"
home="$(sandbox env-vs-path)"
RUN_OUT="$(HOME="$home" COPILOT_AGENT_DIR="$home/from-env" "$INSTALL" --no-interactive \
--tool copilot --path "$home/from-flag" 2>&1)"
assert_eq "$TOTAL_AGENTS" "$(count_md "$home/from-flag")" "--path wins over the env var"
assert_eq 0 "$(count_md "$home/from-env")" "env var destination is unused when --path is given"
+assert_eq 0 "$(count_md "$home/.github/agents")" "Copilot --path leaves the GitHub default empty"
+assert_eq 0 "$(count_md "$home/.copilot/agents")" "Copilot --path leaves the Copilot default empty"
# ---------------------------------------------------------------------------
# 3b. CLAUDE_CONFIG_DIR is the config root, not the agents dir (issue #578)