diff --git a/scripts/install.sh b/scripts/install.sh index 6be90822..33981ae3 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1024,8 +1024,10 @@ install_aider() { install_windsurf() { local src="$INTEGRATIONS/windsurf/.windsurfrules" - local dest="${PWD}/.windsurfrules" + local dest_dir; dest_dir="$(resolve_dest windsurf "$PWD")" + local dest="$dest_dir/.windsurfrules" [[ -f "$src" ]] || { err "integrations/windsurf/.windsurfrules missing. Run convert.sh first."; return 1; } + mkdir -p "$dest_dir" if [[ -f "$dest" ]]; then warn "Windsurf: .windsurfrules already exists at $dest (remove to reinstall)." return 0 diff --git a/scripts/test-install.sh b/scripts/test-install.sh index 4f35319c..a2e8c506 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -288,6 +288,22 @@ assert_eq "$TOTAL_AGENTS" "$(count_md "$dest")" "installs into a path containing assert_eq 0 "$(find "$home" -maxdepth 1 -name 'My' -o -maxdepth 1 -name 'Agents' | wc -l | tr -d ' ')" \ "a spaced path is not split into separate directories" +# Windsurf's --path is a directory override, just like Aider's. A caller may +# run this from another project, so installing into PWD silently edits the +# wrong project's .windsurfrules. +home="$(sandbox windsurf-path)" +work="$home/current project" +dest="$home/target project/rules" +mkdir -p "$work" +(cd "$work" && HOME="$home" bash "$INSTALL" --no-interactive --tool windsurf --path "$dest" > "$home/windsurf.log" 2>&1) +assert_eq 0 "$?" "Windsurf --path install exits successfully" +[[ -f "$dest/.windsurfrules" ]] \ + && pass "Windsurf --path installs into the requested directory" \ + || fail "Windsurf --path installs into the requested directory" +[[ ! -e "$work/.windsurfrules" ]] \ + && pass "Windsurf --path leaves the current project alone" \ + || fail "Windsurf --path leaves the current project alone" + # --------------------------------------------------------------------------- # 4b. Parallel workers get their arguments intact (PR #755) #