Skip to content

Add ~/.local/bin to PATH for user-installed binaries#3

Closed
davidkreps wants to merge 2 commits intomainfrom
fix-local-bin-path
Closed

Add ~/.local/bin to PATH for user-installed binaries#3
davidkreps wants to merge 2 commits intomainfrom
fix-local-bin-path

Conversation

@davidkreps
Copy link
Copy Markdown
Owner

Summary

  • Adds $HOME/.local/bin to PATH in .zshrc, alongside the other PATH additions
  • Guarded with [ -d ... ] so it's silently skipped on machines where the directory doesn't exist
  • Fixes the Claude CLI "native installation exists but ~/.local/bin is not in your PATH" warning

Test plan

  • ./test.sh passes (36/36)
  • Verify claude is accessible after sourcing .zshrc on a machine with ~/.local/bin populated

🤖 Generated with Claude Code

davidkreps and others added 2 commits February 13, 2026 17:08
- Back up existing files before overwriting with symlinks (safe_link helper)
- Trim git/ignore to OS/editor artifacts only; remove language-specific patterns
- Remove surprising merge.ff=false and merge.commit=no from git/config
- Guard cursor-shape escape sequences behind [[ -o interactive ]]
- Bind phpserver to 127.0.0.1 instead of LAN IP
- Remove pip='pip3' alias (breaks virtualenvs) and d='docker' alias (conflict risk)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
XDG-standard location used by pip --user, cargo, claude CLI, etc.
Guarded with existence check for graceful degradation on machines
where the directory doesn't exist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude Bot commented Feb 23, 2026

Claude finished @davidkreps's task in 2m 18s —— View job


PR Review: Add ~/.local/bin to PATH for user-installed binaries

  • Gather context and read changed files
  • Review against CLAUDE.md conventions
  • Check shell portability (macOS + Linux)
  • Check idempotency of install.sh
  • Check OS/tool guards
  • Check stdout cleanliness
  • Check trailing newlines
  • Check test coverage
  • Post final review

Summary

The core ~/.local/bin PATH addition is well-implemented, but the PR is considerably larger than its description suggests. The "Fix safety, security, and portability issues" commit introduces sweeping changes across 6 files that aren't described in the PR body.


Issues

1. git/ignore silently lost 54 lines — no mention in PR description

git/ignore went from ~80 lines to 26 lines (+0/-54). The current file only covers OS-generated files, editor files, and .env variants. It's unclear what patterns were dropped. If any relevant patterns were removed (build artifacts, IDE-specific files, language-specific output), this could unintentionally expose previously-ignored files.

The PR body should document this change, or the deletion should be reversed unless it was intentional.


2. ~/.npm-global/bin is not directory-guarded — inconsistency with the new pattern (zsh/.zshrc:78)

# New entry (correct — guarded):
[ -d "$HOME/.local/bin" ] && export PATH="$HOME/.local/bin:$PATH"

# Existing entry (unguarded — inconsistent):
export PATH="$HOME/.npm-global/bin:$PATH"

The ~/.npm-global/bin addition unconditionally adds a directory to PATH regardless of whether it exists. This violates the same principle the ~/.local/bin entry correctly applies. Worth fixing for consistency (and to satisfy the CLAUDE.md principle of graceful degradation). Fix this →


3. Claude alias may shadow ~/.local/bin/claude (zsh/aliases.zsh:89)

[ -x "$HOME/.claude/local/claude" ] && alias claude="$HOME/.claude/local/claude"

The PR adds ~/.local/bin to PATH to fix the "native installation exists but ~/.local/bin is not in your PATH" warning. The native installer places claude in ~/.local/bin. However, if both ~/.claude/local/claude and ~/.local/bin/claude exist, the alias takes precedence and always uses the former. This is probably fine for single-install machines, but worth being aware of.


4. PR scope exceeds description

The PR description says it "Adds $HOME/.local/bin to PATH." But the diff touches 6 files with 96 deletions beyond the PATH change. The commit "Fix safety, security, and portability issues" makes substantial undescribed changes. Reviewers can't effectively audit changes they aren't aware of.


What's correct

  • ~/.local/bin PATH guard ([ -d "$HOME/.local/bin" ]) is correctly implemented using POSIX single brackets — portable across macOS and Linux ✓
  • $HOME used throughout, no hardcoded paths ✓
  • Interactive guards ([[ -o interactive ]]) protect cursor shape echo -ne from running during non-interactive init ✓
  • install.sh is idempotent: safe_link backs up before overwriting, local.zsh and git/local skip creation if already present ✓
  • No credentials or secrets committed ✓
  • All files end with trailing newlines ✓
  • Tests pass (36/36) ✓

Minor

  • zsh/.zshrc has two trailing blank lines after the VS Code block (lines 84–85). One is sufficient.

Recommendation

Before merging:

  1. Explain or restore the 54 removed lines from git/ignore
  2. Guard ~/.npm-global/bin the same way as ~/.local/bin
  3. Optionally: add a test that verifies ~/.local/bin appears in PATH when the directory exists (CLAUDE.md mandates tests for new symlinks/config files; this is a PATH entry so not strictly required, but would be good practice)

@davidkreps
Copy link
Copy Markdown
Owner Author

Closing — branched off wrong base. Will resubmit off main.

@davidkreps davidkreps closed this Feb 23, 2026
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