Suppress animated banner auto-display in CI/non-interactive environments#14792
Merged
Suppress animated banner auto-display in CI/non-interactive environments#14792
Conversation
… run Co-authored-by: radical <1472+radical@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update Aspire CLI first-run experience for banner display
Suppress animated banner auto-display in CI/non-interactive environments
Feb 28, 2026
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14792Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14792" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Aspire CLI first-run experience by preventing the animated banner from auto-displaying in CI and other non-interactive environments, reducing log noise while preserving the ability to explicitly request the banner.
Changes:
- Gate the auto first-run banner display on
ICliHostEnvironment.SupportsInteractiveOutput(explicit--bannerremains unaffected). - Add unit tests to verify the banner is suppressed on first run in non-interactive environments and still shows when
--banneris explicitly provided.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Aspire.Cli/Program.cs | Adds ICliHostEnvironment.SupportsInteractiveOutput guard for the auto-first-run banner path. |
| tests/Aspire.Cli.Tests/Commands/RootCommandTests.cs | Adds unit tests for non-interactive suppression and explicit --banner behavior. |
Comments suppressed due to low confidence (1)
src/Aspire.Cli/Program.cs:487
ICliHostEnvironmentis resolved unconditionally here, even whenshowBanneris true (explicit--banner) or when banner output is otherwise suppressed. Since constructingCliHostEnvironmentcan involve environment/ANSI detection in some modes, consider resolving it only when the auto-first-run banner path is being evaluated (e.g., inline it into the conditional and rely on short-circuiting), so--bannerdoesn’t pay this cost.
var hostEnvironment = serviceProvider.GetRequiredService<ICliHostEnvironment>();
// Show banner if explicitly requested OR on first run (unless suppressed by noLogo or non-interactive output)
if (showBanner || (isFirstRun && !noLogo && hostEnvironment.SupportsInteractiveOutput))
JamesNK
approved these changes
Feb 28, 2026
Member
|
@copilot backport this chane to release/13.2 |
Member
|
/backport to release/13.2 |
Contributor
|
Started backporting to release/13.2: https://github.com/dotnet/aspire/actions/runs/22526559590 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The CLI animated banner was unconditionally shown on first run, including in CI pipelines and non-interactive environments where it pollutes logs. Gate the auto-first-run banner on
ICliHostEnvironment.SupportsInteractiveOutput, which already detects CI (viaCI,GITHUB_ACTIONS,TF_BUILD, etc.),--non-interactive, andASPIRE_NON_INTERACTIVE. Explicit--bannercontinues to work regardless of interactivity.Changes
src/Aspire.Cli/Program.cs—DisplayFirstTimeUseNoticeIfNeededAsync: resolveICliHostEnvironmentfrom DI and addSupportsInteractiveOutputguard to the first-run banner path only (explicit--bannerpath is unguarded):tests/Aspire.Cli.Tests/Commands/RootCommandTests.cs— Two new unit tests:FirstTimeUseNotice_BannerNotDisplayedInNonInteractiveEnvironment: first run + non-interactive → banner suppressed, sentinel still createdBanner_DisplayedWithExplicitBannerFlag_InNonInteractiveEnvironment:--banner→ banner shown even when non-interactiveChecklist
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.