Skip to content

fix(install): set user PATH automatically instead of printing the command#1

Merged
MasonStation merged 1 commit intomainfrom
fix/install-auto-path
Apr 26, 2026
Merged

fix(install): set user PATH automatically instead of printing the command#1
MasonStation merged 1 commit intomainfrom
fix/install-auto-path

Conversation

@MasonStation
Copy link
Copy Markdown
Contributor

Summary

  • Both install.sh and install.ps1 previously detected when their target bin dir wasn't on PATH and asked the user to copy/paste a long shell incantation themselves. Now the installers do it.
  • install.ps1 writes User-scope PATH via [Environment]::SetEnvironmentVariable(..., 'User') and also injects into $env:Path so the current PowerShell session can run stack immediately.
  • install.sh adds an add_to_user_path helper that detects bash/zsh/fish from $SHELL and appends an idempotent export (or set -gx) block to the right rc file with a # ashlr-stack PATH marker so re-runs are no-ops.
  • packages/site/public/install.{sh,ps1} is byte-synced to scripts/.

Why

A real user (me, on a fresh Windows 11 machine) ran irm https://stack.ashlr.ai/install.ps1 | iex and hit:

!  stack: C:\Users\User\AppData\Local\Programs\ashlr-stack\bin isn't on PATH -- add it (user scope):
!  stack:   [Environment]::SetEnvironmentVariable('Path', "C:\Users\User\AppData\Local\Programs\ashlr-stack\bin;" + [Environment]::GetEnvironmentVariable('Path','User'), 'User')

That's the opposite of what a one-liner installer should do. We already know the exact command — just run it.

Follow-up not in this PR

scripts/install.{sh,ps1} and packages/site/public/install.{sh,ps1} are still maintained as duplicate copies. Should be wired up via a prebuild script in packages/site (or symlinks) so they can't drift.

Test plan

  • On a fresh Windows VM, run irm https://stack.ashlr.ai/install.ps1 | iex and confirm stack --help works in a new PowerShell window without manual PATH edits
  • On a fresh Linux/macOS machine, curl -fsSL stack.ashlr.ai/install.sh | bash, open a new shell, confirm stack --help works
  • Re-run the installer twice; confirm the rc file isn't double-appended (marker idempotency)
  • Test with SHELL=/bin/zsh and SHELL=/usr/bin/fish to confirm correct rc file detection

🤖 Generated with Claude Code

…mand

Both installers detected when their target bin dir wasn't on PATH and asked
the user to copy/paste a long shell incantation themselves. Now they do it.

- install.ps1: writes the User-scope PATH via SetEnvironmentVariable and
  injects into $env:Path so the current session sees `stack` immediately.
- install.sh: new add_to_user_path helper appends an idempotent export
  (or fish set -gx) block to the right rc file (zsh/bash/fish) with a
  marker comment so re-runs are no-ops.
- Site mirror at packages/site/public/install.{sh,ps1} synced.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ashlr-stack Ready Ready Preview, Comment Apr 26, 2026 7:40pm

Request Review

@MasonStation MasonStation merged commit 439f1bc into main Apr 26, 2026
6 checks passed
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.

1 participant