Add optional parameter to PromptForSelectionsAsync#14961
Merged
davidfowl merged 4 commits intorelease/13.2from Mar 5, 2026
Merged
Add optional parameter to PromptForSelectionsAsync#14961davidfowl merged 4 commits intorelease/13.2from
davidfowl merged 4 commits intorelease/13.2from
Conversation
Add a notRequired parameter (default false) to PromptForSelectionsAsync across the interface, all implementations, and test services. When true, the Spectre.Console MultiSelectionPrompt allows submitting without selecting any items. Enable notRequired at all three existing call sites (InitCommand and AgentInitCommand) since they all handle empty selections gracefully.
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14961Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14961" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a notRequired parameter to PromptForSelectionsAsync across the interaction service interface and its implementations, allowing callers to let users submit a multi-selection prompt without choosing any items. The parameter is then enabled at all existing call sites.
Changes:
- Added
bool notRequired = falseparameter to thePromptForSelectionsAsyncmethod signature in the interface, console service, extension service, and test service. - Applied
.NotRequired()on the Spectre.ConsoleMultiSelectionPromptwhen the parameter istrueinConsoleInteractionService. - Passed
notRequired: trueat all three existing call sites (InitCommand×2,AgentInitCommand×1).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Cli/Interaction/IInteractionService.cs |
Added notRequired parameter to the interface method signature. |
src/Aspire.Cli/Interaction/ConsoleInteractionService.cs |
Implemented conditional .NotRequired() call on the Spectre.Console prompt. |
src/Aspire.Cli/Interaction/ExtensionInteractionService.cs |
Added parameter and passes it through to the console interaction service. |
tests/Aspire.Cli.Tests/TestServices/TestConsoleInteractionService.cs |
Updated test implementation to accept the new parameter. |
src/Aspire.Cli/Commands/InitCommand.cs |
Enabled notRequired: true at both multi-selection call sites. |
src/Aspire.Cli/Commands/AgentInitCommand.cs |
Enabled notRequired: true at the agent init multi-selection call site. |
Contributor
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22700986081 |
…nsolidate duplicates - Renamed TestConsoleInteractionService to TestInteractionService across all test files - Enhanced shared implementation with response queue, call tracking, and cancellation support - Removed TestConsoleInteractionServiceWithPromptTracking from PublishCommandPromptingIntegrationTests (merged into shared impl) - Removed OrderTrackingInteractionService from NewCommandTests (replaced with shared impl + callback) - Removed private TestInteractionService stub from DotNetTemplateFactoryTests (uses shared impl) - Kept CancellationTrackingInteractionService as-is (decorator pattern, different purpose)
The double-negative naming pattern (notRequired: false meaning 'required') was confusing at call sites. Renamed to 'optional' for clarity across the interface, all implementations, and call sites.
2 tasks
davidfowl
approved these changes
Mar 5, 2026
eerhardt
pushed a commit
to eerhardt/aspire
that referenced
this pull request
Mar 7, 2026
* Add notRequired parameter to PromptForSelectionsAsync Add a notRequired parameter (default false) to PromptForSelectionsAsync across the interface, all implementations, and test services. When true, the Spectre.Console MultiSelectionPrompt allows submitting without selecting any items. Enable notRequired at all three existing call sites (InitCommand and AgentInitCommand) since they all handle empty selections gracefully. * Rename TestConsoleInteractionService to TestInteractionService and consolidate duplicates - Renamed TestConsoleInteractionService to TestInteractionService across all test files - Enhanced shared implementation with response queue, call tracking, and cancellation support - Removed TestConsoleInteractionServiceWithPromptTracking from PublishCommandPromptingIntegrationTests (merged into shared impl) - Removed OrderTrackingInteractionService from NewCommandTests (replaced with shared impl + callback) - Removed private TestInteractionService stub from DotNetTemplateFactoryTests (uses shared impl) - Kept CancellationTrackingInteractionService as-is (decorator pattern, different purpose) * Code clean up * Rename notRequired parameter to optional in PromptForSelectionsAsync The double-negative naming pattern (notRequired: false meaning 'required') was confusing at call sites. Renamed to 'optional' for clarity across the interface, all implementations, and call sites.
Copilot AI
pushed a commit
that referenced
this pull request
Mar 10, 2026
* Add notRequired parameter to PromptForSelectionsAsync Add a notRequired parameter (default false) to PromptForSelectionsAsync across the interface, all implementations, and test services. When true, the Spectre.Console MultiSelectionPrompt allows submitting without selecting any items. Enable notRequired at all three existing call sites (InitCommand and AgentInitCommand) since they all handle empty selections gracefully. * Rename TestConsoleInteractionService to TestInteractionService and consolidate duplicates - Renamed TestConsoleInteractionService to TestInteractionService across all test files - Enhanced shared implementation with response queue, call tracking, and cancellation support - Removed TestConsoleInteractionServiceWithPromptTracking from PublishCommandPromptingIntegrationTests (merged into shared impl) - Removed OrderTrackingInteractionService from NewCommandTests (replaced with shared impl + callback) - Removed private TestInteractionService stub from DotNetTemplateFactoryTests (uses shared impl) - Kept CancellationTrackingInteractionService as-is (decorator pattern, different purpose) * Code clean up * Rename notRequired parameter to optional in PromptForSelectionsAsync The double-negative naming pattern (notRequired: false meaning 'required') was confusing at call sites. Renamed to 'optional' for clarity across the interface, all implementations, and call sites.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a
notRequiredparameter toPromptForSelectionsAsyncso callers can allow users to submit the multi-selection prompt without choosing any items.Changes:
bool notRequired = falseparameter toIInteractionService.PromptForSelectionsAsyncConsoleInteractionServiceto conditionally call.NotRequired()on the Spectre.ConsoleMultiSelectionPromptwhen the parameter istrueExtensionInteractionServiceto pass through the parameterTestConsoleInteractionServicetest implementationnotRequired: trueat all three existing call sites (InitCommandx2,AgentInitCommandx1) since they all handle empty selections gracefullyFixes #14841
Fixes #14460
Checklist