anomalyco / anomalyco/opencode
opencode completion fish emits bash/zsh script, not fish syntax
@nexxeln is already working on this.
Since Aug 8, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
opencode completion fish does not emit fish syntax. It prints the yargs bash template, or the zsh template when $SHELL contains "zsh". Neither is valid fish, so sourcing the output fails immediately:
$ opencode completion fish | source
(line 12): Unsupported use of '='. In fish, please use 'set cur_word "${COMP_WORDS[COMP_CWORD]}"'.
With $SHELL pointing at zsh, the failure is the zsh variant:
(line 14): Unsupported use of '='. In fish, please use 'set reply ($(COMP_CWORD="$((CURRENT-1))" ... opencode --get-yargs-completions ...))'.
The shell positional argument is ignored when picking the template. opencode completion zsh also prints the bash template unless $SHELL happens to contain "zsh".
This is easy to hit by accident. fish ships a built-in completion for oc (the OpenShift CLI name) that runs oc completion fish | source. Alias oc to opencode and every oc at the prompt triggers the parse error.
Root cause is upstream yargs: this repo pins yargs@18.0.0, which only has bash and zsh templates in lib/completion-templates.ts. generateCompletionScript() has no fish branch. yargs main has since added completionFishTemplate, but no release contains it yet. Earlier fish completion PRs (#23263, #26193, #30168, #34197) were all closed without merging, and #26193 never got a maintainer review.
Expected output, matching the yargs main template:
complete -f -c opencode -a '(opencode --get-yargs-completions (commandline -o)[2..-1])'
Plugins
N/A
OpenCode version
1.18.15
Steps to reproduce
- Run
opencode completion fishand look at the output. It is a bash script (COMP_WORDS, mapfile, compgen), not fish. - In fish, run
opencode completion fish | source. - fish reports "Unsupported use of '='".
Screenshot and/or share link
N/A, if default shell is zsh, and use fish, you could reproduce it stably.
Operating System
macOS 26 (arm64)
Terminal
Ghostty with fish 4.8.1
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.