Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Aspire.Cli/Commands/PipelineCommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public async Task<bool> ProcessAndDisplayPublishingActivitiesAsync(IAsyncEnumera
{
var stepCounter = 1;
var steps = new Dictionary<string, StepInfo>();
var logger = new ConsoleActivityLogger(_hostEnvironment);
var logger = new ConsoleActivityLogger(_hostEnvironment, this.Name);
logger.StartSpinner();
PublishingActivity? publishingActivity = null;

Expand Down
15 changes: 14 additions & 1 deletion src/Aspire.Cli/Utils/ConsoleActivityLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal sealed class ConsoleActivityLogger
{
private readonly bool _enableColor;
private readonly ICliHostEnvironment _hostEnvironment;
private readonly string _commandName;
private readonly object _lock = new();

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The new field _commandName is placed between _hostEnvironment and _lock, disrupting the logical grouping of fields. Consider placing _commandName immediately after _hostEnvironment (line 20) and before _lock to maintain better field organization, as both _hostEnvironment and _commandName are constructor parameters that store configuration, while _lock begins the section of runtime state fields.

Suggested change
private readonly string _commandName;
private readonly object _lock = new();
private readonly object _lock = new();
private readonly string _commandName;

Copilot uses AI. Check for mistakes.
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private readonly Dictionary<string, string> _stepColors = new();
Expand All @@ -43,10 +44,11 @@ internal sealed class ConsoleActivityLogger
private const string InProgressSymbol = "→";
private const string InfoSymbol = "i";

public ConsoleActivityLogger(ICliHostEnvironment hostEnvironment, bool? forceColor = null)
public ConsoleActivityLogger(ICliHostEnvironment hostEnvironment, string commandName, bool? forceColor = null)
{
_hostEnvironment = hostEnvironment;
_enableColor = forceColor ?? _hostEnvironment.SupportsAnsi;
_commandName = commandName;

// Disable spinner in non-interactive environments
if (!_hostEnvironment.SupportsInteractiveOutput)
Expand Down Expand Up @@ -252,20 +254,31 @@ public void WriteSummary()
if (!string.IsNullOrEmpty(_finalStatusHeader))
{
AnsiConsole.MarkupLine(_finalStatusHeader!);

// If pipeline failed, show help message about using --log-level debug
if (!_pipelineSucceeded)
{
var helpMessage = _enableColor
? $"[dim]For more details, re-run with: aspire {_commandName} --log-level debug[/]"
: $"For more details, re-run with: aspire {_commandName} --log-level debug";
AnsiConsole.MarkupLine(helpMessage);
}
}
AnsiConsole.MarkupLine(line);
AnsiConsole.WriteLine(); // Ensure final newline after deployment summary
}
}

private string? _finalStatusHeader;
private bool _pipelineSucceeded;

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The _pipelineSucceeded field is placed after _finalStatusHeader but at a different location in the class than where other instance fields are declared (lines 19-37). For consistency and maintainability, consider moving both _finalStatusHeader and _pipelineSucceeded to the top of the class with the other private fields (after line 37, before the constants section starting at line 41).

Copilot uses AI. Check for mistakes.

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.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Moved _finalStatusHeader and _pipelineSucceeded fields to the top with other private fields for better organization. (47810f2)


/// <summary>
/// Sets the final deployment result lines to be displayed in the summary (e.g., DEPLOYMENT FAILED ...).
/// Optional usage so existing callers remain compatible.
/// </summary>
public void SetFinalResult(bool succeeded)
{
_pipelineSucceeded = succeeded;
// Always show only a single final header line with symbol; no per-step duplication.
if (succeeded)
{
Expand Down
Loading