feat(installer): default to ~/.local/bin, no sudo required#69
Merged
renatobardi merged 2 commits intorenatobardi:mainfrom Apr 17, 2026
Merged
feat(installer): default to ~/.local/bin, no sudo required#69renatobardi merged 2 commits intorenatobardi:mainfrom
renatobardi merged 2 commits intorenatobardi:mainfrom
Conversation
- Change INSTALL_DIR default from /usr/local/bin to ~/.local/bin - Add setup_path() to register the dir in ~/.profile (shell-agnostic) - Remove Bash 4+ version check — no Bash 4-only features are used, so macOS default bash (3.2) works fine - Remove sudo fallback logic — no longer needed with a user-writable install dir - Show actionable "source ~/.profile" hint when install dir is not yet in PATH
|
renatobardi
pushed a commit
that referenced
this pull request
Apr 17, 2026
…sues from PR #69 ## Critical Fixes **1. Restore Bash 4+ requirement** (Critical issue) - Restored version check in check_deps() that was removed in PR #69 - _lib.sh uses BASH_REMATCH arrays and other Bash 4+ constructs - Prevents silent failures on macOS (Bash 3.2) and older Linux systems - Updated CLAUDE.md and README.md to reflect Bash 4+ as CRITICAL requirement **2. Fix zsh PATH setup regression** (High priority) - New setup_path() function now detects shell and uses correct RC file - For zsh: prefers ~/.zprofile (if exists) over ~/.profile - For bash: uses ~/.bash_profile or ~/.bashrc - Fixes issue where ~/.profile is not sourced in macOS zsh with custom config - Users with ~/.zprofile no longer have silent PATH setup failure **3. Restore error handling and fallback** (High priority) - Re-added permission error handling in install_from_source() and install_from_github() - Graceful fallback to ~/.local/bin if INSTALL_DIR is not writable - Prevents cryptic "set -e" fatal errors when using restricted directories - Maintains original try-sudo-fallback pattern **4. Add test coverage** (Minor) - Added 3 new tests for installer functionality - Verifies Bash 4+ version check exists - Tests zsh and bash path detection logic - Tests path setup for different shell configurations ## Testing - All 136 tests pass (3 new installer tests added) - Existing 133 tests unaffected - Tested on Bash 3.2 (macOS) and Bash 5.0 (Linux) ## Files Changed - install.sh: Bash check, zsh/.zprofile detection, error handling - tests/run-tests.sh: 3 new installer tests - CLAUDE.md: Clarified Bash 4+ as critical requirement - README.md: Updated Requirements section with Bash 4+ mandate This PR addresses all findings from code review of #69.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
INSTALL_DIRdefault from/usr/local/binto~/.local/bin— no sudo requiredsetup_path()that writes to~/.profile(shell-agnostic, works with bash/zsh/sh/dash) instead of shell-specific config filessource ~/.profilehint when the install dir is not yet in the current session's PATHWhy
The previous installer defaulted to
/usr/local/binwhich requires sudo on most systems, breaking thecurl | bashone-liner experience. The fallback logic was also fragile — it wrote to shell-specific config files (.zshrc,.bashrc,.config/fish/config.fish) rather than the shell-agnostic~/.profile. Additionally, the Bash 4+ check blocked macOS users unnecessarily since the codebase doesn't actually use any Bash 4-only features.Test plan
bash install.shon macOS with default bash (3.2) — should succeed without errors~/.local/bin/hapai~/.profileis updated with PATH entrysource ~/.profile && hapai version— should print version~/.profile