Skip to content

refactor: simplify install.sh to print PATH guidance instead of modifying rc files#403

Merged
drew merged 4 commits intomainfrom
fix/394-install-shell-detection/drew
Mar 17, 2026
Merged

refactor: simplify install.sh to print PATH guidance instead of modifying rc files#403
drew merged 4 commits intomainfrom
fix/394-install-shell-detection/drew

Conversation

@drew
Copy link
Collaborator

@drew drew commented Mar 17, 2026

Summary

Rewrites install.sh to stop modifying user dotfiles entirely. Instead of writing env scripts and injecting source lines into .bashrc, .zshrc, .profile, etc., the installer now prints shell-appropriate instructions when ~/.local/bin is not on the user's PATH.

This eliminates the class of bugs from #394 (variable clobbering, wrong env script sourced into wrong shell) by removing the rc file modification machinery altogether.

Related Issue

Closes #394

Changes

  • install.sh: Remove all rc file modification logic (setup_path, write_env_script_sh, write_env_script_fish, add_source_line, env script generation, fish conf.d setup, --no-modify-path flag). When the install dir is not on PATH, print export PATH="..." for POSIX shells or fish_add_path for fish.
  • e2e/install/: verify the binary is installed to the correct directory, is executable, runs, and that PATH guidance output is correct per shell (sh, bash, zsh, fish).

Testing

  • mise run pre-commit passes
  • Manual review of simplified install script

Tests added:

  • E2E: Per-shell tests (sh, bash, zsh, fish) that run the real installer against the latest release and validate binary placement + PATH guidance output

Checklist

  • Follows Conventional Commits
  • Scoped to the issue at hand

Closes #394

The install script showed both fish and POSIX source commands regardless of
the user's shell. On systems with fish config present (e.g. DGX Spark), this
confused bash users by suggesting they source the fish env script. Now detects
the current shell via $SHELL and shows only the relevant command.

Also fixes the wget fallback in resolve_redirect to use portable sed instead
of grep -oP (Perl regex) which is unavailable on some systems.
@drew drew requested a review from a team as a code owner March 17, 2026 17:58
@drew drew self-assigned this Mar 17, 2026
drew added 3 commits March 17, 2026 11:42
Functions write_env_script_fish, add_source_line, and verify_checksum used
variable names that collided with their callers in setup_path and main.
Since POSIX sh has no local scope, write_env_script_fish overwrote
_env_script, causing the fish env path to be sourced in .bashrc/.profile
instead of the POSIX env script. Use function-prefixed variable names to
avoid all cross-function clobbering.
Adds e2e/test-install.sh with 12 test cases covering:
- POSIX and fish env script syntax correctness
- rc files (.bashrc, .profile, .zshrc) source the correct env script
- fish conf.d sources the fish env script
- existing rc file content is preserved (no overwrites)
- no duplicate source lines on re-runs
- shell-aware guidance output (POSIX vs fish)
- variable clobbering regression (the #394 root cause)
- .profile creation when no rc files exist

Adds .github/workflows/test-install.yml that runs on changes to
install.sh or the test script.
…ying rc files

Remove all rc file modification logic (env scripts, source lines, fish
conf.d setup). The installer now prints shell-appropriate instructions
when ~/.local/bin is not on PATH, leaving dotfile changes to the user.

Rewrite e2e tests as true end-to-end tests that download the latest
release, verify the binary is installed correctly, and check PATH
guidance output per shell.
@drew drew changed the title fix: show shell-appropriate PATH guidance in install script refactor: simplify install.sh to print PATH guidance instead of modifying rc files Mar 17, 2026
@drew drew merged commit 925160e into main Mar 17, 2026
13 checks passed
@drew drew deleted the fix/394-install-shell-detection/drew branch March 17, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: curl install added Fish script to bash profile

2 participants