anomalyco / anomalyco/opencode
README documents an install-dir override chain (OPENCODE_INSTALL_DIR / XDG_BIN_DIR) that the installer does not implement
@neriousy is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
README.md documents an installation-directory override chain
($OPENCODE_INSTALL_DIR → $XDG_BIN_DIR → $HOME/bin → $HOME/.opencode/bin), but the
install script implements none of it. Neither variable appears anywhere in the script, and
the install directory is hardcoded.
Evidence
install line 68, immediately after the argument loop closes:
INSTALL_DIR=$HOME/.opencode/bin
Unconditional, with no preceding branch. Searching the script for either documented variable
returns nothing:
$ grep -c 'OPENCODE_INSTALL_DIR\|XDG_BIN_DIR' install
0
README.md lines 89–97 document them, with runnable examples:
1. `$OPENCODE_INSTALL_DIR` - Custom installation directory
2. `$XDG_BIN_DIR` - XDG Base Directory Specification compliant path
...
OPENCODE_INSTALL_DIR=/usr/local/bin curl -fsSL https://opencode.ai/install | bash
XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash
Impact
Both README examples fail silently. A user running
OPENCODE_INSTALL_DIR=/usr/local/bin curl -fsSL https://opencode.ai/install | bash
gets the binary in ~/.opencode/bin with no warning that the override was ignored. This is
particularly awkward for XDG users and for automated provisioning that expects the binary on
a known path.
Secondary effect on downstream installers
Because the script installs only to ~/.opencode/bin and creates no symlink elsewhere,
tooling that probes conventional directories will not find opencode and may reinstall it
on every run. (Seen concretely in ACFS, whose binary_installed "opencode" guard checks a
fixed directory list that does not include ~/.opencode/bin.)
Suggested fix
Either implement the chain the README describes:
INSTALL_DIR="${OPENCODE_INSTALL_DIR:-${XDG_BIN_DIR:-$HOME/.opencode/bin}}"
or remove lines 89–97 from README.md so the documentation matches the script.
Found while writing third-party documentation that describes installing opencode; verified
against the vendored checkout at the current dev tip. Happy to open a PR either way.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.