-
Notifications
You must be signed in to change notification settings - Fork 5.4k
feat: add variant support for commands (#7713) #7907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
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):
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. |
There was a problem hiding this 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
variantfield 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.
There was a problem hiding this 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.
What does this PR do?
Fixes #7713 by the following:
How did you verify your code works?
packages/opencode/test/config/config.test.tsfor config parsing.opencode.jsonin the root:Consideration
When #7156 or #7140 lands, its model-default variant feature might need to be integrated.