Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 3, 2025

  • Analyze build break in tests added for framework selection
  • Identify issue: Framework prompting was happening in all scenarios (both interactive and specific template calls)
  • Fix the logic to only prompt for framework selection when in interactive mode (aspire new without template)
  • Update test signatures to match new framework parameter in callbacks
  • Add custom TestFrameworkInteractionService for testing framework prompting
  • Verify all tests pass after the fix

Problem Fixed

The build was failing because the framework selection prompt was being called unconditionally in ApplyTemplateAsync, but existing tests that call specific templates (like aspire new aspire-starter) weren't designed to handle this new prompt.

Solution Applied

Modified the framework prompting logic to only execute in interactive mode:

  • Added condition to check if parseResult.CommandResult.Command.Name == "new" (true only for interactive flow)
  • Only prompts for framework selection when user runs aspire new without specifying a template
  • Preserves existing behavior for specific template calls like aspire 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.

Open a new pull request that is based on the changes in PR #9985 ([CLI] Add --framework option to aspire new) but do not add the --framework option as a command-line argument. Instead, ensure that framework selection is handled as part of the interactive flow when creating a new project with 'aspire new'. The PR should maintain any refactoring or improvements from #9985 except the addition of the --framework option.


💡 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.

@Copilot Copilot AI changed the title [WIP] [CLI] Make framework selection interactive in 'aspire new'; do not add --framework option [CLI] Add framework selection to interactive flow for aspire new Sep 3, 2025
@Copilot Copilot AI requested a review from davidfowl September 3, 2025 07:18
Copilot finished work on behalf of davidfowl September 3, 2025 07:18
@davidfowl
Copy link
Member

@copilot fix the build break in the tests added

Copy link
Contributor Author

Copilot AI commented Sep 3, 2025

@copilot fix the build break in the tests added

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 aspire new in interactive mode without specifying a template. This preserves existing behavior for specific template calls like aspire new aspire-starter while enabling framework selection in the interactive flow.

Copilot finished work on behalf of davidfowl September 3, 2025 13:34
Copy link
Contributor

github-actions bot commented Sep 3, 2025

🚀 Dogfood this PR with:

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11232

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11232"

@mitchdenny mitchdenny marked this pull request as ready for review September 5, 2025 04:53
@Copilot Copilot AI review requested due to automatic review settings September 5, 2025 04:53
Copy link
Contributor

@Copilot Copilot AI left a 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"))
Copy link
Preview

Copilot AI Sep 5, 2025

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.

@davidfowl
Copy link
Member

Hmm, not sure about the implementation yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants