Skip to content

Add aspire dashboard CLI command#15607

Merged
JamesNK merged 3 commits intomainfrom
cli-dashboard-command
Apr 4, 2026
Merged

Add aspire dashboard CLI command#15607
JamesNK merged 3 commits intomainfrom
cli-dashboard-command

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Mar 26, 2026

Description

Add a new aspire dashboard CLI command that starts a standalone Aspire Dashboard instance using the aspire-managed binary from the CLI bundle, and refactor the process execution infrastructure to support both dotnet CLI and non-dotnet processes through a single abstraction.

aspire dashboard command

  • Runs the dashboard in the foreground, blocking until Ctrl+C, with a readiness check (waits for "Now listening on:" output)
  • Displays a summary panel with dashboard URL, OTLP gRPC/HTTP endpoints, and log file path
  • Generates a browser token for frontend authentication by default (passed via environment variable to avoid exposure in process listings)
  • Supports typed options: --frontend-url, --otlp-grpc-url, --otlp-http-url, --allow-anonymous, --config-file-path
  • Forwards unmatched tokens directly to the dashboard process for pass-through configuration
  • Respects configuration set via environment variables or unmatched --KEY=value / --KEY value tokens, skipping defaults when already provided
  • Handles dashboard-specific exit codes (unexpected error, validation failure, address in use) with localized error messages
  • Categorized under the Monitoring help group

Unified process execution infrastructure

  • Renamed IDotNetCliExecutionFactoryIProcessExecutionFactory and IDotNetCliExecutionIProcessExecution to reflect that process execution is no longer dotnet-specific
  • Renamed DotNetCliExecutionProcessExecution and deleted the old DotNetCliExecutionFactory
  • Moved dotnet-specific environment setup (orphan detection, MSBUILDTERMINALLOGGER, DOTNET_NOLOGO, private SDK resolution) from DotNetCliExecutionFactory into DotNetCliRunner, keeping IProcessExecutionFactory generic
  • Added Kill(bool entireProcessTree) and IDisposable to IProcessExecution so callers can manage process lifetime
  • Renamed DotNetCliRunnerInvocationOptionsProcessInvocationOptions
  • Changed LayoutProcessRunner from a static helper using raw System.Diagnostics.Process to an instance class that delegates to IProcessExecutionFactory, making it testable via DI
  • ProcessExecutionFactory now accepts a fileName parameter so it can launch any executable, not just dotnet

Dashboard exit code tests

  • Added StartupTests.Run_AddressAlreadyInUse_ReturnsExitCodeAddressInUse and Run_ValidationFailure_ReturnsNegativeOne to verify dashboard exit code behavior

Validation

  • All 21 DashboardCommandTests pass, covering default args, individual options (Theory), combined options, unmatched token forwarding, browser token generation, and process error handling
  • All existing CLI tests pass with the renamed types

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
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings March 26, 2026 06:32
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 26, 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15607

Or

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

@JamesNK JamesNK marked this pull request as draft March 26, 2026 06:33
Copy link
Copy Markdown
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

Adds a new aspire dashboard top-level CLI command to launch the standalone Aspire Dashboard via the bundled aspire-managed binary, integrating it into the root command set and localized resources.

Changes:

  • Registers a new DashboardCommand in the CLI host and root command, categorized under the Monitoring help group.
  • Implements foreground and --detach execution paths and introduces localized resource strings for the new command.
  • Adds initial unit tests covering --help and the “bundle not available” error case.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs Registers DashboardCommand in the test DI container.
tests/Aspire.Cli.Tests/Commands/DashboardCommandTests.cs Adds tests for help and missing-bundle error behavior.
src/Aspire.Cli/Program.cs Registers DashboardCommand in the production DI container.
src/Aspire.Cli/Commands/RootCommand.cs Adds dashboard as a root subcommand.
src/Aspire.Cli/Commands/DashboardCommand.cs Implements the new aspire dashboard command (foreground/detach + arg pass-through).
src/Aspire.Cli/Resources/DashboardCommandStrings.resx Adds new localized strings for the dashboard command.
src/Aspire.Cli/Resources/DashboardCommandStrings.Designer.cs Strongly-typed accessor for the new dashboard strings.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.cs.xlf Localization XLF for cs.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.de.xlf Localization XLF for de.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.es.xlf Localization XLF for es.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.fr.xlf Localization XLF for fr.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.it.xlf Localization XLF for it.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.ja.xlf Localization XLF for ja.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.ko.xlf Localization XLF for ko.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.pl.xlf Localization XLF for pl.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.pt-BR.xlf Localization XLF for pt-BR.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.ru.xlf Localization XLF for ru.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.tr.xlf Localization XLF for tr.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.zh-Hans.xlf Localization XLF for zh-Hans.
src/Aspire.Cli/Resources/xlf/DashboardCommandStrings.zh-Hant.xlf Localization XLF for zh-Hant.
Files not reviewed (1)
  • src/Aspire.Cli/Resources/DashboardCommandStrings.Designer.cs: Language not supported

Comment thread src/Aspire.Cli/Commands/DashboardCommand.cs Outdated
Comment thread src/Aspire.Cli/Commands/DashboardCommand.cs Outdated
Comment thread src/Aspire.Cli/Commands/DashboardCommand.cs Outdated
Comment thread src/Aspire.Cli/Commands/DashboardCommand.cs Outdated
@MermaidIsla
Copy link
Copy Markdown
Contributor

Would it make sense to have an alias aspire dash ?

@KalleOlaviNiemitalo
Copy link
Copy Markdown

To me, aspire dash sounds too much like it would run a dash shell.

@JamesNK JamesNK force-pushed the cli-dashboard-command branch from 56a4214 to 2514d2c Compare March 30, 2026 12:57
@JamesNK JamesNK changed the title Add 'aspire dashboard' CLI command Add aspire dashboard CLI command and introduce unified IProcessExecutionFactory Mar 30, 2026
@JamesNK JamesNK marked this pull request as ready for review March 30, 2026 13:33
@JamesNK JamesNK requested a review from adamint as a code owner March 30, 2026 13:33
Copy link
Copy Markdown
Member

@adamint adamint left a comment

Choose a reason for hiding this comment

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

couple thoughts on the command shape:

aspire ps won't find a standalone dashboard — it discovers running AppHosts via backchannel sockets in ~/.aspire/cli/backchannels, and aspire dashboard doesn't register anything there. so once you start a dashboard you have no way to get the URL/token/status back from the CLI. do we need a different mechanism for dashboards?

feels like this should be aspire dashboard start rather than just aspire dashboard — leaves room for aspire dashboard stop/aspire dashboard status later, and matches the pattern we already have with config, secret, otel, certs, etc.

also, should this support --detach? aspire run already has it and a standalone dashboard seems like an even better candidate for running in the background. related — does the standalone dashboard need --isolated support to avoid port conflicts if someone's already running an AppHost with its own dashboard or if people want to start multiple?

@JamesNK
Copy link
Copy Markdown
Member Author

JamesNK commented Apr 1, 2026

Yes I had the same thoughts. Right now this is basically aspire run but for the dashboard. We start the dashboard, print its information out, capture its output for logs, and that's it.

If we want aspire dashboard start so it runs in the background then we would also need a way to:

  • Registered what running dashboards there are
  • Get their information (e.g. public URL)
  • Trigger shutdown for an instance (identify instances by the public URL?)
  • Dashboard commands for start/stop/ps

It becomes a lot more complicated.

@davidfowl How far do you want to go with this?

@davidfowl
Copy link
Copy Markdown
Contributor

I think we do aspire dashboard run and leave it as a blocking command. Which also leaves it for space to grow so we don;t need to do the background work right now.

@JamesNK JamesNK force-pushed the cli-dashboard-command branch from 87c7d5c to eb9af53 Compare April 1, 2026 05:19
@JamesNK
Copy link
Copy Markdown
Member Author

JamesNK commented Apr 1, 2026

I think we do aspire dashboard run and leave it as a blocking command. Which also leaves it for space to grow so we don;t need to do the background work right now.

Done

@JamesNK JamesNK force-pushed the cli-dashboard-command branch from eb9af53 to 21da5d3 Compare April 1, 2026 09:21
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

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.

@JamesNK
Copy link
Copy Markdown
Member Author

JamesNK commented Apr 1, 2026

E2E test added: https://asciinema.org/a/RsxumCjxMzMArNWh

Copy link
Copy Markdown
Contributor

@davidfowl davidfowl left a comment

Choose a reason for hiding this comment

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

Looks pretty good!

@JamesNK JamesNK force-pushed the cli-dashboard-command branch from 90950ec to 6eeba7f Compare April 3, 2026 21:33
JamesNK added 2 commits April 4, 2026 06:09
…rt-failure error message

- Remove 'using' on execution in DotNetCliRunner.ExecuteAsync to prevent
  ObjectDisposedException when StartBackchannelAsync accesses the process
  after the method returns (fire-and-forget pattern).
- Add dedicated DashboardFailedToStart resource string for process start
  failures instead of reusing the exit-code format string.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

🎬 CLI E2E Test Recordings — 56 recordings uploaded (commit d74fd25)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AllPublishMethodsBuildDockerImages ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DashboardRunWithOtelTracesReturnsNoTraces ▶️ 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
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ 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 #23964436218

@JamesNK JamesNK changed the title Add aspire dashboard CLI command and introduce unified IProcessExecutionFactory Add aspire dashboard CLI command Apr 4, 2026
@JamesNK JamesNK merged commit ec8bbdf into main Apr 4, 2026
264 checks passed
@JamesNK JamesNK deleted the cli-dashboard-command branch April 4, 2026 00:12
@joperezr joperezr added this to the 13.3 milestone Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants