Skip to content

fix(cli): add fish shell completion support - #41336

Closed
limjonathan wants to merge 1 commit into
anomalyco:devfrom
limjonathan:fix/fish-completion
Closed

fix(cli): add fish shell completion support#41336
limjonathan wants to merge 1 commit into
anomalyco:devfrom
limjonathan:fix/fish-completion

Conversation

@limjonathan

@limjonathan limjonathan commented Aug 8, 2026

Copy link
Copy Markdown

Description

Fixes issue #41232 where opencode completion fish incorrectly emitted bash/zsh completion scripts instead of proper fish syntax.

Changes

  • Added new packages/opencode/src/cli/completion.ts with completion templates for bash, zsh, and fish
  • Modified packages/opencode/src/index.ts to add a custom completion command that:
    • Accepts a positional shell argument (bash, zsh, fish)
    • Supports flags --bash/-b, --zsh/-z, --fish/-f
    • Falls back to $SHELL environment variable for auto-detection

Verification

  • opencode completion fish → outputs fish completion script ✅
  • opencode completion bash → outputs bash completion script ✅
  • opencode completion zsh → outputs zsh completion script ✅
  • opencode completion --fish → outputs fish completion script ✅
  • SHELL=/bin/fish opencode completion → auto-detects fish ✅
  • SHELL=/bin/zsh opencode completion → auto-detects zsh ✅
  • SHELL=/bin/bash opencode completion → auto-detects bash ✅
  • TypeScript typecheck passes ✅

Plugins

N/A

OpenCode version

Current dev branch

Steps to reproduce

  1. Run opencode completion fish and look at the output. It is now a proper fish completion script.
  2. In fish, run opencode completion fish | source.
  3. fish no longer reports "Unsupported use of '='".

Screenshot and/or share link

N/A

Operating System

Linux (tested on Arch Linux)

Terminal

Any terminal supporting fish shell

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title fix(#41232): add fish shell completion support doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential duplicate found:

This PR appears to be directly related to the current PR #41336. Both are addressing the same issue (#41232) and both involve adding/fixing shell completion support with multiple shell types (bash, zsh, fish). PR #41235 also adds shell argument handling to the completion command, which overlaps with the functionality in the current PR. You should check if #41235 is still open and whether it needs to be merged first or if this PR should be rebased on it.

@limjonathan limjonathan changed the title fix(#41232): add fish shell completion support fix(cli): add fish shell completion support Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@limjonathan

Copy link
Copy Markdown
Author

Thanks for the heads-up! I see PR #41235 already addresses this issue with a more complete implementation including tests. I'll close this PR in favor of that one since it's more complete and already has test coverage.

@limjonathan

Copy link
Copy Markdown
Author

Closing in favor of PR #41235 which has a more complete implementation with tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant