Replace ANSI escape codes with Live display, remove IAnsiConsole dependency, and simplify status feedback#14871
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14871Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14871" |
There was a problem hiding this comment.
Pull request overview
This PR refactors Aspire CLI’s status/output rendering to rely on the interaction service + Spectre.Console “Live” rendering instead of manual ANSI escape sequences and direct IAnsiConsole dependencies, while also making detached launch result display synchronous by capturing dashboard URLs earlier.
Changes:
- Introduces
IInteractionService.DisplayLiveAsync(...)and implements it in console/extension interaction services and test fakes. - Replaces ANSI line-clearing output in
RunCommandremote-environment endpoint rendering with a Live display. - Removes “Checking for running instances…” status spinner usage (and related localized resources) from
AddCommand/RunCommand, and adjusts detached launch flow to store dashboard URLs onLaunchResult.
Reviewed changes
Copilot reviewed 42 out of 44 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/TestServices/TestExtensionInteractionService.cs | Adds DisplayLiveAsync stub to satisfy updated IInteractionService. |
| tests/Aspire.Cli.Tests/TestServices/TestConsoleInteractionService.cs | Adds DisplayLiveAsync stub to satisfy updated IInteractionService. |
| tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs | Updates test IInteractionService implementation with DisplayLiveAsync. |
| tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs | Forwards DisplayLiveAsync through wrapper interaction service. |
| tests/Aspire.Cli.Tests/Commands/PublishCommandPromptingIntegrationTests.cs | Updates test interaction service with DisplayLiveAsync. |
| tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs | Updates test interaction service with DisplayLiveAsync. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.zh-Hant.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.zh-Hans.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.tr.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.ru.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.pt-BR.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.pl.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.ko.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.ja.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.it.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.fr.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.es.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.de.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/RunCommandStrings.cs.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.zh-Hant.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.zh-Hans.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.tr.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.ru.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.pt-BR.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.pl.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.ko.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.ja.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.it.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.fr.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.es.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.de.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/xlf/AddCommandStrings.cs.xlf | Removes localized CheckingForRunningInstances entry. |
| src/Aspire.Cli/Resources/RunCommandStrings.resx | Removes CheckingForRunningInstances resource key. |
| src/Aspire.Cli/Resources/RunCommandStrings.Designer.cs | Removes generated accessor for CheckingForRunningInstances. |
| src/Aspire.Cli/Resources/AddCommandStrings.resx | Removes CheckingForRunningInstances resource key. |
| src/Aspire.Cli/Resources/AddCommandStrings.Designer.cs | Removes generated accessor for CheckingForRunningInstances. |
| src/Aspire.Cli/Projects/ProjectLocator.cs | Removes an extra DisplayEmptyLine() call after project search. |
| src/Aspire.Cli/Interaction/IInteractionService.cs | Adds DisplayLiveAsync to the interaction abstraction. |
| src/Aspire.Cli/Interaction/ExtensionInteractionService.cs | Forwards DisplayLiveAsync to console interaction implementation. |
| src/Aspire.Cli/Interaction/ConsoleInteractionService.cs | Implements DisplayLiveAsync using Spectre.Console Live. |
| src/Aspire.Cli/Commands/RunCommand.cs | Removes IAnsiConsole usage; switches remote endpoint rendering to Live display; updates summary rendering to use IInteractionService. |
| src/Aspire.Cli/Commands/ExecCommand.cs | Removes IAnsiConsole dependency from command construction. |
| src/Aspire.Cli/Commands/AppHostLauncher.cs | Removes IAnsiConsole dependency; stores dashboard URLs in LaunchResult; makes launch result rendering synchronous. |
| src/Aspire.Cli/Commands/AddCommand.cs | Removes status spinner wrapper around running-instance detection/stop call. |
Files not reviewed (2)
- src/Aspire.Cli/Resources/AddCommandStrings.Designer.cs: Language not supported
- src/Aspire.Cli/Resources/RunCommandStrings.Designer.cs: Language not supported
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22607580663 |
mitchdenny
left a comment
There was a problem hiding this comment.
Nice cleanup — removing the IAnsiConsole dependency and making DisplayLaunchResult synchronous simplifies the flow. Net-negative lines is always good.
One thought: the new DisplayLiveAsync(IRenderable, Func<Action<IRenderable>, Task>) method still couples IInteractionService to Spectre.Console via IRenderable. It would be nice to eventually decouple IInteractionService completely from Spectre.Console so it's a pure abstraction — that would make it easier to implement for non-console scenarios (e.g. the VS Code extension interaction service). Not a blocker for this PR though.
Description
ShowStatusAsyncspinner wrapper aroundFindAndStopRunningInstanceAsyncinAddCommandandRunCommand— the call is now made directlyLaunchResult.DashboardUrlssoDisplayLaunchResultis synchronousIAnsiConsoledependency fromRunCommand,ExecCommand, andAppHostLauncher;RenderAppHostSummarynow takesIInteractionServiceand usesDisplayEmptyLine()/DisplayRenderable()@davidfowl Progress now displayed until launch details is ready. Previously there could be a delay while getting the dashboard URL.
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: