Skip to content

Rename built-in resource commands: resource-start/stop/restart -> start/stop/restart#14930

Merged
davidfowl merged 2 commits intorelease/13.2from
rename-resource-commands
Mar 4, 2026
Merged

Rename built-in resource commands: resource-start/stop/restart -> start/stop/restart#14930
davidfowl merged 2 commits intorelease/13.2from
rename-resource-commands

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Mar 4, 2026

Description

Rename the built-in resource command identifiers from resource-start / resource-stop / resource-restart to start / stop / restart.

Changes:

  • Update KnownResourceCommands constants to use the new short names
  • Add internal legacy constants (LegacyStartCommand, LegacyStopCommand, LegacyRestartCommand) for backwards compatibility
  • Add fallback mapping in ResourceCommandService.ExecuteCommandCoreAsync — if a caller sends a legacy name (e.g. resource-start) and no command with that name is found, it falls back to the current name (start)
  • Remove the CLI ResourceCommand name-mapping dictionary (no longer needed since user-facing names now match command names directly)
  • Update Dashboard CommandViewModel, MCP tools, and Assistant [Description] attributes
  • Update VS Code extension getResourceContextValue to check for both old and new command names
  • Update all affected tests and add new backwards-compat tests in ResourceCommandServiceTests

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?

…rt/stop/restart

Rename the built-in resource command identifiers from 'resource-start',
'resource-stop', 'resource-restart' to 'start', 'stop', 'restart'.

- Update KnownResourceCommands constants to use the new short names
- Add internal legacy constants for backwards compatibility
- Add fallback mapping in ResourceCommandService so callers using
  the old names (e.g. 'resource-start') are mapped to the new names
- Remove the CLI ResourceCommand name-mapping layer (no longer needed)
- Update Dashboard CommandViewModel, MCP tools, and Assistant descriptions
- Update VS Code extension to check for both old and new command names
- Update all affected tests and add backwards-compat tests
@JamesNK JamesNK requested a review from mitchdenny as a code owner March 4, 2026 03:13
Copilot AI review requested due to automatic review settings March 4, 2026 03:13
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 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 -- 14930

Or

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

@JamesNK JamesNK added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Mar 4, 2026
@JamesNK JamesNK requested a review from davidfowl March 4, 2026 03:14
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

Renames the built-in lifecycle resource command identifiers across Aspire (hosting/backchannel, CLI, Dashboard, VS Code extension) from resource-start/stop/restart to start/stop/restart, while keeping backward compatibility via a server-side fallback mapping.

Changes:

  • Updated KnownResourceCommands to use the new short command names and introduced internal legacy constants.
  • Added legacy-name fallback logic in ResourceCommandService.ExecuteCommandCoreAsync and updated tests accordingly.
  • Updated consumers (Dashboard, MCP tools, CLI, VS Code extension) to use/recognize the new command names.

Reviewed changes

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

Show a summary per file
File Description
tests/Aspire.Hosting.Tests/ResourceCommandServiceTests.cs Adds coverage to ensure legacy command names fall back to the new names.
tests/Aspire.Hosting.Tests/ResourceCommandAnnotationTests.cs Updates lifecycle command test inputs to use start/stop/restart.
tests/Aspire.Hosting.Tests/Backchannel/AuxiliaryBackchannelRpcTargetTests.cs Updates expected command snapshots and assertions to new command names.
tests/Aspire.Cli.Tests/Mcp/ExecuteResourceCommandToolTests.cs Updates MCP tool tests to use new command names in inputs/outputs.
tests/Aspire.Cli.Tests/Commands/ResourceCommandTests.cs Updates CLI parsing tests for new command names (but currently introduces a duplicate test method).
tests/Aspire.Cli.Tests/Backchannel/ResourceSnapshotMapperTests.cs Updates snapshot mapping expectations to new command keys.
src/Aspire.Hosting/Backchannel/BackchannelDataTypes.cs Updates XML docs for command name examples to start/stop/restart.
src/Aspire.Hosting/ApplicationModel/ResourceCommandService.cs Adds legacy-name fallback mapping when executing commands.
src/Aspire.Hosting/ApplicationModel/KnownResourceCommands.cs Renames lifecycle command constants to start/stop/restart and adds legacy constants.
src/Aspire.Dashboard/Model/ResourceViewModel.cs Updates Dashboard-known command constants to new names.
src/Aspire.Dashboard/Model/Assistant/AssistantChatDataContext.cs Updates assistant description text to reference new command names.
src/Aspire.Dashboard/Mcp/AspireResourceMcpTools.cs Updates MCP descriptions/logic to use new command constants and improved message formatting.
src/Aspire.Cli/Mcp/Tools/ListConsoleLogsTool.cs Updates tool description text to reference new command names.
src/Aspire.Cli/Commands/ResourceCommandHelper.cs Updates parameter doc example for command name.
src/Aspire.Cli/Commands/ResourceCommand.cs Removes no-longer-needed mapping to backchannel lifecycle names and uses the command name directly.
src/Aspire.Cli/Backchannel/IAppHostAuxiliaryBackchannel.cs Updates doc examples for command names.
playground/Stress/Stress.AppHost/Program.cs Switches hard-coded lifecycle command strings to KnownResourceCommands.*.
extension/src/views/AspireAppHostTreeProvider.ts Treats both legacy and new lifecycle command names as enabling the same context actions.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit f8c3d4a:

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 ▶️ View Recording
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 #22653578304

@davidfowl davidfowl merged commit 276bbff into release/13.2 Mar 4, 2026
757 of 761 checks passed
@davidfowl davidfowl deleted the rename-resource-commands branch March 4, 2026 06:47
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 4, 2026
Copilot AI pushed a commit that referenced this pull request Mar 10, 2026
…rt/stop/restart (#14930)

* Rename built-in resource commands: resource-start/stop/restart -> start/stop/restart

Rename the built-in resource command identifiers from 'resource-start',
'resource-stop', 'resource-restart' to 'start', 'stop', 'restart'.

- Update KnownResourceCommands constants to use the new short names
- Add internal legacy constants for backwards compatibility
- Add fallback mapping in ResourceCommandService so callers using
  the old names (e.g. 'resource-start') are mapped to the new names
- Remove the CLI ResourceCommand name-mapping layer (no longer needed)
- Update Dashboard CommandViewModel, MCP tools, and Assistant descriptions
- Update VS Code extension to check for both old and new command names
- Update all affected tests and add backwards-compat tests

* Remove duplicate test method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants