Skip to content

Conversation

@koichincom
Copy link
Contributor

@koichincom koichincom commented Jan 12, 2026

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.

Copilot AI review requested due to automatic review settings January 12, 2026 03:09
@github-actions
Copy link
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.

@github-actions
Copy link
Contributor

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 (Add default variant config per agent #7140) - Add default variant config per agent #7140

  2. feat: add variant support for subagents (feat: Support default variant configuration per agent #7138) [alt of Add default variant config per agent #7140] (feat: add variant support for subagents (#7138) [alt of #7140] #7156) - feat: add variant support for subagents (#7138) [alt of #7140] #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 (feat: Add variant cycle tooltip in session prompt #7743) - feat: Add variant cycle tooltip in session prompt #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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements variant support for commands as requested in issue #7713. Users can now specify a variant field in command configurations to set a default variant for specific commands, enabling commands to have baked-in reasoning effort levels without requiring manual user selection.

Changes:

  • Added optional variant field to command configuration schema
  • Implemented validation to ensure variant is only specified with a model
  • Added error handling with helpful messages for invalid variant names

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/opencode/src/config/config.ts Added variant field to Command schema as optional string
packages/opencode/src/command/index.ts Added variant to Command.Info type and parsed it from config
packages/opencode/src/session/prompt.ts Implemented validation for variant (requires model, checks validity) and passes variant to prompt execution
packages/opencode/test/config/config.test.ts Added test case to verify variant field is correctly parsed from config

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Commands Model Variant Specification

1 participant