You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nix: build fails after CLI completion command change #50408
The Nix package on v2 still runs opencode completion in postInstall, but the Effect CLI now exposes completions through --completions <shell>.
completion is parsed as the optional directory argument, so the build consistently fails with:
Error: ENOENT: no such file or directory, chdir '/build/source/packages/cli' -> 'completion'
ERROR: installShellCompletion: installed shell completion file .../share/bash-completion/completions/opencode.bash does not exist or has zero size
Using opencode --completions bash and opencode --completions zsh fixes the build. I tested the complete package build locally on aarch64-linux; the generated Bash and Zsh scripts were nonempty and passed shell syntax checks.
I’ll update the v2 Nix packaging step to use the current --completions <shell> interface instead of the removed completion command. I’ll verify the generated Bash and Zsh completion files are non-empty and pass shell syntax checks, then run the relevant packaging checks before opening a PR.
While putting that together I hit a second problem on the same lines that the original report does not cover: the generated script hardcodes the command name, and that name is a build-time define (OPENCODE_CLI_NAME in packages/cli/script/build.ts), not something argv[0] can change. So opencode2 --completions bash does not produce opencode2 completions — it reproduces the opencode script byte for byte, and installShellCompletion --cmd opencode2 happily writes an identical file under the other name. The alias silently gets no completions.
The fix runs the generator once and renames the output for the alias:
I checked that the blanket replace is safe against the current output: every opencode occurrence in the generated bash, zsh and fish scripts is either the bare command name, a _opencode* helper, the ###-begin-…-completions-### markers, or the ~/.config/…/completions/_opencode path hint. Renaming all of them consistently is what you want for a second command name, and the markers and path hint are not parsed by anything.
Verified on the built package: the two files are no longer identical, and each references only its own name.
Fish is also installed now. The Effect CLI accepts --completions <bash|zsh|fish|sh> and fish was never wired up, though the script generates fine. sh is a synonym for bash — the two outputs are byte-identical — so --bash already covers it.
Credit to @ReStranger in #51406, which was closed unmerged but had both of these; I got the alias wrong on my first pass.
My pull request from the week ago sovled this issue. Just want to make sure you've read the second post is mentioning PR. We just need maintainer attention here, I guess.
Activity
LeoParkerOu commentedon Sep 22, 2026
I’d like to work on this.
I’ll update the v2 Nix packaging step to use the current
--completions <shell>interface instead of the removedcompletioncommand. I’ll verify the generated Bash and Zsh completion files are non-empty and pass shell syntax checks, then run the relevant packaging checks before opening a PR.feat(opencode): switch from the default branch to the upstream v2 branch
fix(nix): make the v2 packages buildable
jerome-benoit commentedon Sep 28, 2026
Landed in #51891.
While putting that together I hit a second problem on the same lines that the original report does not cover: the generated script hardcodes the command name, and that name is a build-time define (
OPENCODE_CLI_NAMEinpackages/cli/script/build.ts), not something argv[0] can change. Soopencode2 --completions bashdoes not produceopencode2completions — it reproduces theopencodescript byte for byte, andinstallShellCompletion --cmd opencode2happily writes an identical file under the other name. The alias silently gets no completions.The fix runs the generator once and renames the output for the alias:
installShellCompletion --cmd opencode2 \ --bash <($out/bin/opencode --completions bash | sed 's/opencode/opencode2/g')I checked that the blanket replace is safe against the current output: every
opencodeoccurrence in the generated bash, zsh and fish scripts is either the bare command name, a_opencode*helper, the###-begin-…-completions-###markers, or the~/.config/…/completions/_opencodepath hint. Renaming all of them consistently is what you want for a second command name, and the markers and path hint are not parsed by anything.Verified on the built package: the two files are no longer identical, and each references only its own name.
Fish is also installed now. The Effect CLI accepts
--completions <bash|zsh|fish|sh>and fish was never wired up, though the script generates fine.shis a synonym forbash— the two outputs are byte-identical — so--bashalready covers it.Credit to @ReStranger in #51406, which was closed unmerged but had both of these; I got the alias wrong on my first pass.
fix(nix): make the v2 packages buildable
fix(nix): make the v2 packages buildable
fix(nix): make the v2 packages buildable
fix(nix): repair three packaging defects on the v2 branch
mindnbytes commentedon Sep 29, 2026
My pull request from the week ago sovled this issue. Just want to make sure you've read the second post is mentioning PR. We just need maintainer attention here, I guess.
fix(nix): repair three packaging defects on the v2 branch
mindnbytes commentedon Oct 3, 2026
Fixed on v2 by #51891, merged October 2. The Nix package now uses the current --completions CLI flag and installs Bash, Zsh, and Fish completions.
ReStranger commentedon Oct 3, 2026
Thank you