Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

mitchdenny
Copy link
Member

@mitchdenny mitchdenny commented Apr 3, 2025

Fixes #8515

This PR updates the aspire new command to support interactive prompting. Here is a video of the interactive prompt, but read below for some more technical details/decisions from this approach.

aspire-new-interactive.mp4

A few notes on the technical implementation:

  1. I do not use a pick-list for selecting the template version. When using multiple feeds (paritcularly our internal ones) where we have thousands of versions of the Aspire.ProjectTemplates package it becomes difficult to present a list that makes sense. Instead, we just prompt for the version of the templates and default to the CLI version number. The thinking here is that the CLI will become the primary driver of newer template adoption, and generally you want to use the latest CLI and templates.

  2. The --prerelease switch has been removed from the CLI as it is redundant.

  3. The --source switch is still supported to cope with the situation where the same package version might be available from two sources, but it is not prompted - this is more of an advanced scenario.

Here is the non-interactive flow still working for comparison:

aspire-new-noninteractive.mp4

@Copilot Copilot AI review requested due to automatic review settings April 3, 2025 10:12
@mitchdenny mitchdenny linked an issue Apr 3, 2025 that may be closed by this pull request
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 interactive prompting to the "aspire new" command and standardizes telemetry tracing throughout the CLI project. Changes include the introduction of prompt utilities for string and selection inputs, updates to ActivitySource naming conventions, and method signature adjustments to support interactive prompting and improved telemetry instrumentation.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Aspire.Cli/Utils/PromptUtils.cs Introduces helper methods for interactive prompting.
src/Aspire.Cli/Program.cs Updates OpenTelemetry configuration and standardizes ActivitySource naming.
src/Aspire.Cli/NuGetPackageCache.cs Adjusts method signature to use DirectoryInfo instead of FileInfo.
src/Aspire.Cli/DotNetCliRunner.cs Standardizes ActivitySource naming and removes explicit ActivityKind values.
src/Aspire.Cli/Commands/* Normalize ActivitySource naming and update NewCommand to use interactive prompts.
src/Aspire.Cli/Backchannel/AppHostBackchannel.cs Standardizes ActivitySource naming for backchannel operations.
Comments suppressed due to low confidence (1)

src/Aspire.Cli/Program.cs:21

  • [nitpick] Changing the ActivitySource name to just 'Program' reduces context compared to the previous 'Aspire.Cli.Program'. Consider using the fully qualified name to maintain clarity in telemetry.
private static readonly ActivitySource s_activitySource = new ActivitySource(nameof(Program));

{
var id = packageResult.GetProperty("id").GetString();

// var version = prerelease switch {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code?

@davidfowl davidfowl merged commit 1007a6c into main Apr 3, 2025
174 checks passed
@davidfowl davidfowl deleted the mitchdenny/interactive-aspire-new branch April 3, 2025 14:52
@davidfowl
Copy link
Member

/backport to release/9.2

Copy link
Contributor

github-actions bot commented Apr 3, 2025

Started backporting to release/9.2: https://github.com/dotnet/aspire/actions/runs/14246085285

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

Successfully merging this pull request may close these issues.

Calling aspire new with no arguments fails
2 participants