opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix: improve PATH handling in install script

Open ryanwyler opened this issue 2 weeks ago • 0 comments

Summary

The current installer has issues with adding multiple PATH entries in shell configs in many scenarios and does not follow best practices. After much consideration this enhancement is the least invasive "first step" to a much more standard and robust installer.

This update standardizes the install script's PATH handling to prefer standard conventions and simple checks to avoid duplicate entries. There are many more improvements that can be made but this change is as minimal and safe as possible to solve the immediate problem.

Changes

  • Check if opencode already exists in user PATH before modifying shell configs
  • Prefer symlinking to ~/.local/bin when available (standard user bin, often already in PATH)
  • Consolidate shell case statements (zsh|bash|ash|sh)
  • Add warnings for alternate opencode installations (symlinks pointing elsewhere, custom binaries)

Future Improvements

The following best practices would further improve the install experience and avoid "binary in use" issues during upgrades:

  • Migrate INSTALL_DIR from ~/.opencode/bin to ~/.local/share/opencode/
  • Install binary to $INSTALL_DIR/versions/$VERSION
  • Symlink ~/.local/bin/opencode to versioned binary

ryanwyler avatar Dec 31 '25 02:12 ryanwyler