Skip to content

feat(fish): prioritize ~/.local/bin in PATH - #264

Merged
shunkakinoki merged 3 commits into
mainfrom
shunkakinoki/local-bin-first
Oct 5, 2025
Merged

feat(fish): prioritize ~/.local/bin in PATH#264
shunkakinoki merged 3 commits into
mainfrom
shunkakinoki/local-bin-first

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Oct 4, 2025

Copy link
Copy Markdown
Owner

Summary

  • Add ~/.local/bin as the first entry in Fish shell PATH configuration
  • Ensures standalone binaries take precedence over wrapper scripts from package managers

Problem

The open-composer command was failing because:

  1. ~/.bun/bin/open-composer (wrapper script) appears first in PATH
  2. The wrapper fails to locate node_modules binary
  3. ~/.local/bin/open-composer (standalone binary) works correctly but appears later

Solution

Prioritize ~/.local/bin in both loginShellInit and interactiveShellInit by adding it before ~/.bun/bin in the PATH.

Test plan

  • Apply configuration with make switch
  • Verify which open-composer returns ~/.local/bin/open-composer
  • Test open-composer --version runs successfully

🤖 Generated with Claude Code


Summary by cubic

Prioritized ~/.local/bin at the front of PATH in Fish login and interactive shells so standalone binaries are used before wrapper scripts. Fixes open-composer resolving to a failing Bun wrapper by selecting ~/.local/bin/open-composer.

  • Bug Fixes

    • Prepend ~/.local/bin via fish_add_path -p in loginShellInit and interactiveShellInit.
    • Ensures tools like open-composer resolve to ~/.local/bin first.
  • Migration

    • Run make switch.
    • which open-composer should return ~/.local/bin/open-composer.

Add ~/.local/bin as the first entry in Fish shell PATH configuration to
ensure standalone binaries installed there take precedence over wrapper
scripts from other package managers like Bun.

This resolves conflicts where Bun-installed wrapper scripts in
~/.bun/bin may fail to locate their node_modules dependencies, while
the standalone binary in ~/.local/bin works correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 4, 2025 23:38
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Fish shell configuration by prioritizing the ~/.local/bin directory in the system's PATH. This ensures that user-installed standalone binaries are discovered and executed before any potentially conflicting wrapper scripts from package managers, thereby improving command reliability and preventing execution issues caused by incorrect binary resolution.

Highlights

  • PATH Prioritization: The ~/.local/bin directory has been added as the first entry in the Fish shell's PATH configuration.
  • Problem Resolution: This change resolves an issue where wrapper scripts from package managers (e.g., ~/.bun/bin) were inadvertently taking precedence over standalone binaries located in ~/.local/bin, causing execution failures for certain commands like open-composer.
  • Configuration Update: The fish_add_path -p ~/.local/bin command was added to both loginShellInit and interactiveShellInit sections within the Fish shell configuration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@shunkakinoki
shunkakinoki enabled auto-merge (squash) October 4, 2025 23:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a command resolution issue by prioritizing ~/.local/bin in the Fish shell PATH configuration. The change ensures standalone binaries take precedence over wrapper scripts from package managers like Bun.

  • Add ~/.local/bin as the first PATH entry in both login and interactive shell initialization
  • Resolves issue where open-composer wrapper script fails while standalone binary works correctly

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +9 to 10
fish_add_path -p ~/.local/bin
fish_add_path -p ~/.bun/bin

Copilot AI Oct 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same PATH configuration is duplicated between loginShellInit and interactiveShellInit. Consider extracting this into a shared variable or function to reduce duplication and ensure consistency.

Copilot uses AI. Check for mistakes.
@coderabbitai

coderabbitai Bot commented Oct 4, 2025

Copy link
Copy Markdown

Warning

Rate limit exceeded

@shunkakinoki has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7db0887 and 291354b.

📒 Files selected for processing (1)
  • home-manager/modules/npm-globals/default.nix (1 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Automatically adds the user’s local bin directory to PATH in Fish for both login and interactive sessions, ensuring user-installed binaries are available without manual setup.
    • Improves consistency across terminal sessions so commands placed in the local bin are recognized immediately after installation, reducing environment-related issues and setup steps.

Walkthrough

Added fish shell PATH entries for ~/.local/bin in both loginShellInit and interactiveShellInit within the Home Manager fish configuration.

Changes

Cohort / File(s) Summary of Changes
Fish shell configuration
home-manager/programs/fish/default.nix
Added fish_add_path -p ~/.local/bin to loginShellInit and interactiveShellInit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~6 minutes

Poem

A hop, a skip, a PATH made clean,
~/.local/bin now on the scene.
Two shells aligned, both night and noon,
My whiskers twitch—updates soon!
With tiny paws I nudge the way,
So commands can dance without delay. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately describes the key change of prioritizing ~/.local/bin in Fish shell PATH and matches the modifications made in both loginShellInit and interactiveShellInit.
Description Check ✅ Passed The pull request description clearly outlines the context, problem with the existing PATH order, the specific changes made to fish configuration, and a test plan, all of which directly relate to the changes in this PR.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly prioritizes ~/.local/bin in the Fish shell's PATH to resolve an issue with command precedence. The change is applied to both login and interactive shell initializations. However, this approach introduces code duplication. My review includes a suggestion to refactor the configuration to remove this duplication, which will improve the long-term maintainability of the file.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines 8 to 12
loginShellInit = ''
fish_add_path -p ~/.local/bin
fish_add_path -p ~/.bun/bin
fish_add_path -p ~/.nix-profile/bin
fish_add_path -p /nix/var/nix/profiles/default/bin

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge fish_add_path order keeps ~/.local/bin lowest priority

fish_add_path -p prepends each path to the front of $PATH, so later calls have higher precedence than earlier ones. Because this block ends with /etc/profiles/per-user/... and ~/.bun/bin, inserting fish_add_path -p ~/.local/bin at the top still leaves ~/.local/bin behind ~/.bun/bin in the final PATH. The change therefore does not fix the stated issue—open-composer will still resolve to the bun wrapper. To actually prioritize ~/.local/bin, it needs to be the last -p call (or the others should append instead).

Useful? React with 👍 / 👎.

shunkakinoki and others added 2 commits October 5, 2025 08:40
Update home.sessionPath to include ~/.local/bin before ~/.bun/bin.
This ensures the session-level PATH is correctly ordered, as
sessionPath takes precedence over shell-specific PATH modifications.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update the comment in home.sessionPath to clarify that local and bun bins are added to the PATH without specifying prioritization. This enhances readability while maintaining the existing functionality.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Copilot AI review requested due to automatic review settings October 4, 2025 23:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@shunkakinoki
shunkakinoki merged commit 4274c3f into main Oct 5, 2025
18 checks passed
@shunkakinoki
shunkakinoki deleted the shunkakinoki/local-bin-first branch October 5, 2025 00:02
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.

2 participants