Skip to content

Use 'aspire logs' command for viewing resource logs in extension#15094

Merged
adamint merged 1 commit intomicrosoft:release/13.2from
adamint:dev/adamint/aspire-logs-command
Mar 10, 2026
Merged

Use 'aspire logs' command for viewing resource logs in extension#15094
adamint merged 1 commit intomicrosoft:release/13.2from
adamint:dev/adamint/aspire-logs-command

Conversation

@adamint
Copy link
Copy Markdown
Member

@adamint adamint commented Mar 10, 2026

Description

The aspire logs command was introduced as a top-level CLI command (instead of aspire resource <name> logs). This PR updates the VS Code extension's "View Logs" tree action to use the new aspire logs "<resource>" --apphost "<path>" --follow command shape instead of routing through the resource subcommand.

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
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings March 10, 2026 06:55
@github-actions
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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15094

Or

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

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

Updates the VS Code Aspire extension’s “View Logs” action to use the new top-level aspire logs CLI command (instead of routing through aspire resource <name> logs), aligning the extension with the updated CLI command shape.

Changes:

  • Switch “View Logs” to run aspire logs "<resource>" --apphost "<path>" --follow.
  • Resolve the correct AppHost for the selected resource before issuing the logs command.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +292 to +296
const appHost = this._findAppHostForResource(element);
if (!appHost) {
return;
}
this._terminalProvider.sendAspireCommandToAspireTerminal(`logs "${element.resource.name}" --apphost "${appHost.appHostPath}" --follow`);
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

sendAspireCommandToAspireTerminal supports an additionalArgs array with platform-specific quoting/escaping, but this code builds a single interpolated command string with manual double-quoting. If resource names/paths ever contain characters like quotes, $, or backticks, this may not behave consistently across shells. Consider switching to sendAspireCommandToAspireTerminal('logs', ..., additionalArgs) (passing the resource name, --apphost, path, and --follow as separate args) and optionally making this method async/awaiting the call for clearer error propagation.

Copilot uses AI. Check for mistakes.
if (!appHost) {
return;
}
this._terminalProvider.sendAspireCommandToAspireTerminal(`logs "${element.resource.name}" --apphost "${appHost.appHostPath}" --follow`);
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

This change updates the exact CLI command shape used for the "View Logs" action, but there’s no unit test asserting the constructed command. Consider adding a small test that mocks AspireTerminalProvider and verifies the logs <resource> --apphost <path> --follow invocation to prevent regressions when CLI command shapes change again.

Copilot uses AI. Check for mistakes.
@adamint adamint merged commit 9a1f142 into microsoft:release/13.2 Mar 10, 2026
501 of 504 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants