diff --git a/.chronus/changes/standalone-skip-shell-rerun-2026-7-30-1-48-14.md b/.chronus/changes/standalone-skip-shell-rerun-2026-7-30-1-48-14.md new file mode 100644 index 00000000000..fe489bff5d2 --- /dev/null +++ b/.chronus/changes/standalone-skip-shell-rerun-2026-7-30-1-48-14.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/standalone-cli" +--- + +Fix install script adding duplicate PATH entries to shell config files (`.bashrc`, `.zshrc`, etc.) on subsequent runs. The script now detects if TypeSpec is already configured and skips the shell update. Also fix `--skip-shell` flag which was using an inconsistent variable name and had no effect. diff --git a/packages/standalone/install.sh b/packages/standalone/install.sh index 71477fd60e9..eb26cb4145e 100755 --- a/packages/standalone/install.sh +++ b/packages/standalone/install.sh @@ -95,7 +95,7 @@ parse_args() { # shift # past value # ;; -s | --skip-shell) - SKIP_SHELL="true" + skip_shell="true" shift # past argument ;; --version) @@ -188,6 +188,10 @@ setup_shell() { if [ "$CURRENT_SHELL" = "zsh" ]; then CONF_FILE=${ZDOTDIR:-$HOME}/.zshrc ensure_containing_dir_exists "$CONF_FILE" + if grep -qF "TYPESPEC_PATH" "$CONF_FILE" 2> /dev/null; then + info "TypeSpec path already configured in $CONF_FILE, skipping." + return + fi echo "Installing for Zsh. Appending the following to $CONF_FILE:" { echo '' @@ -201,6 +205,10 @@ setup_shell() { elif [ "$CURRENT_SHELL" = "fish" ]; then CONF_FILE=$HOME/.config/fish/conf.d/tsp.fish ensure_containing_dir_exists "$CONF_FILE" + if grep -qF "TYPESPEC_PATH" "$CONF_FILE" 2> /dev/null; then + info "TypeSpec path already configured in $CONF_FILE, skipping." + return + fi echo "Installing for Fish. Appending the following to $CONF_FILE:" { echo '' @@ -218,6 +226,10 @@ setup_shell() { CONF_FILE=$HOME/.bashrc fi ensure_containing_dir_exists "$CONF_FILE" + if grep -qF "TYPESPEC_PATH" "$CONF_FILE" 2> /dev/null; then + info "TypeSpec path already configured in $CONF_FILE, skipping." + return + fi echo "Installing for Bash. Appending the following to $CONF_FILE:" { echo ''