Skip to content

LLM-1459: auto-append ~/.local/bin to PATH on install#173

Open
kodburn wants to merge 1 commit intomasterfrom
llm-1459-fix-local-bin-install
Open

LLM-1459: auto-append ~/.local/bin to PATH on install#173
kodburn wants to merge 1 commit intomasterfrom
llm-1459-fix-local-bin-install

Conversation

@kodburn
Copy link
Copy Markdown

@kodburn kodburn commented May 7, 2026

When installing to ~/.local/bin, the script previously only printed instructions for the user to manually add the directory to their PATH. This PR makes the installer do it automatically - writing the export line to ~/.zshrc or
~/.bashrc/.bash_profile with a # Kimchi CLI comment. The change is skipped if the directory is already on $PATH or the comment is already present.
Screenshot 2026-05-07 at 21 32 46


Kimchi Summary

What changed

The install.sh script now automatically appends a PATH export to the user's shell rc file (e.g., ~/.zshrc, ~/.bashrc) when it installs kimchi to a directory that is not on the current PATH. It also guards against duplicate entries across repeated installs.

Why

Previously the script only printed a manual command for the user to copy and paste. Automating the edit reduces friction during first-time setup and makes re-installations safer.

Key changes

  • scripts/install.sh: Renamed internal flag from NEEDS_PATH_HINT to NEEDS_PATH_SETUP.
  • scripts/install.sh: Added path_already_configured() helper to check whether the install directory is already on PATH or the rc file contains the # Kimchi CLI marker.
  • scripts/install.sh: Added add_to_path() helper to idempotently append the export PATH line to the rc file.
  • scripts/install.sh: For zsh and bash, replaced printed manual instructions with direct rc-file modification via add_to_path(); fish and unknown shells continue to show manual instructions.

Impact

  • The installer now modifies user dotfiles. It will not create duplicate entries because it checks for the # Kimchi CLI marker.
  • Users must still restart their shell or source their rc file for the change to take effect in the current session.

@kimchi-review
Copy link
Copy Markdown

kimchi-review Bot commented May 7, 2026

Kimchi Code Review

Property Value
Commit 78b4801
Author @kodburn
Files changed 0
Review status Completed
Comments 5 (2 info, 3 warning)
Duration 247s

Summary

📊 Review Score: 72/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 2/5 (1 = trivial, 5 = very complex)

🧪 Tests: no — No tests were added or modified alongside the install script changes.

📝 Found 5 issue(s). See inline comments for details.

What to expect

Kimchi will analyze the changes in this pull request and post:

  • A summary of the overall changes
  • Inline comments on specific lines with findings categorized by issue type

The review typically completes within a few minutes. This comment will be updated once the review is ready.

Interact with Kimchi
  • @kimchi review — re-trigger a full review on the latest commit
  • @kimchi summary — regenerate the PR summary
  • @kimchi ignore — skip this PR (no review will be posted)
  • Reply to any inline comment to ask follow-up questions or request clarification
Configuration

Reviews are configured by your organization admin.
Review instructions, excluded directories, and severity thresholds can be adjusted per repository in the Kimchi dashboard.


Powered by Kimchi — AI-powered code review by CAST AI

@kodburn kodburn changed the title LLM-1459: auto-append ~/.local/bin to PATH in shell config LLM-1459: auto-append ~/.local/bin to PATH on install May 7, 2026
Copy link
Copy Markdown

@kimchi-review kimchi-review Bot left a comment

Choose a reason for hiding this comment

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

📊 Review Score: 72/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 2/5 (1 = trivial, 5 = very complex)

🧪 Tests: no — No tests were added or modified alongside the install script changes.

📝 Found 5 issue(s). See inline comments for details.

Comment thread scripts/install.sh
echo -e "${YELLOW}Note: ${INSTALL_DIR} may not be on your PATH.${NC}"
echo -e "${YELLOW}Note: ${dir} is not on your PATH.${NC}"
printf '\n# Kimchi CLI\nexport PATH="%s:$PATH"\n' "$dir" >> "$rc"
echo -e "${GREEN}✓ Added ${dir} to PATH in ${rc}${NC}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️🐛 Bug

The printf call writes $dir into the user's rc file inside double quotes without escaping embedded " characters. If KIMCHI_INSTALL_DIR or $HOME contains double quotes, the generated export PATH=... line will contain malformed shell syntax, which can cause shell startup failures or unexpected command execution when the rc file is sourced.

💡 Suggestion: Use printf '%q' to safely quote $dir when generating the rc file line, for example: printf '\n# Kimchi CLI\nexport PATH='%q':$PATH\n' "$dir".

Comment thread scripts/install.sh
esac
[ -f "$rc" ] || return 1
grep -qF "# Kimchi CLI" "$rc" && return 0
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️🐛 Bug

path_already_configured returns 0 when it finds the generic marker # Kimchi CLI in the rc file, regardless of which directory was previously configured. If a user reinstalls kimchi to a different directory, the old marker prevents the new $INSTALL_DIR from being added to PATH.

💡 Suggestion: Make the marker specific to the directory, e.g., write # Kimchi CLI: $dir and grep for that exact line, or grep for the specific export PATH line containing the target directory.

Comment thread scripts/install.sh
echo -e "${YELLOW}Note: ${INSTALL_DIR} may not be on your PATH.${NC}"
echo -e "${YELLOW}Note: ${dir} is not on your PATH.${NC}"
printf '\n# Kimchi CLI\nexport PATH="%s:$PATH"\n' "$dir" >> "$rc"
echo -e "${GREEN}✓ Added ${dir} to PATH in ${rc}${NC}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️⚠️ Error Handling

The printf ... >> "$rc" append operation is not checked for failure. If the rc file becomes unwritable or the disk is full, the script will still print a green success message claiming the file was updated.

💡 Suggestion: Check the append result, for example: printf '...' >> "$rc" || { echo "Failed to update $rc" >&2; exit 1; }.

Comment thread scripts/install.sh
# Returns 0 if the install dir is already on PATH or present in an active
# (non-commented) line in the rc file, or if we already wrote our marker.
path_already_configured() {
local rc="$1" dir="$2"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ℹ️🔧 Maintainability

path_already_configured relies on the implicit return value of grep -qF. If a later maintainer adds a command after the grep, the function's return value would silently change, breaking callers.

💡 Suggestion: Add an explicit return 1 as the last statement in path_already_configured so the fallback behavior is clear and robust.

Comment thread scripts/install.sh
local rc="$1" dir="$2"
case ":${PATH}:" in
*":${dir}:"*) return 0 ;;
esac
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ℹ️🐛 Bug

In the case pattern *":${dir}:"*, glob metacharacters in $dir (such as *, ?, or [) are interpreted as pattern syntax, which can cause the PATH-containment check to return false negatives for unusual paths.

💡 Suggestion: Iterate over PATH entries exactly instead of using a case glob, for example with a for loop using IFS=':' to check each path element for an exact match.

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