Skip to content

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

Closed

Description

@anntnzrb

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

Activity

  1. anntnzrb commented on Dec 21, 2025

    @anntnzrb
    ContributorAuthor

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

  2. github-actions commented on Dec 21, 2025

    @github-actions
    Contributor

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

    • make opencode work w/ NixOS #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.

  3. anntnzrb commented on Dec 21, 2025

    @anntnzrb
    ContributorAuthor

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions