anomalyco / anomalyco/opencode

opencode completion fish emits bash/zsh script, not fish syntax

Open
#41,232 1 comment 0 reactions 1 assignee View on GitHub

@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
  1. Run opencode completion fish and look at the output. It is a bash script (COMP_WORDS, mapfile, compgen), not fish.
  2. In fish, run opencode completion fish | source.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.