opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: add variant support for commands (#7713)

Open koichincom opened this issue 2 weeks ago • 3 comments

What does this PR do?

Fixes #7713 by the following:

  • Adds a variant field to the commands configuration.
  • Variant needs to be specified with the model (throws an error if not)
  • Invalid variant names show a help message and throw an error (no fuzzy search)

How did you verify your code works?

  • Added model and variant fields to the existing packages/opencode/test/config/config.test.ts for config parsing.
  • Performed three manual tests by creating an opencode.json in the root:
    • Valid: model and variant are specified (used a temporary toast to verify the variant change).
    • Without variant: only the model is specified.
    • Invalid variant: an invalid variant name was used.

Consideration

When #7156 or #7140 lands, its model-default variant feature might need to be integrated.

koichincom avatar Jan 12 '26 03:01 koichincom

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.

github-actions[bot] avatar Jan 12 '26 03:01 github-actions[bot]

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

I found related PRs that might be relevant to this variant support implementation:

Related PRs (Not exact duplicates, but related features):

  1. Add default variant config per agent (#7140) - https://github.com/anomalyco/opencode/pull/7140

    • The current PR mentions that when #7140 lands, its model-default variant feature might need to be integrated
  2. feat: add variant support for subagents (#7138) [alt of #7140] (#7156) - https://github.com/anomalyco/opencode/pull/7156

    • Similar variant support but for subagents; also mentioned in the PR as potentially needing integration
  3. feat: Add variant cycle tooltip in session prompt (#7743) - https://github.com/anomalyco/opencode/pull/7743

    • Related variant feature, but focuses on UI tooltip display

These are complementary features rather than direct duplicates. The current PR (#7907) specifically adds variant support for commands, while #7140 and #7156 address variant support for agents/subagents. They may need to be coordinated during integration.

No exact duplicate PRs were found for this specific commands variant implementation.

github-actions[bot] avatar Jan 12 '26 03:01 github-actions[bot]