Skip to content

Use arguments for built-in resource commands - #17021

Merged
James Newton-King (JamesNK) merged 11 commits into
mainfrom
commands-use-arguments
May 15, 2026
Merged

James Newton-King (JamesNK) merged 11 commits into
mainfrom
commands-use-arguments

Conversation

@JamesNK

@JamesNK James Newton-King (JamesNK) commented May 13, 2026 •

Copy link
Copy Markdown
Member

Description

Updates built-in resource commands to declare structured Arguments on ResourceCommandAnnotation so command values can be supplied consistently by callers such as the dashboard, CLI, and MCP instead of each command prompting manually through IInteractionService.

Changed commands:

Command Project Arguments
parameter-set Aspire.Hosting value, save-to-user-secrets
parameter-delete Aspire.Hosting delete-from-user-secrets
ef-migrations-add Aspire.Hosting.EntityFrameworkCore name
configure-tracked-browser Aspire.Hosting.Browsers scope, browser, user-data-mode, profile, save-to-user-secrets
send-message Aspire.Hosting.Foundry message

Additional changes:

  • Updates dashboard resource command mapping for argument-based command execution.
  • Returns Foundry send-message output through CommandResultData instead of an interaction prompt.
  • Makes the set-parameter value input required and preserves the save-to-user-secrets default when saved deployment state exists.
  • Adds hosting and CLI validation so explicitly supplied disabled command arguments are rejected.
  • Sets browser logs save-to-user-secrets input state when command arguments are created.
  • Adds internal InteractionInput helpers for generated parameter inputs to set the command-specific name and required state without cloning the input.
  • Adds CLI, hosting, browser, and end-to-end test coverage for argument mapping, parameter set/delete behavior, disabled arguments, and browser input defaults.
  • Installs jq in 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"
  • Focused hosting, browser, resource command service, and CLI tests for the changed behavior.
  • git diff --check

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

@github-actions

github-actions Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

🚀 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17021

Or

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

@JamesNK James Newton-King (JamesNK) changed the title Use command arguments instead of prompting for values Update built-in commands to use arguments instead of prompting May 13, 2026
@JamesNK James Newton-King (JamesNK) added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label May 13, 2026
@davidfowl

Copy link
Copy Markdown
Collaborator

Oh this is super nice!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.

@JamesNK James Newton-King (JamesNK) changed the title Update built-in commands to use arguments instead of prompting Use arguments for built-in resource commands May 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

@davidfowl

Copy link
Copy Markdown
Collaborator

API breaking change here,

@mitchdenny Mitch Denny (mitchdenny) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Four findings from review. Holding the EF migration Required regression because commit dfdb47a already addresses Copilot's earlier comment on it.

@mitchdenny Mitch Denny (mitchdenny) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 15, 2026
aspire-repo-bot Bot added a commit to microsoft/aspire.dev that referenced this pull request May 15, 2026
…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]>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #974

Generated by PR Documentation Check

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#974 targeting release/13.4.

Drafted documentation for the argument-based built-in resource commands change. Updated two files:

  • src/frontend/src/content/docs/reference/cli/commands/aspire-resource.mdx — new Built-in parameter commands section documenting set-parameter (with --value, --save-to-user-secrets) and delete-parameter (with --delete-from-user-secrets), plus the rename note (parameter-set/parameter-delete are aliases).
  • src/frontend/src/content/docs/whats-new/aspire-13-4.mdx — new Argument-based built-in resource commands section with CLI examples and the command rename table.

Note

This draft PR needs human review before merging.

@JamesNK
James Newton-King (JamesNK) deleted the commands-use-arguments branch May 29, 2026 22:47
David Pine (IEvangelist) pushed a commit to microsoft/aspire.dev that referenced this pull request Jun 1, 2026
…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]>
David Pine (IEvangelist) added a commit to microsoft/aspire.dev that referenced this pull request Jun 1, 2026
…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]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

5 participants