Forward aspire run arguments to AppHost#16630
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16630Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16630" |
There was a problem hiding this comment.
Pull request overview
This PR updates the Aspire CLI so arguments provided after a command separator (e.g., aspire run -- <args>) are forwarded through the CLI layers and ultimately into the AppHost process argv (including detached run/start, extension debug-session delegation, and guest-language AppHost execution paths).
Changes:
- Adds a centralized helper (
AppHostLauncher.GetAppHostArguments+AddAppHostArguments) to extract AppHost args and re-materialize them into child CLI invocations with an injected--separator. - Threads AppHost args into extension debug-session delegation and detached
run/startflows. - Extends guest runtime execution to accept and forward AppHost args, with new unit + E2E coverage (including a TypeScript E2E validating forwarded argv).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/TestServices/TestExtensionInteractionService.cs | Updates the test extension interaction callback shape to capture debug session options (including forwarded args). |
| tests/Aspire.Cli.Tests/Projects/GuestRuntimeTests.cs | Adds unit coverage ensuring guest runtime appends forwarded run args when no {args} placeholder is present. |
| tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs | Adds coverage verifying forwarded AppHost args are placed after the dotnet separator. |
| tests/Aspire.Cli.Tests/Commands/StartCommandTests.cs | Updates start command parsing test to assert AppHost arg extraction behavior via the new helper. |
| tests/Aspire.Cli.Tests/Commands/RunCommandTests.cs | Expands run command tests for separator parsing, literal -- preservation, runner forwarding, and extension delegation forwarding. |
| tests/Aspire.Cli.EndToEnd.Tests/TypeScriptEmptyAppHostTemplateTests.cs | Adds an E2E test that writes argv to a file in a TS AppHost and asserts forwarded args (including a literal --). |
| src/Aspire.Cli/Projects/GuestRuntime.cs | Introduces a runArgs-accepting overload and forwards these args into guest runtime command execution. |
| src/Aspire.Cli/Projects/GuestAppHostProject.cs | Threads context.UnmatchedTokens into guest runtime execution so guest AppHosts can receive forwarded args. |
| src/Aspire.Cli/Commands/StartCommand.cs | Switches detached start to forward extracted AppHost args via an injected -- when spawning the child CLI. |
| src/Aspire.Cli/Commands/RunCommand.cs | Extracts AppHost args once and forwards them through extension delegation, detached run spawning, and direct project execution. |
| src/Aspire.Cli/Commands/AppHostLauncher.cs | Adds helpers to extract AppHost args and append them to child CLI args after a -- separator. |
|
Re-running the failed jobs in the CI workflow for this pull request because 3 jobs were identified as retry-safe transient failures in the CI run attempt.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🎬 CLI E2E Test Recordings — 77 recordings uploaded (commit View all recordings
📹 Recordings uploaded automatically from CI run #25199625106 |
Description
aspire run -- <args>should pass those arguments through to the AppHost process so AppHosts can read them from their normal process argument APIs. This change preservesSystem.CommandLineunmatched tokens from the command separator and threads them through C# AppHost launches, guest-language AppHost launches, detachedrun/startchild invocations, and extension debug-session delegation.The forwarding path adds the
--separator only when reconstructing a child CLI invocation, while preserving literal--values that are part of the AppHost arguments. Coverage includes focused CLI unit tests for parser behavior, C#dotnet runargument placement, extension delegation, guest runtime execution, and a TypeScript CLI E2E test that verifies a guestapphost.tsreceives forwarded arguments.Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: