feat: add interactive menu for single select elicitations - #9763
feat: add interactive menu for single select elicitations#9763panyamkeerthana wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ac2c6bd1e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| match cliclack::select("Select option") | ||
| .items(&items) | ||
| .interact() |
There was a problem hiding this comment.
Preserve empty/default handling for single-select fields
In this single-property enum path, the select prompt is created without applying the field's default and then returns before the existing empty-input handling can run. For a schema such as one enum field with default: "b" where "b" is not the first item, pressing Enter now submits the first highlighted option instead of the schema default; optional single enum fields also can no longer be accepted as unset because accepting the menu always inserts a value.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
the selection can be navigated to any option with arrow keys the additional logic for default/optional handling would add complexity
6ac2c6b to
e3c2d85
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3c2d857d5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| .filter_map(|opt| { | ||
| let value = opt.get("const")?.as_str()?; | ||
| let title = opt.get("title").and_then(|t| t.as_str()).unwrap_or(value); | ||
| Some((value.to_string(), title.to_string())) | ||
| }) |
There was a problem hiding this comment.
Do not drop non-const oneOf branches
For a single-field schema whose oneOf mixes fixed choices with another valid branch, e.g. {const: "skip"} plus {type: "string", title: "Custom"}, this filter_map silently omits the non-const branch but the caller still switches to the select menu as soon as any option remains. That skips the old free-form prompt and makes valid non-const/custom responses impossible to enter, so only use the menu when all oneOf alternatives are represented or fall back to manual input.
Useful? React with 👍 / 👎.
Adds support for single property schemas with oneOf/enum options, rendering them as an interactive menu using cliclack::select. Users can navigate options with arrow keys instead of manual input. Signed-off-by: Keerthana Panyam <panyam.k@northeastern.edu>
e3c2d85 to
de1b4a8
Compare
|
Thanks for the contribution, and sorry for the slow turnaround here. I'm going to close this one for now. The two Codex review comments raise real issues that aren't fully resolved: the single-select path bypasses the field's The branch has also drifted from If you'd like to address the Codex points and rebase, feel free to reopen — happy to take another look. The underlying idea (arrow-key menus for enum/oneOf elicitations) is nice. |
Adds support for single property schemas with oneOf/enum options, rendering them as an interactive menu using cliclack::select. Users can navigate options with arrow keys instead of manual input.
Screenshots/Demos (for UX changes)