-
Notifications
You must be signed in to change notification settings - Fork 687
[CLI] Add framework selection to interactive flow for aspire new #11232
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: main
Are you sure you want to change the base?
Conversation
Co-authored-by: davidfowl <[email protected]>
@copilot fix the build break in the tests added |
…teractive mode only Co-authored-by: davidfowl <[email protected]>
Fixed the build break in commit 210141a. The issue was that framework prompting was happening in all scenarios (both interactive and specific template calls), but existing tests calling specific templates weren't designed to handle the new framework selection prompt. The solution was to make framework prompting conditional - it now only occurs when users run |
🚀 Dogfood this PR with: curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11232 Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11232" |
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 adds framework selection to the interactive flow for aspire new
command without introducing a --framework
command-line option. The framework selection is prompted only when users run aspire new
in interactive mode (without specifying a specific template), ensuring backward compatibility with existing template-specific commands like aspire new aspire-starter
.
- Framework prompting is conditionally applied only in interactive mode to avoid breaking existing workflows
- Test infrastructure is updated to handle the new framework parameter in the
NewProjectAsync
method signature - Localization resources are added for the framework selection prompts
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Aspire.Cli/Templating/DotNetTemplateFactory.cs | Adds framework prompting logic and conditional framework parameter passing |
src/Aspire.Cli/DotNet/DotNetCliRunner.cs | Updates NewProjectAsync method signature to accept optional framework parameter |
tests/Aspire.Cli.Tests/TestServices/TestDotNetCliRunner.cs | Updates test service to match new method signature |
tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs | Updates test call to include framework parameter |
tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs | Updates test callbacks and adds new test for framework prompting |
src/Aspire.Cli/Resources/TemplatingStrings.resx | Adds framework selection prompt text resources |
src/Aspire.Cli/Resources/xlf/*.xlf | Adds localization entries for framework selection prompts |
Files not reviewed (1)
- src/Aspire.Cli/Resources/TemplatingStrings.Designer.cs: Language not supported
throw new EmptyChoicesException($"No items available for selection: {promptText}"); | ||
} | ||
|
||
if (promptText.Contains("target framework")) |
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.
Using string matching for prompt detection is fragile. Consider using a more robust approach such as passing a specific identifier or enum value to distinguish between different prompt types.
Copilot uses AI. Check for mistakes.
Hmm, not sure about the implementation yet. |
Problem Fixed
The build was failing because the framework selection prompt was being called unconditionally in
ApplyTemplateAsync
, but existing tests that call specific templates (likeaspire new aspire-starter
) weren't designed to handle this new prompt.Solution Applied
Modified the framework prompting logic to only execute in interactive mode:
parseResult.CommandResult.Command.Name == "new"
(true only for interactive flow)aspire new
without specifying a templateaspire new aspire-starter
All tests now pass successfully, including the new framework selection test for interactive mode.
This pull request was created as a result of the following prompt from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.