Skip to content

Replace ANSI escape codes with Live display, remove IAnsiConsole dependency, and simplify status feedback#14871

Merged
JamesNK merged 2 commits intorelease/13.2from
jamesnk/cli-status-feedback
Mar 3, 2026
Merged

Replace ANSI escape codes with Live display, remove IAnsiConsole dependency, and simplify status feedback#14871
JamesNK merged 2 commits intorelease/13.2from
jamesnk/cli-status-feedback

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Mar 3, 2026

Description

  • Removed ShowStatusAsync spinner wrapper around FindAndStopRunningInstanceAsync in AddCommand and RunCommand — the call is now made directly
  • Fetched dashboard URLs inside the backchannel connection loop instead of after launch, storing them in LaunchResult.DashboardUrls so DisplayLaunchResult is synchronous
  • Removed IAnsiConsole dependency from RunCommand, ExecCommand, and AppHostLauncher; RenderAppHostSummary now takes IInteractionService and uses DisplayEmptyLine()/DisplayRenderable()

@davidfowl Progress now displayed until launch details is ready. Previously there could be a delay while getting the dashboard URL.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings March 3, 2026 03:44
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

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

Or

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

Copy link
Contributor

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 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 RunCommand remote-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 on LaunchResult.

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit 79209b1:

Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AgentInitCommand_WithMalformedMcpJson_ShowsErrorAndExitsNonZero ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ❌ Upload failed
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording

📹 Recordings uploaded automatically from CI run #22607580663

Copy link
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

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

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.

@JamesNK JamesNK merged commit d8157f8 into release/13.2 Mar 3, 2026
346 checks passed
@JamesNK JamesNK deleted the jamesnk/cli-status-feedback branch March 3, 2026 04:57
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants