Repository navigation
fix(nix): use Effect CLI completion flags - #50409
Closed
mindnbytes wants to merge 2 commits into
Closed
mindnbytes wants to merge 2 commits into
mindnbytes wants to merge 2 commits into
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Author
|
|
3 of 6 tasks
jerome-benoit
added a commit
to jerome-benoit/opencode
that referenced
this pull request
Sep 28, 2026
Three independent defects in the v2 Nix packaging, each fatal to
`nix build .#opencode` or `nix build .#opencode-desktop`.
`nix/opencode.nix` generates completions through `opencode completion`, a
subcommand v2 no longer has. The Effect CLI parses it as the optional
`directory` argument and the TUI opens instead, so `installShellCompletion`
gets a zero-size file and the build fails:
Error: ENOENT: no such file or directory, chdir '/build/source/packages/cli' -> 'completion'
ERROR: installShellCompletion: installed shell completion file .../opencode.bash does not exist or has zero size
Completions now come from the Effect-CLI global action flag,
`--completions <bash|zsh|fish|sh>`. Naming the shell directly also drops
the `SHELL=/bin/zsh` coaxing the old yargs-based path needed. `sh` is a
synonym for `bash`, so `--bash` already covers it; fish did not ship
before even though the CLI generates it.
Each shell is staged to a file before installation. A process substitution
does not propagate the generator's exit status, so a failure here would
install a zero-size completion and still pass — which is how the bug above
presented in the first place.
The command name is a build-time define, so `opencode2 --completions` just
reproduces the `opencode` scripts. They are renamed for the alias with
`substitute --replace-fail`, so a future change to the baked-in name breaks
the build instead of quietly shipping a second copy of the opencode one.
`nix/electron.nix` still carries the electron 42.10.1 hashes while
`packages/desktop/package.json` moved to 44.4.3, so the desktop's electron
fetchzip cannot resolve. The hashes are refreshed from the 44.4.3
SHASUMS256.txt; the headers hash is the fetchzip recursive hash, computed
the same way the 42.10.1 one was (reproducing the previous value as a
control). The x86_64-darwin entry is dropped: nixpkgs' electron `tags` has
no such platform and `get` throws for it, so the value was never selected.
`nix/desktop.nix` stages the CLI executable but not the package manifest
next to it, and `packages/desktop/scripts/utils.ts` reads the bundled CLI's
version from that manifest. The desktop build aborts in `scripts/prebuild.ts`:
ENOENT: no such file or directory, open '/build/desktop-cli/cli-linux-x64-baseline/package.json'
The manifest is now written alongside the executable, so the version file
the desktop ships resolves without spawning the binary.
Fixes anomalyco#50408
Co-developed-by: @ReStranger (anomalyco#51406), @mindnbytes (anomalyco#50409)
3 tasks done
jerome-benoit
added a commit
to jerome-benoit/opencode
that referenced
this pull request
Sep 28, 2026
Three independent defects in the v2 Nix packaging, each fatal to
`nix build .#opencode` or `nix build .#opencode-desktop`.
`nix/opencode.nix` generates completions through `opencode completion`, a
subcommand v2 no longer has. The Effect CLI parses it as the optional
`directory` argument and the TUI opens instead, so `installShellCompletion`
gets a zero-size file and the build fails:
Error: ENOENT: no such file or directory, chdir '/build/source/packages/cli' -> 'completion'
ERROR: installShellCompletion: installed shell completion file .../opencode.bash does not exist or has zero size
Completions now come from the Effect-CLI global action flag,
`--completions <bash|zsh|fish|sh>`. Naming the shell directly also drops
the `SHELL=/bin/zsh` coaxing the old yargs-based path needed. `sh` is a
synonym for `bash`, so `--bash` already covers it; fish did not ship
before even though the CLI generates it.
Each shell is staged to a file before installation. A process substitution
does not propagate the generator's exit status, so a failure here would
install a zero-size completion and still pass — which is how the bug above
presented in the first place.
The command name is a build-time define, so `opencode2 --completions` just
reproduces the `opencode` scripts. They are renamed for the alias with
`substitute --replace-fail`, so a future change to the baked-in name breaks
the build instead of quietly shipping a second copy of the opencode one.
`nix/electron.nix` still carries the electron 42.10.1 hashes while
`packages/desktop/package.json` moved to 44.4.3, so the desktop's electron
fetchzip cannot resolve. The hashes are refreshed from the 44.4.3
SHASUMS256.txt; the headers hash is the fetchzip recursive hash, computed
the same way the 42.10.1 one was (reproducing the previous value as a
control). The x86_64-darwin entry is dropped: nixpkgs' electron `tags` has
no such platform and `get` throws for it, so the value was never selected.
`nix/desktop.nix` stages the CLI executable but not the package manifest
next to it, and `packages/desktop/scripts/utils.ts` reads the bundled CLI's
version from that manifest. The desktop build aborts in `scripts/prebuild.ts`:
ENOENT: no such file or directory, open '/build/desktop-cli/cli-linux-x64-baseline/package.json'
The manifest is now written alongside the executable, so the version file
the desktop ships resolves without spawning the binary.
Fixes anomalyco#50408
Co-developed-by: @ReStranger (anomalyco#51406), @mindnbytes (anomalyco#50409)
jerome-benoit
added a commit
to jerome-benoit/opencode
that referenced
this pull request
Sep 28, 2026
Three independent defects in the v2 Nix packaging, each fatal to `nix build .#opencode` or `nix build .#opencode-desktop`. `nix/opencode.nix` generates completions through `opencode completion`, which v2 removed: the Effect CLI parses it as the optional `directory` argument, so the TUI opens instead and `installShellCompletion` gets a zero-size file. It now uses the global `--completions <shell>` flag, stages each shell to a file so a generator failure fails the build, and renames the `opencode2` copies because the command name is a build-time define. Fish ships now; `sh` is a synonym for `bash`. `nix/electron.nix` carries the electron 42.10.1 hashes while `packages/desktop/package.json` moved to 44.4.3, so the desktop's electron fetchzip cannot resolve. Refreshed from the 44.4.3 SHASUMS256.txt; the headers hash recomputed the same way the 42.10.1 one was, reproducing it as a control. The x86_64-darwin entry is dropped, nixpkgs' electron tags have no such platform. `nix/desktop.nix` stages the CLI executable but not the manifest that `packages/desktop/scripts/utils.ts` reads the version from, so `scripts/prebuild.ts` aborts on a missing package.json. Fixes anomalyco#50408 Co-developed-by: @ReStranger (anomalyco#51406), @mindnbytes (anomalyco#50409)
Author
|
Superseded by #51891, which merged the v2 completion fix (including opencode2 and Fish). Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Fixes #50408
Type of change
What does this PR do?
Updates the Nix package to generate completions with Effect CLI's
--completions <shell>flag instead of the removed yargscompletioncommand.The generated command name is compiled as
opencode, so the compatibility alias scripts substituteopencode2before installation.How did you verify your code works?
nix build .#opencode -Lonaarch64-linux--versionbash -nandzsh -nopencode2Screenshots / recordings
N/A
Checklist