[FEATURE]: Add 'selected' property to question tool options for pre-selection #8853

Open
opened 2026-02-16 18:11:01 -05:00 by yindo · 1 comment
Owner

Originally created by @stevesan79 on GitHub (Feb 8, 2026).

Originally assigned to: @thdxr on GitHub.

Problem
When using the question tool with multiple: true, there's no way to pre-select certain options as defaults. Users must manually select all desired options even when some should logically be pre-selected.

Use Cases

  1. File Selection: When asking which files to include in an operation, files that were previously selected or match certain criteria should be pre-selected
  2. Configuration Updates: When updating settings, current/existing values should be pre-selected so users only deselect what they want to remove
  3. Feature Toggles: When enabling features, commonly-used or recommended options should be pre-selected

Current Behavior
Option A (recommended) - NOT selected
Option B (recommended) - NOT selected
Option C - NOT selected
Option D - NOT selected
User must manually select each item, even obvious defaults.

Proposed Solution

Add an optional selected boolean property to question options:

{
  "questions": [{
    "header": "Select Options",
    "question": "Choose which options to include:",
    "multiple": true,
    "options": [
      { "label": "Option A", "description": "Recommended", "selected": true },
      { "label": "Option B", "description": "Recommended", "selected": true },
      { "label": "Option C", "description": "Optional" },
      { "label": "Option D", "description": "Advanced" }
    ]
  }]
}

Expected Behavior After Implementation
☑ Option A (recommended) - Pre-selected
☑ Option B (recommended) - Pre-selected
☐ Option C - Not selected (user can add)
☐ Option D - Not selected (user can add)
User only needs to adjust what they want to change.

Benefits

  • Better UX: Users see sensible defaults, only adjust what they need
  • Common pattern: Standard behavior in HTML checkboxes, form libraries, CLI tools like fzf
  • Backward compatible: selected is optional, defaults to false
  • Enables smarter workflows: AI skills can suggest intelligent defaults based on context

Environment

  • OpenCode version: 1.1.53
  • Use case: AI skills with multi-select prompts
Originally created by @stevesan79 on GitHub (Feb 8, 2026). Originally assigned to: @thdxr on GitHub. **Problem** When using the `question` tool with `multiple: true`, there's no way to pre-select certain options as defaults. Users must manually select all desired options even when some should logically be pre-selected. **Use Cases** 1. **File Selection**: When asking which files to include in an operation, files that were previously selected or match certain criteria should be pre-selected 2. **Configuration Updates**: When updating settings, current/existing values should be pre-selected so users only deselect what they want to remove 3. **Feature Toggles**: When enabling features, commonly-used or recommended options should be pre-selected **Current Behavior** Option A (recommended) - NOT selected Option B (recommended) - NOT selected Option C - NOT selected Option D - NOT selected User must manually select each item, even obvious defaults. ### Proposed Solution Add an optional `selected` boolean property to question options: ```json { "questions": [{ "header": "Select Options", "question": "Choose which options to include:", "multiple": true, "options": [ { "label": "Option A", "description": "Recommended", "selected": true }, { "label": "Option B", "description": "Recommended", "selected": true }, { "label": "Option C", "description": "Optional" }, { "label": "Option D", "description": "Advanced" } ] }] } ``` **Expected Behavior After Implementation** ☑ Option A (recommended) - Pre-selected ☑ Option B (recommended) - Pre-selected ☐ Option C - Not selected (user can add) ☐ Option D - Not selected (user can add) User only needs to adjust what they want to change. **Benefits** - Better UX: Users see sensible defaults, only adjust what they need - Common pattern: Standard behavior in HTML checkboxes, form libraries, CLI tools like fzf - Backward compatible: selected is optional, defaults to false - Enables smarter workflows: AI skills can suggest intelligent defaults based on context **Environment** - OpenCode version: 1.1.53 - Use case: AI skills with multi-select prompts
Author
Owner

@github-actions[bot] commented on GitHub (Feb 8, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #12296: Question Tool should use spacebar for selecting multiple choice items (related UX improvement for the question tool with multiple: true)

Feel free to ignore if these don't address your specific case.

@github-actions[bot] commented on GitHub (Feb 8, 2026): This issue might be a duplicate of existing issues. Please check: - #12296: Question Tool should use spacebar for selecting multiple choice items (related UX improvement for the question tool with multiple: true) Feel free to ignore if these don't address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8853