Skip to content

[release/17.0] Show repository and ref in template picker group headings - #22110

Closed
Mitch Denny (mitchdenny) wants to merge 1 commit into
release/17.0from
mitchdenny-backport-21831-to-17-0
Closed

Mitch Denny (mitchdenny) wants to merge 1 commit into
release/17.0from
mitchdenny-backport-21831-to-17-0

Conversation

@mitchdenny

Copy link
Copy Markdown
Member

Description

Backport of #21831 to release/17.0, preserving provenance from commit db62c3556439a1139d969b394869585c657d7df8 with git cherry-pick -x. Applied without conflicts to the live release tip cec195f2d0bf3f1d714badf74f205fa855fdf963; the patch matches the original exactly.

Layer 1 of 4 in the requested backport stack: #21831 → #21883 → #21855 → #21852. This bottom layer targets release/17.0; higher-layer PRs are forthcoming and will target the preceding layer. This PR contains only #21831. It provides SelectionChoiceGroup.Style and configured-template metadata needed by #21855. No new dependencies; stack metadata will be registered separately when all four PRs exist. Do not merge layers independently of the coordinated set.

Customers using configured template sources can see the repository and configured ref (or directory path) directly in aspire new source headings, while retaining friendly names. Selection identity, acquisition, trust/consent behavior, and the extension's flat-choice protocol remain unchanged.

User-facing usage

Run aspire new with configured template sources. Example headings:

Company templates (https://github.com/example/templates @ release/templates)
company (https://github.com/example/templates @ default branch)
Company templates (/work/templates)

Screenshots / Recordings

This PR includes CLI prompt changes. TODO: add screenshots or a recording of aspire new with Git and directory template sources, including a narrow terminal. No screenshots or recordings are attached. Rendered console snapshots cover full headings at 120 columns and literal-text escaping/cropping at 40 columns.

Validation

  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class '*.NewCommandLocalTemplateTests' --filter-class '*.ConsoleInteractionServiceTests' --filter-class '*.ExtensionInteractionServiceTests' --filter-class '*.TemplateSourceConfigurationTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' — passed: 750 tests, 0 failed, 0 skipped.
  • git diff --check origin/release/17.0...HEAD — passed.
  • git diff origin/release/17.0...HEAD | git patch-id --stable and git show --format= db62c3556439a1139d969b394869585c657d7df8 | git patch-id --stable — passed: identical patch ID a7647278352501d4cd7763d66ffbe3dd4e25b539.

Quarantined/outerloop tests, manual interactive capture, and the full repository suite were not run.

Fixes # (issue)

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

Customer Impact

Configured template sources previously appeared under only a friendly name or alias, making it difficult for users to tell which repository and ref supply a template. The picker now shows that provenance, or the directory path for local sources.

Testing

Focused release-branch CLI validation passed all 750 tests, including configured/default refs, alias fallback, directory and inherited sources, duplicate names, credential-bearing source rejection, literal markup handling, and terminal-width cropping. Exact command and patch-equivalence results are recorded above.

Risk

Low. This is a localized CLI presentation and metadata change with existing literal-text escaping and width cropping preserved; selection identity, acquisition, and consent semantics are unchanged.

Regression?

Unknown — the source PR does not identify this as a regression or name an affected release.

## Description

Configured template sources currently appear in the `aspire new` picker
under a friendly name or alias alone, making it difficult to tell which
repository and ref will supply a template. Show that provenance directly
in each source heading while retaining the friendly name.

Git headings now use `Name (repository @ ref)`. An omitted ref is
explicitly displayed as `default branch`, rather than guessing a branch
name or displaying the acquired commit. Directory headings use `Name
(path)` instead. Built-in grouping, collision-safe source IDs and
selections, trust/consent behavior, acquisition semantics, and the
extension's flat-choice protocol remain unchanged. Existing literal-text
escaping and terminal-width cropping apply to the expanded headings.

Follow-up to #21754. No new dependencies.

### User-facing usage

Run `aspire new` with configured template sources. Example headings:

```text
Company templates (https://github.com/example/templates @ release/templates)
company (https://github.com/example/templates @ default branch)
Company templates (/work/templates)
```

### Screenshots / Recordings

> **This PR includes CLI prompt changes.** TODO: add a screenshot or
recording of `aspire new` with Git and directory sources, including a
narrow terminal.
>
> Rendered console snapshots cover full headings at 120 columns and
literal-text escaping/cropping at 40 columns. No screenshot or recording
is attached.

<!-- Add screenshots/recordings here -->

### Validation

- `./restore.sh` — passed.
- `dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj
--no-launch-profile -- --filter-class '*.NewCommandLocalTemplateTests'
--filter-class '*.ConsoleInteractionServiceTests' --filter-class
'*.ExtensionInteractionServiceTests' --filter-class
'*.TemplateSourceConfigurationTests' --filter-not-trait
'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 750
tests.
- `git diff --check` — passed.

Coverage includes configured/default refs, commit and fully qualified
branch refs, friendly names and alias fallback, directory sources,
inherited sources, duplicate names, credential-bearing source rejection,
markup-containing locations, and width-aware rendering. Git acquisition
uses the existing test runner, not live repositories.
Quarantined/outerloop tests and the full repository suite were not run.

Fixes # (issue)

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] 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
  - [x] 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
  - [x] No

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit db62c35)
@JamesNK

Copy link
Copy Markdown
Member

Stop. It's here: #22109

@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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22110

Or

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

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

2 / 101 PR test projects · 4 PR jobs, from 12 changed files.

Selected PR test projects (2 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

📦 affected project Aspire.Cli
→ 1 test: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.Tests/Commands/NewCommandLocalTemplateTests.ConfiguredGitSources.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Commands/NewCommandLocalTemplateTests.ConfiguredSources.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Commands/NewCommandLocalTemplateTests.InitConfig.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Interaction/ConsoleInteractionServiceTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/ConsoleInteractionServiceTests.PromptForSelectionAsync_TemplateSourceHeadingsAreLiteralAndFitWidth_gitSource=False_width=120.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/ConsoleInteractionServiceTests.PromptForSelectionAsync_TemplateSourceHeadingsAreLiteralAndFitWidth_gitSource=False_width=40.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/ConsoleInteractionServiceTests.PromptForSelectionAsync_TemplateSourceHeadingsAreLiteralAndFitWidth_gitSource=True_width=120.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/ConsoleInteractionServiceTests.PromptForSelectionAsync_TemplateSourceHeadingsAreLiteralAndFitWidth_gitSource=True_width=40.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Commands/NewCommand.cs, src/Aspire.Cli/Interaction/ConsoleInteractionService.cs, src/Aspire.Cli/Interaction/SelectionChoiceGroup.cs, src/Aspire.Cli/Templating/ConfiguredTemplateSourceService.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 080e7e0.

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.

2 participants