-
Notifications
You must be signed in to change notification settings - Fork 659
Description
Root cause
PublishCommandBase.HandlePromptActivityAsync
builds the prompt text like so:
var promptText = inputs.Count > 1
? $"{input.Label}: "
: $"[bold]{activity.Data.StatusText}[/]";
- For multi-input prompts (
inputs.Count > 1
) the label is displayed (input.Label
). - For a single input the label is ignored, and only
StatusText
is shown.
Because PublishingActivityReporter
uses StatusText
for narrative context (e.g., “Configure deployment target”), not for the field label, the prompt becomes ambiguous.
Proposed fix
- Always prefer
input.Label
when it is provided, even for single inputs. - For single-input prompts, prepend the bold header (
StatusText
) only when it is different from the label, avoiding duplication. - Escape Spectre.Console markup in both
StatusText
andLabel
.
Illustrative helper:
private static string BuildPromptText(
PublishingPromptInput input,
int inputCount,
string statusText)
{
if (inputCount > 1)
return $"{input.Label.EscapeMarkup()}: ";
// Single-input path
var header = statusText ?? string.Empty;
var label = input.Label ?? string.Empty;
if (header.Equals(label, StringComparison.OrdinalIgnoreCase))
return $"{label.EscapeMarkup()}: ";
return $"[bold]{header.EscapeMarkup()}[/] {label.EscapeMarkup()}: ";
}
Acceptance criteria
- A single-input prompt displays both context (
StatusText
) and the field label (Label
), formatted as:
<StatusText> <Label>:
separated by a new line - If
StatusText
equalsLabel
, the prompt shows only the label once. - Multi-input prompts remain unchanged.
- Unit tests cover: single input, multi input,
StatusText
=Label
, and Spectre markup escaping.
Tasks
- Update
PublishCommandBase.HandlePromptActivityAsync
(or extract a helper) with the logic above. - Add/adjust unit tests in
Aspire.Cli.Tests
verifying correct console output. - Run
dotnet test
and ensure all publishing CLI tests pass. - (Optional) document the prompt behavior in the publishing CLI README.
Copilot