Skip to content

Add update instructions to CLI version notification message#12614

Closed
Copilot wants to merge 5 commits intomainfrom
copilot/open-new-pull-request-12391
Closed

Add update instructions to CLI version notification message#12614
Copilot wants to merge 5 commits intomainfrom
copilot/open-new-pull-request-12391

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 2, 2025

Implements changes from #12391 to display context-aware update instructions when a new CLI version is available.

Changes

Centralized runtime detection

  • Added CliExecutionContext.IsRunningAsDotNetTool() as an instance method to detect if running as dotnet tool vs native binary
  • Method is non-static to enable mocking in unit tests
  • Removed duplicate implementations from UpdateCommand and CliUpdateNotifier

Updated notification message

  • ConsoleInteractionService.DisplayVersionUpdateNotification() now includes appropriate update command
  • Shows dotnet tool update aspire.cli for dotnet tool installations
  • Shows aspire update --self for native binary installations
  • Update command is visually highlighted using [white] markup for better visibility
  • Consolidated message format: [yellow]A new version of the Aspire CLI is available: {0}. Use [white]{1}[/] to update.[/]

Interface changes

  • Removed optional updateCommand parameter from IInteractionService.DisplayVersionUpdateNotification()
  • Updated all implementations and test mocks

Localization

  • Updated InteractionServiceStrings.resx to include update command placeholder with highlighting markup
  • Marked all 13 .xlf translations as needing update

Output

Dotnet tool:

A new version of the Aspire CLI is available: 13.0.0-preview.1.25526.1. Use dotnet tool update aspire.cli to update.
                                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (highlighted)
For more information, see: https://aka.ms/aspire/update

Native binary:

A new version of the Aspire CLI is available: 13.0.0-preview.1.25526.1. Use aspire update --self to update.
                                                                                 ^^^^^^^^^^^^^^^^^^^ (highlighted)
For more information, see: https://aka.ms/aspire/update
Original prompt

Open a new pull request with the changes from #12391


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Added IsRunningAsDotNetTool() method to CliHostEnvironment.cs
- Updated ConsoleInteractionService.DisplayVersionUpdateNotification to detect and show appropriate update command
- Updated resource strings in InteractionServiceStrings.resx to include update command in single message
- Updated InteractionServiceStrings.Designer.cs with new message format
- Updated all localization .xlf files to mark translations as needing update
- Removed IsRunningAsDotNetTool() from UpdateCommand.cs and CliUpdateNotifier.cs and use centralized version
- Updated IInteractionService interface to remove optional updateCommand parameter
- Updated all test services to match new interface signature
- Added test to verify update command is included in notification

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Copilot AI changed the title [WIP] Open new pull request with changes from #12391 Add update instructions to CLI version notification message Nov 2, 2025
Copilot AI requested a review from davidfowl November 2, 2025 20:22
@davidfowl
Copy link
Copy Markdown
Contributor

@copilot Here's what the copilot CLI looks like. The command to run is highlighted. It adds some nice polish to the visual

- Moved IsRunningAsDotNetTool() from CliHostEnvironment to CliExecutionContext
- Updated UpdateCommand to use CliExecutionContext.IsRunningAsDotNetTool()
- Updated ConsoleInteractionService to use CliExecutionContext.IsRunningAsDotNetTool()
- All 520 tests continue to pass

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
@davidfowl
Copy link
Copy Markdown
Contributor

@copilot don't make IsRunningAsDotNetTool static, that will make it hard to mock, we want to be able to unit test this behavior.

- Changed IsRunningAsDotNetTool() from static to instance method
- Added CA1822 suppression with justification for testability
- Updated UpdateCommand to call executionContext.IsRunningAsDotNetTool()
- Updated ConsoleInteractionService to call _executionContext.IsRunningAsDotNetTool()
- All 520 tests continue to pass

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 2, 2025

@copilot don't make IsRunningAsDotNetTool static, that will make it hard to mock, we want to be able to unit test this behavior.

Changed to instance method in commit 58c8da4. The method now can be mocked for unit testing while maintaining the same functionality.

@davidfowl
Copy link
Copy Markdown
Contributor

@copilot this is what the copilot CLI emits

image

- Added [white] markup to highlight the update command
- Updated resource string to use [white]{1}[/] for the command
- Updated Designer.cs to reflect the new format
- Updated all 13 xlf localization files with new markup
- All 520 tests continue to pass

The update command is now visually highlighted similar to the copilot CLI reference.

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 2, 2025

@copilot this is what the copilot CLI emits

image

...

Added command highlighting in commit 5f6a956. The update command is now displayed in white (highlighted) similar to the copilot CLI visual style.

Example output for native binary:

A new version of the Aspire CLI is available: 13.0.0-preview.1.25526.1. Use aspire update --self to update.
                                                                                 ^^^^^^^^^^^^^^^^^^^ (highlighted)
For more information, see: https://aka.ms/aspire/update

Example output for dotnet tool:

A new version of the Aspire CLI is available: 13.0.0-preview.1.25526.1. Use dotnet tool update aspire.cli to update.
                                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (highlighted)
For more information, see: https://aka.ms/aspire/update

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 2, 2025

🚀 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 -- 12614

Or

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

@davidfowl davidfowl closed this Mar 4, 2026
@dotnet-policy-service dotnet-policy-service bot added this to the 13.3 milestone Mar 4, 2026
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.

2 participants