Summary
The Zsh script generated by opencode2 --completions zsh defines both the optional directory and command as positional argument 1. Pressing Tab after opencode2 fails instead of showing completions.
Environment
- opencode version:
opencode2 v0.0.0-next-17276
- OS: Windows 11 with WSL2; Linux 6.18.33.2-microsoft-standard-WSL2 x86_64
- Terminal: Windows Terminal;
TERM=xterm-256color; TERM_PROGRAM and COLORTERM unset
- Shell:
/usr/bin/zsh, Zsh 5.9.2
- Install/channel: next/beta, installed at
~/.bun/bin/opencode2
- Active plugins:
codex-limits.ts, git-ai.ts
Reproduction
- Run
mkdir -p ~/.zsh/completions && opencode2 --completions zsh > ~/.zsh/completions/_opencode2.
- Add
fpath=("$HOME/.zsh/completions" $fpath), autoload -Uz compinit, and compinit to .zshrc.
- Start a fresh Zsh shell.
- Type
opencode2 and press Tab.
Expected Behavior
Zsh displays available OpenCode subcommands and options.
Actual Behavior
Completion fails consistently with:
_arguments:comparguments:327: doubled argument definition: 1:command:->command
The generated root specification contains:
':Directory to start OpenCode in:'
'1:command:->command'
'*::arg:->args'
The unnumbered directory specification occupies positional argument 1 and conflicts with the explicit command definition.
Additional Context
Removing ':Directory to start OpenCode in:' from the generated file makes completion work. Regenerating the file reintroduces the issue. This occurs with the script emitted directly by opencode2 --completions zsh; active plugins do not appear involved.
Summary
The Zsh script generated by
opencode2 --completions zshdefines both the optional directory and command as positional argument 1. Pressing Tab afteropencode2fails instead of showing completions.Environment
opencode2 v0.0.0-next-17276TERM=xterm-256color;TERM_PROGRAMandCOLORTERMunset/usr/bin/zsh, Zsh 5.9.2~/.bun/bin/opencode2codex-limits.ts,git-ai.tsReproduction
mkdir -p ~/.zsh/completions && opencode2 --completions zsh > ~/.zsh/completions/_opencode2.fpath=("$HOME/.zsh/completions" $fpath),autoload -Uz compinit, andcompinitto.zshrc.opencode2and press Tab.Expected Behavior
Zsh displays available OpenCode subcommands and options.
Actual Behavior
Completion fails consistently with:
The generated root specification contains:
The unnumbered directory specification occupies positional argument 1 and conflicts with the explicit command definition.
Additional Context
Removing
':Directory to start OpenCode in:'from the generated file makes completion work. Regenerating the file reintroduces the issue. This occurs with the script emitted directly byopencode2 --completions zsh; active plugins do not appear involved.