Skip to content

fix(install): shell-aware PATH instruction (bash/zsh/fish/tcsh/csh)#128

Merged
George-iam merged 1 commit intomainfrom
feat/shell-aware-install-20260506
May 6, 2026
Merged

fix(install): shell-aware PATH instruction (bash/zsh/fish/tcsh/csh)#128
George-iam merged 1 commit intomainfrom
feat/shell-aware-install-20260506

Conversation

@George-iam
Copy link
Copy Markdown
Contributor

Summary

install.sh previously printed only the bash/zsh export PATH=... form regardless of the user's shell. On tcsh that snippet is invalid syntax, AND ~/.local/bin is not on PATH by default for tcsh (most distros add it via ~/.profile, which tcsh doesn't read), so tcsh users could not run axme-code after install. Reported by user on a tcsh machine today.

Changes

  • Detect login shell from $SHELL (fallback: getent passwd).
  • Print the right syntax + rc-file for each shell:
    • bash → ~/.bashrc export PATH="...:$PATH"
    • zsh → ~/.zshrc export PATH=...
    • fish → ~/.config/fish/config.fish set -gx PATH ... $PATH
    • tcsh → ~/.tcshrc setenv PATH ...:$PATH
    • csh → ~/.cshrc setenv PATH ...:$PATH
  • Unknown shell → fallback listing all four forms.
  • No auto-edit of rc files. User runs the printed command. Same model as deno / starship / nvm.
  • install.ps1 unchanged — Windows installer already auto-writes User PATH via [Environment]::SetEnvironmentVariable.

Bonus

main "$@" now gated behind BASH_SOURCE[0] = $0 so source install.sh no longer fires a real download + install. Lets the helper functions be unit-tested without touching the live binary. (Caught while smoke-testing this very PR — accidentally re-ran an install during a sourced test.)

Test plan

  • bash -n install.sh clean.
  • All 6 shell branches smoke-tested via SHELL=... bash -c 'source install.sh; print_path_instruction /tmp/x' — each prints correct syntax + rc-file.
  • Sourcing guard verified — sourcing the file no longer triggers main.

CHANGELOG

Added under [Unreleased]. No version bump in this PR.

🤖 Generated with Claude Code

install.sh used to unconditionally print the bash/zsh `export PATH=...`
form, leaving tcsh / csh / fish users with non-working snippets. tcsh in
particular doesn't auto-add ~/.local/bin to PATH the way bash and zsh do
on most Linux distros (~/.profile is bash-only), so those users could
not run axme-code at all after install — that was the user-visible bug
reported on a tcsh machine.

Detect the login shell from $SHELL (fallback: getent passwd) and print
the correct syntax + rc file for the detected shell:
- bash  → ~/.bashrc            export PATH="...:$PATH"
- zsh   → ~/.zshrc             export PATH="...:$PATH"
- fish  → config.fish          set -gx PATH ... $PATH
- tcsh  → ~/.tcshrc            setenv PATH ...:$PATH
- csh   → ~/.cshrc             setenv PATH ...:$PATH
Unknown shells get a fallback listing all four forms.

No auto-edit of rc files — user runs the printed command. Same model as
deno / starship / nvm. install.ps1 is unaffected (Windows already auto-
writes User PATH via [Environment]::SetEnvironmentVariable).

Also: gate `main "$@"` on `BASH_SOURCE[0] = $0` so `source install.sh`
no longer triggers a real download + install. Lets the new helpers be
unit-tested directly. Smoke-tested all 6 branches manually via
`SHELL=... bash -c 'source install.sh; print_path_instruction /tmp/x'`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> #!axme pr=none repo=AxmeAI/axme-code
@George-iam George-iam merged commit 9fbc907 into main May 6, 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