[FEATURE]: Add standard CLI flags to install script (--help, --version, --no-modify-path) #3716

Closed
opened 2026-02-16 17:41:12 -05:00 by yindo · 3 comments
Owner

Originally created by @anntnzrb on GitHub (Dec 21, 2025).

Originally assigned to: @rekram1-node on GitHub.

Summary

The install script (curl -fsSL https://opencode.ai/install | bash) currently lacks standard CLI flags that users expect from modern install scripts. This proposal adds basic flags following conventions established by widely-used installers.

Problem

  • No --help - Users can't discover available options without reading the source code
  • No --version flag - The VERSION env var works, but flags are more discoverable and ergonomic
  • No --no-modify-path - The script modifies shell config files (.zshrc, .bashrc, etc.) without an opt-out, which causes issues on:
    • NixOS with home-manager (config files are read-only symlinks to /nix/store/...)
    • Immutable distros (Fedora Silverblue, etc.)
    • Declarative dotfile managers (chezmoi, yadm, GNU Stow)
  • Unknown flags are silently ignored - Typos like --no-modify instead of --no-modify-path fail silently

Proposed Flags

Flag Description
-h, --help Display usage information
-v, --version <ver> Install a specific version
--no-modify-path Don't modify shell config files

Additionally, unknown arguments should produce a warning so users are aware of typos.

Example Usage

# Show available options
curl -fsSL https://opencode.ai/install | bash -s -- --help

# Install a specific version
curl -fsSL https://opencode.ai/install | bash -s -- --version 1.0.180

# Install without modifying shell configs (for Nix users, etc.)
curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path
Research: How other installers handle this

I surveyed several popular and battle-tested install scripts to understand common conventions:

Rustup (Rust toolchain installer)

The gold standard for install scripts. Provides comprehensive flags:

Options:
  -v, --verbose           Enable verbose output
  -q, --quiet             Disable progress output
  -y                      Disable confirmation prompt
      --no-modify-path    Don't configure the PATH environment variable
  -h, --help              Print help
  -V, --version           Print version

Notable: --no-modify-path is exactly what we need for NixOS/immutable systems.

Determinate Nix Installer

A modern installer that downloads a binary and passes args through. Supports:

--no-confirm              Accept defaults, non-interactive mode

The script itself is minimal - it downloads the real installer binary which has extensive options.

Homebrew

Simple and focused:

Usage: [NONINTERACTIVE=1] [CI=1] install.sh [options]
    -h, --help       Display this message.

Also supports NONINTERACTIVE and CI environment variables for automated installs.

Starship (shell prompt)

Feature-rich installer with good UX:

Options:
  -V, --verbose             Enable verbose output
  -f, -y, --force, --yes    Skip the confirmation prompt
  -p, --platform            Override the platform
  -b, --bin-dir             Override the bin installation directory
  -v, --version             Install a specific version
  -h, --help                Display this help message

Notable: Uses -v, --version to specify which version to install (not print version).

ghcup (Haskell toolchain)

Uses environment variables for configuration:

BOOTSTRAP_HASKELL_NONINTERACTIVE  - noninteractive installation
BOOTSTRAP_HASKELL_VERBOSE         - more verbose installation
BOOTSTRAP_HASKELL_GHC_VERSION     - specific GHC version to install
BOOTSTRAP_HASKELL_ADJUST_BASHRC   - whether to adjust PATH in bashrc

Summary

Feature Rustup Homebrew Starship Determinate ghcup
--help (env vars)
--version (install specific) (env var)
--no-modify-path (env var)
--quiet
Non-interactive mode (-y) (env var) (-y) (env var)

Additional Notes

  • All changes are backward compatible - existing usage continues to work
  • Currently "no config file found" exits with an error - this could be changed to a warning, allowing the install to succeed regardless
  • The VERSION environment variable can remain as an alternative to --version
Originally created by @anntnzrb on GitHub (Dec 21, 2025). Originally assigned to: @rekram1-node on GitHub. ### Summary The install script (`curl -fsSL https://opencode.ai/install | bash`) currently lacks standard CLI flags that users expect from modern install scripts. This proposal adds basic flags following conventions established by widely-used installers. ### Problem - **No `--help`** - Users can't discover available options without reading the source code - **No `--version` flag** - The `VERSION` env var works, but flags are more discoverable and ergonomic - **No `--no-modify-path`** - The script modifies shell config files (`.zshrc`, `.bashrc`, etc.) without an opt-out, which causes issues on: - NixOS with home-manager (config files are read-only symlinks to `/nix/store/...`) - Immutable distros (Fedora Silverblue, etc.) - Declarative dotfile managers (chezmoi, yadm, GNU Stow) - **Unknown flags are silently ignored** - Typos like `--no-modify` instead of `--no-modify-path` fail silently ### Proposed Flags | Flag | Description | |------|-------------| | `-h`, `--help` | Display usage information | | `-v`, `--version <ver>` | Install a specific version | | `--no-modify-path` | Don't modify shell config files | Additionally, unknown arguments should produce a warning so users are aware of typos. ### Example Usage ```bash # Show available options curl -fsSL https://opencode.ai/install | bash -s -- --help # Install a specific version curl -fsSL https://opencode.ai/install | bash -s -- --version 1.0.180 # Install without modifying shell configs (for Nix users, etc.) curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path ``` <details> <summary><strong>Research: How other installers handle this</strong></summary> I surveyed several popular and battle-tested install scripts to understand common conventions: #### [Rustup](https://sh.rustup.rs) (Rust toolchain installer) The gold standard for install scripts. Provides comprehensive flags: ``` Options: -v, --verbose Enable verbose output -q, --quiet Disable progress output -y Disable confirmation prompt --no-modify-path Don't configure the PATH environment variable -h, --help Print help -V, --version Print version ``` Notable: `--no-modify-path` is exactly what we need for NixOS/immutable systems. #### [Determinate Nix Installer](https://install.determinate.systems/nix) A modern installer that downloads a binary and passes args through. Supports: ``` --no-confirm Accept defaults, non-interactive mode ``` The script itself is minimal - it downloads the real installer binary which has extensive options. #### [Homebrew](https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) Simple and focused: ``` Usage: [NONINTERACTIVE=1] [CI=1] install.sh [options] -h, --help Display this message. ``` Also supports `NONINTERACTIVE` and `CI` environment variables for automated installs. #### [Starship](https://starship.rs/install.sh) (shell prompt) Feature-rich installer with good UX: ``` Options: -V, --verbose Enable verbose output -f, -y, --force, --yes Skip the confirmation prompt -p, --platform Override the platform -b, --bin-dir Override the bin installation directory -v, --version Install a specific version -h, --help Display this help message ``` Notable: Uses `-v, --version` to specify which version to install (not print version). #### [ghcup](https://www.haskell.org/ghcup/) (Haskell toolchain) Uses environment variables for configuration: ``` BOOTSTRAP_HASKELL_NONINTERACTIVE - noninteractive installation BOOTSTRAP_HASKELL_VERBOSE - more verbose installation BOOTSTRAP_HASKELL_GHC_VERSION - specific GHC version to install BOOTSTRAP_HASKELL_ADJUST_BASHRC - whether to adjust PATH in bashrc ``` #### Summary | Feature | Rustup | Homebrew | Starship | Determinate | ghcup | |---------|--------|----------|----------|-------------|-------| | `--help` | ✅ | ✅ | ✅ | ✅ | ❌ (env vars) | | `--version` (install specific) | ❌ | ❌ | ✅ | ❌ | ✅ (env var) | | `--no-modify-path` | ✅ | ❌ | ❌ | ❌ | ✅ (env var) | | `--quiet` | ✅ | ❌ | ❌ | ❌ | ❌ | | Non-interactive mode | ✅ (`-y`) | ✅ (env var) | ✅ (`-y`) | ✅ | ✅ (env var) | </details> ### Additional Notes - All changes are backward compatible - existing usage continues to work - Currently "no config file found" exits with an error - this could be changed to a warning, allowing the install to succeed regardless - The `VERSION` environment variable can remain as an alternative to `--version`
yindo closed this issue 2026-02-16 17:41:12 -05:00
Author
Owner

@anntnzrb commented on GitHub (Dec 21, 2025):

I've opened a PR implementing these flags: #5885

@anntnzrb commented on GitHub (Dec 21, 2025): I've opened a PR implementing these flags: #5885
Author
Owner

@github-actions[bot] commented on GitHub (Dec 21, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3540: make opencode work w/ NixOS - This issue directly relates to the proposed install script flags, as NixOS users with home-manager have read-only symlinked config files that should not be modified by the installer.

Feel free to ignore if this addresses a different use case.

@github-actions[bot] commented on GitHub (Dec 21, 2025): This issue might be a duplicate of existing issues. Please check: - #3540: make opencode work w/ NixOS - This issue directly relates to the proposed install script flags, as NixOS users with home-manager have read-only symlinked config files that should not be modified by the installer. Feel free to ignore if this addresses a different use case.
Author
Owner

@anntnzrb commented on GitHub (Dec 21, 2025):

Thanks for the check! #3540 is a different issue - it's about NixOS binary compatibility (dynamic linking). This issue is specifically about adding CLI flags to the install script itself. The --no-modify-path flag here helps NixOS users who use home-manager (read-only shell configs), but doesn't address the binary linking problem in #3540.

@anntnzrb commented on GitHub (Dec 21, 2025): Thanks for the check! #3540 is a different issue - it's about NixOS binary compatibility (dynamic linking). This issue is specifically about adding CLI flags to the install script itself. The `--no-modify-path` flag here helps NixOS users who use home-manager (read-only shell configs), but doesn't address the binary linking problem in #3540.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3716