Repository navigation
Use arguments for built-in resource commands - #17021
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17021Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17021" |
|
Oh this is super nice! |
6b46a92 to
4517131
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates several built-in AppHost resource commands to declare ResourceCommandAnnotation.Arguments so that callers (Dashboard/CLI/MCP) can supply inputs directly, reducing direct prompting via IInteractionService and improving consistency across clients.
Changes:
- Added/updated legacy command name mapping and well-known command metadata across Hosting, Dashboard, and CLI (including parameter command renames).
- Refactored multiple commands to read values from
ExecuteCommandContext.Arguments(including Browser logs configuration, EF migration add, and Foundry prompt agent messaging). - Updated unit/E2E tests to pass command arguments through
ExecuteCommandAsync/ CLI parsing rather than intercepting interaction prompts.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/ResourceCommandServiceTests.cs | Adds coverage for legacy parameter command name fallback behavior. |
| tests/Aspire.Hosting.Tests/Orchestrator/ParameterProcessorTests.cs | Adds assertions for set-parameter argument definitions and defaults. |
| tests/Aspire.Hosting.Tests/AddParameterTests.cs | Verifies ParameterResource.CreateInput supports overriding input name. |
| tests/Aspire.Hosting.Browsers.Tests/BrowserLogsBuilderExtensionsTests.cs | Rewrites browser logs tests to execute commands with explicit arguments and validates dynamic-loading defaults. |
| tests/Aspire.Cli.Tests/Commands/ResourceCommandTests.cs | Expands well-known resource command coverage and validates CLI progress/success messages. |
| tests/Aspire.Cli.EndToEnd.Tests/ResourceCommandTests.cs | Adds E2E coverage for set/delete parameter commands impacting describe output/state. |
| src/Aspire.Hosting/Orchestrator/ParameterProcessor.cs | Migrates parameter set/delete commands to argument-based execution. |
| src/Aspire.Hosting/ApplicationModel/ResourceCommandService.cs | Adds legacy name mapping for parameter commands and tightens comparisons for command resolution. |
| src/Aspire.Hosting/ApplicationModel/ParameterResource.cs | Adds CreateInput(string? name = null) and input renaming helper to support argument naming. |
| src/Aspire.Hosting/ApplicationModel/KnownResourceCommands.cs | Renames parameter command constants and adds legacy aliases. |
| src/Aspire.Hosting.Foundry/PromptAgent/PromptAgentBuilderExtensions.cs | Changes send-message command to accept a message argument and return result data instead of prompting. |
| src/Aspire.Hosting.EntityFrameworkCore/EFResourceBuilderExtensions.cs | Adds migration-name argument for add-migration and removes interactive prompt path. |
| src/Aspire.Hosting.Browsers/BrowserLogsConfigurationManager.cs | Replaces interactive prompting with static argument definitions + dynamic loading + validation. |
| src/Aspire.Hosting.Browsers/BrowserLogsBuilderExtensions.cs | Wires configure-tracked-browser command to pass/validate arguments. |
| src/Aspire.Dashboard/Model/ResourceViewModel.cs | Updates dashboard-known command list/constants to include rebuild and parameter commands. |
| src/Aspire.Cli/Commands/ResourceCommand.cs | Extends well-known command metadata and clarifies behavior for display text customization. |
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
b7c0255 to
b602fb2
Compare
|
API breaking change here, |
Mitch Denny (mitchdenny)
left a comment
There was a problem hiding this comment.
Four findings from review. Holding the EF migration Required regression because commit dfdb47a already addresses Copilot's earlier comment on it.
Mitch Denny (mitchdenny)
left a comment
There was a problem hiding this comment.
Tested this otu locally works pretty well but copilot found some potential races worth considering.
Update all known commands in the app host to define Arguments on ResourceCommandAnnotation so values are supplied by the caller (dashboard, CLI, MCP) instead of manually prompting via IInteractionService. Commands updated: - parameter-set: accepts value and save-to-user-secrets arguments - parameter-delete: accepts delete-from-user-secrets argument - ef-migrations-add: accepts migration name argument - configure-tracked-browser: accepts scope, browser, user-data-mode, profile, and save-to-user-secrets arguments with dynamic loading and validation - send-message (Foundry prompt agent): accepts message argument and returns response via CommandResultData instead of message box Also rewrites browser logs tests to pass arguments directly rather than intercepting IInteractionService prompts.
…er/delete-parameter) Documents the changes from microsoft/aspire#17021 which renamed the built-in parameter commands and added structured arguments: - set-parameter (was parameter-set): accepts --value and --save-to-user-secrets - delete-parameter (was parameter-delete): accepts --delete-from-user-secrets Updates aspire-resource.mdx with a Built-in parameter commands section and adds a corresponding entry to the Aspire 13.4 what's new page. Co-authored-by: Copilot <[email protected]>
|
Pull request created: #974
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#974 targeting Drafted documentation for the argument-based built-in resource commands change. Updated two files:
Note This draft PR needs human review before merging. |
…er/delete-parameter) Documents the changes from microsoft/aspire#17021 which renamed the built-in parameter commands and added structured arguments: - set-parameter (was parameter-set): accepts --value and --save-to-user-secrets - delete-parameter (was parameter-delete): accepts --delete-from-user-secrets Updates aspire-resource.mdx with a Built-in parameter commands section and adds a corresponding entry to the Aspire 13.4 what's new page. Co-authored-by: Copilot <[email protected]>
…ter/delete-parameter) (#974) * docs: document argument-based built-in resource commands (set-parameter/delete-parameter) Documents the changes from microsoft/aspire#17021 which renamed the built-in parameter commands and added structured arguments: - set-parameter (was parameter-set): accepts --value and --save-to-user-secrets - delete-parameter (was parameter-delete): accepts --delete-from-user-secrets Updates aspire-resource.mdx with a Built-in parameter commands section and adds a corresponding entry to the Aspire 13.4 what's new page. Co-authored-by: Copilot <[email protected]> * Address review feedback (2 threads) - PRRT_kwDOQK_VN86F5qVC: Require explicit boolean value for --save-to-user-secrets and fix the set-parameter example. - PRRT_kwDOQK_VN86F5qVE: Remove the bare-flag boolean claim from the Aspire 13.4 release note. Verified against microsoft/aspire@2574ef5 on branch release/13.4. Edited per the doc-writer skill. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: aspire-repo-bot[bot] <268009190+aspire-repo-bot[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]> Co-authored-by: David Pine <[email protected]>
Description
Updates built-in resource commands to declare structured
ArgumentsonResourceCommandAnnotationso command values can be supplied consistently by callers such as the dashboard, CLI, and MCP instead of each command prompting manually throughIInteractionService.Changed commands:
parameter-setvalue,save-to-user-secretsparameter-deletedelete-from-user-secretsef-migrations-addnameconfigure-tracked-browserscope,browser,user-data-mode,profile,save-to-user-secretssend-messagemessageAdditional changes:
send-messageoutput throughCommandResultDatainstead of an interaction prompt.set-parametervalue input required and preserves the save-to-user-secrets default when saved deployment state exists.InteractionInputhelpers for generated parameter inputs to set the command-specific name and required state without cloning the input.jqin the CLI E2E .NET Docker image because the resource command E2E test asserts JSON describe output inside the test container.Validation
dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"git diff --checkChecklist
<remarks />and<code />elements on your triple slash comments?