Repository navigation
Description
Problem
When none of the installer's common bin directories is on PATH, install.sh falls back to ~/.local/bin and stops at printing instructions:
Warning: ~/.local/bin is not in your PATH
Add to ~/.zshrc:
export PATH="~/.local/bin:$PATH"
That's common on a Mac without Homebrew and in fresh Linux shells. Three things go wrong on the first run:
- The closing message prints
squirrel audit https://your-site.combefore the PATH warning. Someone who copies the first command getscommand not foundand may give up. - Nothing is written for them, so a user who skims past the warning has a binary they can't run, in this shell or the next one.
install.ps1has the same gap on Windows: it prints aSetEnvironmentVariableline for the user to run instead of adding the directory.
detect_shell_config already works out the right rc file from $SHELL (zsh, bash, fish, sh), and find_bin_dir already prefers a writable directory that's on PATH, but only from a fixed list of four (~/.local/bin, ~/bin, /usr/local/bin, /opt/homebrew/bin).
Other installers (Bun, Deno, rustup, uv) add their bin directory to the shell profile by default, with an opt-out.
Proposed behaviour
Keep the directory choice as it is. SQUIRREL_BIN_DIR wins, then the existing four common dirs when one is already on PATH and writable. Don't scan PATH for other directories: like uv and pipx, squirrel's own place is ~/.local/bin.
Otherwise install to ~/.local/bin and add it to PATH, the way Bun, Deno, rustup and uv add their bin dirs, idempotently, in the rc file the shell actually reads:
| Shell | File | Line |
|---|---|---|
| zsh | ${ZDOTDIR:-$HOME}/.zshrc |
export PATH="$HOME/.local/bin:$PATH" |
| bash, macOS | ~/.bash_profile (Terminal opens login shells) |
same |
| bash, Linux | ~/.bashrc |
same |
| fish | ~/.config/fish/conf.d/squirrel.fish |
fish_add_path $HOME/.local/bin |
| sh / unknown | ~/.profile |
same as zsh |
- Wrap the line in a marker comment (
# squirrel) and skip the write when the marker or the directory is already present, so rerunning the installer never adds a second line. - Create the file if it doesn't exist. Never rewrite or reorder existing content: append only.
- Opt out with
SQUIRREL_NO_MODIFY_PATH=1: then print today's instructions instead. - In CI (
CIset), don't edit rc files. IfGITHUB_PATHis set, append the directory to it. - Say what was done: "Added ~/.local/bin to PATH in ~/.zshrc."
Fix the closing message order. When the current shell can't find squirrel yet (the directory was just added, or the user opted out), the epilogue says so first and shows commands that work right now:
Open a new terminal, or run: source ~/.zshrc
Then: squirrel audit https://your-site.com
(or right now: ~/.local/bin/squirrel audit https://your-site.com)
When squirrel is already on PATH, the epilogue is unchanged.
Windows (install.ps1). When the bin directory isn't on the user PATH, add it to the User-scope Path ([Environment]::SetEnvironmentVariable(..., 'User'), never Machine), and to $env:Path for the current session. Same opt-out variable, same idempotence, and a message saying a new terminal picks it up.
Measure it. Pass the outcome to squirrel self install with the other install metadata, as path_setup: one of on_path (the chosen directory was already on PATH), added (rc or User Path written), opted_out, ci, failed. The CLI sends it with the install registration. The cloud side accepting the field is tracked internally.
Acceptance Criteria
- Directory choice is unchanged: with
/usr/local/bin(or~/.local/bin) onPATHand writable, the binary goes there and no rc file is written; a writable non-standard$HOME/.mybinonPATHis not used. - With none of the four dirs on PATH and
SHELL=/bin/zsh, the installer appends one markedexport PATHline to~/.zshrc(respectingZDOTDIR), creating the file if needed, and prints which file it changed. - Running the installer twice leaves exactly one marked line. A file that already puts
~/.local/binon PATH gets no line. - bash on macOS writes
~/.bash_profile, bash on Linux writes~/.bashrc, fish writes~/.config/fish/conf.d/squirrel.fishwithfish_add_path, and an unknown shell writes~/.profile. -
SQUIRREL_NO_MODIFY_PATH=1writes nothing and prints the manual instructions. - With
CI=true, no rc file is written. WithGITHUB_PATHset, the dir is appended to that file. - When
squirrelisn't resolvable in the current shell, the epilogue's first lines are the reload hint and the full-pathsquirrel auditcommand. When it is resolvable, the epilogue is byte-identical to today's. -
install.ps1adds the dir to the UserPathonce (idempotent), updates$env:Pathfor the session, honoursSQUIRREL_NO_MODIFY_PATH, and never touches MachinePath. - The install registration carries
path_setupwith one of the five values, from both installers. - The installer test suite covers each case above (shell tests against a temp
HOME), and the existing installer tests pass. -
docs/install page documents the auto-add, the file each shell gets and the opt-out;make validatepasses indocs/.
Skill: no change expected; the squirrelscan skill links to the install page.
Activity
[-]Installers: add the bin directory to PATH automatically, prefer a directory already on PATH, and show a first command that works[/-][+]Installers: add ~/.local/bin to PATH automatically and show a first command that works[/+]fix(installer): only a PATH line counts as configured; skip profile a…
fix(installer): longer manager denylist, trailing-slash PATH entries,…
fix(installer): keep REG_EXPAND_SZ User Path entries intact, compare …
docs(installer): comment the session-only PATH case and the broadcast…
refactor(installer): drop the PATH-scan directory heuristic, keep the…
fix(installer): drop the PATH scan, keep main's directory choice; onl…
feat(installer): add the bin dir to PATH, prefer a writable PATH dir,…
fix(installer): only a PATH line counts as configured; skip profile a…
fix(installer): longer manager denylist, trailing-slash PATH entries,…
fix(installer): keep REG_EXPAND_SZ User Path entries intact, compare …
docs(installer): comment the session-only PATH case and the broadcast…
refactor(installer): drop the PATH-scan directory heuristic, keep the…
6 remaining items
fix(installer): keep REG_EXPAND_SZ User Path entries intact, compare …
docs(installer): comment the session-only PATH case and the broadcast…
refactor(installer): drop the PATH-scan directory heuristic, keep the…
fix(installer): drop the PATH scan, keep main's directory choice; onl…
fix(installer): a PATH= line must name ~/.local/bin itself to count a…
feat(installer): add the bin dir to PATH, prefer a writable PATH dir,…
fix(installer): only a PATH line counts as configured; skip profile a…
fix(installer): longer manager denylist, trailing-slash PATH entries,…
fix(installer): keep REG_EXPAND_SZ User Path entries intact, compare …
docs(installer): comment the session-only PATH case and the broadcast…
refactor(installer): drop the PATH-scan directory heuristic, keep the…
fix(installer): drop the PATH scan, keep main's directory choice; onl…
fix(installer): a PATH= line must name ~/.local/bin itself to count a…
feat(install): the installers put squirrel on your PATH, with SQUIRRE…