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(install): skip a foreign destination symlink and keep going; replace our own
Michael Sitarzewskia9feb4285fbc
diff --git a/scripts/install.sh b/scripts/install.shindex cafdff09..f6ad61f9 100755--- a/scripts/install.sh+++ b/scripts/install.sh@@ -289,8 +289,19 @@ install_file() {local target="$2"[[ -d "$target" ]] && target="${target%/}/$(basename "$1")"if [[ -L "$target" ]]; then- err "Refusing to copy through a destination symlink: $target"- return 1+ # cp would follow the link and overwrite whatever it points at.+ local link_to; link_to="$(readlink "$target")"+ if [[ "$link_to" == "$REPO_ROOT/"* ]]; then+ # Our own --link install: switching to a copy is the intended change.+ rm -f -- "$target"+ else+ # Someone else's link: leave it and its target alone, keep installing+ # the rest, and say so in the summary (one stray link must not abort+ # the install halfway through the roster).+ warn "Skipped $target — it is a symlink to $link_to; not overwriting it."+ [[ -n "${SKIPPED_LOG:-}" ]] && printf '%s -> %s\n' "$target" "$link_to" >> "$SKIPPED_LOG"+ return 0+ fificp "$1" "$2"fi@@ -1496,6 +1507,9 @@ install_tool() {# Entry point# ---------------------------------------------------------------------------main() {+ SKIPPED_LOG="$(mktemp "${TMPDIR:-/tmp}/agency-install-skipped.XXXXXX")"+ export SKIPPED_LOG+ trap 'rm -f "$SKIPPED_LOG"' EXITlocal tool="all"local interactive_mode="auto"local use_parallel=false@@ -1686,6 +1700,11 @@ main() {box_row "${C_GREEN}${C_BOLD}${msg}${C_RESET}"box_botprintf "\n"+ if [[ -s "$SKIPPED_LOG" ]]; then+ warn "Not installed: $(wc -l < "$SKIPPED_LOG" | tr -d ' ') file(s) whose destination is a symlink to somewhere else:"+ sed 's/^/ /' "$SKIPPED_LOG" >&2+ warn "Remove or replace those links, then re-run to install them."+ fidim " Run ./scripts/convert.sh to regenerate after adding or editing agents."printf "\n"}diff --git a/scripts/test-install.sh b/scripts/test-install.shindex a2e8c506..76549af6 100755--- a/scripts/test-install.sh+++ b/scripts/test-install.sh@@ -419,9 +419,26 @@ dest="$home/dest"mkdir -p "$dest"printf 'KEEP THIS FILE\n' > "$home/sentinel"ln -s "$home/sentinel" "$dest/$(basename "$FIRST_ENG_FILE")"-run_install "$home" --tool claude-code --no-convert --agent "$FIRST_ENG_SLUG" --path "$dest"-assert_eq 1 "$RUN_STATUS" "copy mode refuses an existing agent-file symlink"+SECOND_ENG_FILE="$(agent_files_in engineering | awk 'NR==2')"+SECOND_ENG_SLUG="$(agent_slug "$SECOND_ENG_FILE")"+run_install "$home" --tool claude-code --no-convert --agent "$FIRST_ENG_SLUG,$SECOND_ENG_SLUG" --path "$dest"+assert_eq 0 "$RUN_STATUS" "a foreign agent-file symlink is skipped, not fatal"assert_eq 'KEEP THIS FILE' "$(cat "$home/sentinel")" "symlink target is not overwritten"+assert_eq true "$([[ -L "$dest/$(basename "$FIRST_ENG_FILE")" ]] && echo true || echo false)" "the foreign symlink itself is left in place"+assert_eq true "$([[ -f "$dest/$(basename "$SECOND_ENG_FILE")" && ! -L "$dest/$(basename "$SECOND_ENG_FILE")" ]] && echo true || echo false)" "the rest of the selection still installs"+assert_eq true "$(grep -q 'Not installed: 1 file' <<<"$RUN_OUT" && echo true || echo false)" "the summary reports the skipped file"++# Switching from --link to a copy replaces our own links, and never writes+# through them into the clone's source files.+home="$(sandbox link-then-copy)"+dest="$home/dest"+src_sum="$(cksum < "$FIRST_ENG_FILE")"+run_install "$home" --tool claude-code --no-convert --agent "$FIRST_ENG_SLUG" --path "$dest" --link+assert_eq true "$([[ -L "$dest/$(basename "$FIRST_ENG_FILE")" ]] && echo true || echo false)" "--link installs a symlink"+run_install "$home" --tool claude-code --no-convert --agent "$FIRST_ENG_SLUG" --path "$dest"+assert_eq 0 "$RUN_STATUS" "a copy install over our own --link install succeeds"+assert_eq true "$([[ -f "$dest/$(basename "$FIRST_ENG_FILE")" && ! -L "$dest/$(basename "$FIRST_ENG_FILE")" ]] && echo true || echo false)" "our own link is replaced by a real copy"+assert_eq "$src_sum" "$(cksum < "$FIRST_ENG_FILE")" "the clone's source file is unchanged"# ---------------------------------------------------------------------------echo ""