Repository navigation
Support named resource command options - #16903
Conversation
Co-authored-by: Copilot <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16903Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16903" |
There was a problem hiding this comment.
Pull request overview
Updates the Aspire CLI resource command to parse resource command inputs as named options using live command metadata, and adds command-specific --help output for those inputs.
Changes:
- Parse resource command “tail” tokens as metadata-driven named options and forward them as a named JSON object payload.
- Add a custom help action for
aspire resource <resource> <command> --helpthat renders command-input options (required/default/allowed values +--collision guidance). - Expand unit coverage with new help-parser tests and updated resource command tests + snapshot.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Cli/Commands/ResourceCommand.cs |
Implements metadata lookup, named-option parsing, and custom command-specific help rendering. |
src/Aspire.Cli/Commands/ResourceCommandHelpParser.cs |
Adds a testable parser for detecting command-specific help requests and extracting the apphost path. |
tests/Aspire.Cli.Tests/Commands/ResourceCommandTests.cs |
Updates and adds tests for named-option parsing, validation behavior, collisions, and help output. |
tests/Aspire.Cli.Tests/Commands/ResourceCommandHelpParserTests.cs |
Adds unit tests for the help-request parsing logic. |
tests/Aspire.Cli.Tests/Snapshots/ResourceCommandTests.ResourceCommand_CommandSpecificHelpForAllArgumentTypesMatchesSnapshot.verified.txt |
Adds snapshot coverage for command-specific help output across argument shapes. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 3
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Thanks for the summary. This is an informational PR overview and does not require any code changes. |
Co-authored-by: Copilot <[email protected]>
|
Fixing. |
Co-authored-by: Copilot <[email protected]>
|
Fixed in 5c35a17. I reproduced the missing-argument output and changed |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Fixed in 7034f40. The failed command response path now treats null Why the earlier tests missed it: the fake and constructor-created responses used the CLR default |
|
I can keep fixing these anyways, I’m touching this code (well the agent is…) |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
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.
|
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Fixed in
Fixed in
Fixed in
Fixed in |
|
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.
|
|
🎬 CLI E2E Test Recordings — 77 recordings uploaded (commit View all recordings
📹 Recordings uploaded automatically from CI run #25594430544 |
|
Pull request created: #898
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#898 targeting Updated Note This draft PR needs human review before merging. |
Three small drift fixes surfaced by the post-rebase build: 1. Hex1b 0.150.0 renamed the input-binding fluent helper. `BackgroundPanelWidget.WithInputBindings` (Hex1b 0.147) was renamed to `InputBindings` in 0.150 (the breaking-change diff lists `InputBindingExtensions.WithInputBindings` removed and `InputBindings` added; signatures are otherwise identical). 2. `IDashboardClient.ExecuteResourceCommandAsync` gained an `ExecuteResourceCommandOptions options` parameter on main (microsoft#16903 "Support named resource command options"). The `DisabledDashboardClient` test fake in `DefaultTerminalConnectionResolverTests` needed the new signature. 3. `IAppHostAuxiliaryBackchannel.ExecuteResourceCommandAsync` likewise gained `ExecuteResourceCommandOptions? options` on main. The `CapturingTerminalAppHostBackchannel` test wrapper in `TerminalCommandTests` needed the new signature and to forward the new parameter through to the inner backchannel. Co-authored-by: Copilot <[email protected]>
Three small drift fixes surfaced by the post-rebase build: 1. Hex1b 0.150.0 renamed the input-binding fluent helper. `BackgroundPanelWidget.WithInputBindings` (Hex1b 0.147) was renamed to `InputBindings` in 0.150 (the breaking-change diff lists `InputBindingExtensions.WithInputBindings` removed and `InputBindings` added; signatures are otherwise identical). 2. `IDashboardClient.ExecuteResourceCommandAsync` gained an `ExecuteResourceCommandOptions options` parameter on main (#16903 "Support named resource command options"). The `DisabledDashboardClient` test fake in `DefaultTerminalConnectionResolverTests` needed the new signature. 3. `IAppHostAuxiliaryBackchannel.ExecuteResourceCommandAsync` likewise gained `ExecuteResourceCommandOptions? options` on main. The `CapturingTerminalAppHostBackchannel` test wrapper in `TerminalCommandTests` needed the new signature and to forward the new parameter through to the inner backchannel. Co-authored-by: Copilot <[email protected]>
* Add named resource command options Co-authored-by: Copilot <[email protected]> * Address resource command help feedback Co-authored-by: Copilot <[email protected]> * Add resource command feedback regression tests Co-authored-by: Copilot <[email protected]> * Refine resource command argument parsing Co-authored-by: Copilot <[email protected]> * Fix resource command argument validation Co-authored-by: Copilot <[email protected]> * Add resource command error case tests Co-authored-by: Copilot <[email protected]> * Handle null resource command validation errors Co-authored-by: Copilot <[email protected]> * Handle missing resource command before options Co-authored-by: Copilot <[email protected]> * Refine resource command error messages Co-authored-by: Copilot <[email protected]> * Address resource command review feedback Co-authored-by: Copilot <[email protected]> * Move resource command argument errors to resources Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
Three small drift fixes surfaced by the post-rebase build: 1. Hex1b 0.150.0 renamed the input-binding fluent helper. `BackgroundPanelWidget.WithInputBindings` (Hex1b 0.147) was renamed to `InputBindings` in 0.150 (the breaking-change diff lists `InputBindingExtensions.WithInputBindings` removed and `InputBindings` added; signatures are otherwise identical). 2. `IDashboardClient.ExecuteResourceCommandAsync` gained an `ExecuteResourceCommandOptions options` parameter on main (#16903 "Support named resource command options"). The `DisabledDashboardClient` test fake in `DefaultTerminalConnectionResolverTests` needed the new signature. 3. `IAppHostAuxiliaryBackchannel.ExecuteResourceCommandAsync` likewise gained `ExecuteResourceCommandOptions? options` on main. The `CapturingTerminalAppHostBackchannel` test wrapper in `TerminalCommandTests` needed the new signature and to forward the new parameter through to the inner backchannel. Co-authored-by: Copilot <[email protected]>
Three small drift fixes surfaced by the post-rebase build: 1. Hex1b 0.150.0 renamed the input-binding fluent helper. `BackgroundPanelWidget.WithInputBindings` (Hex1b 0.147) was renamed to `InputBindings` in 0.150 (the breaking-change diff lists `InputBindingExtensions.WithInputBindings` removed and `InputBindings` added; signatures are otherwise identical). 2. `IDashboardClient.ExecuteResourceCommandAsync` gained an `ExecuteResourceCommandOptions options` parameter on main (#16903 "Support named resource command options"). The `DisabledDashboardClient` test fake in `DefaultTerminalConnectionResolverTests` needed the new signature. 3. `IAppHostAuxiliaryBackchannel.ExecuteResourceCommandAsync` likewise gained `ExecuteResourceCommandOptions? options` on main. The `CapturingTerminalAppHostBackchannel` test wrapper in `TerminalCommandTests` needed the new signature and to forward the new parameter through to the inner backchannel. Co-authored-by: Copilot <[email protected]>











Description
Resource command inputs were previously forwarded as ordered positional values, which made optional inputs difficult to use without providing every earlier value. This change makes resource command inputs feel like normal CLI options: command metadata is used to parse the command tail as named options with System.CommandLine, and the CLI sends the existing named JSON object payload over the backchannel.
This also adds command-specific
--helpfor resource commands. The help output shows each command input, whether it is required, default values, choice values, and how to use--when a resource command option name collides with an Aspire CLI option.User-facing usage
The Stress playground now exposes resource command inputs as named options. For example, a command with text, number, boolean, choice, and secret inputs shows command-specific help:
Those options can be invoked by name instead of position:
Named options also allow later optional inputs to be supplied without filling every earlier optional input. This Stress command provides required values plus
--item20, while omitting--item04through--item19:Validation:
./dotnet.sh test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.ResourceCommandTests" --filter-class "*.ResourceCommandHelpParserTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"Dependencies: N/A
Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?