Skip to content

Show configured templates in the initial aspire new picker - #21754

Merged
Mitch Denny (mitchdenny) merged 8 commits into
mainfrom
mitchdenny-unified-template-picker
Nov 5, 2026
Merged

Mitch Denny (mitchdenny) merged 8 commits into
mainfrom
mitchdenny-unified-template-picker

Conversation

@mitchdenny

@mitchdenny Mitch Denny (mitchdenny) commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Description

Show templates from configured Git and directory sources alongside built-in templates in interactive aspire new, without a separate source submenu. This builds on #21329, #21388, and #21420; it does not close those already-merged issues/PRs.

The terminal picker uses nonselectable source headings, retains built-in ordering and defaults, and selects the exact discovered template object even when names collide. Leaves use Template Name (Template Description) without repeating the source or short name; missing descriptions leave just the name. The separate search action has been removed from the initial picker; explicit template search/invocation support is unchanged.

Template source objects support optional displayName in global and accepted init-source configuration, for example:

{
  "templateSources": {
    "company": {
      "repository": "https://github.com/example/templates",
      "displayName": "Company templates"
    }
  }
}

Missing, null, empty, or space-only display names use the alias. Other types and control characters fail existing strict configuration validation. aspire config set templateSources.company.displayName "Company templates" --global edits an existing source; no new flag is added. Typed load/save, source listing, configuration edits and runtime inheritance preserve the field. Global-over-inherited alias collisions replace the entire definition, including the display name. Inherited values are never persisted to global or generated-project configuration.

Aliases remain the stable group identity, command reference and source-disambiguating flat label; identical display names do not merge sources or select a different source. Headings now use bold/default foreground, following existing CLI section headings such as aspire doctor, rather than Spectre's faded disabled grey. Leaf-only navigation is unchanged.

Grouped console labels normalize multiline whitespace and truncate the combined name/description with an ellipsis to the available terminal-cell width, reserving arrow, indentation and padding. Source headings and the selected-value echo also fit the width. Spectre's cell-aware cropping preserves grapheme clusters, wide characters and combining sequences; metadata is safely escaped. Full template metadata is retained.

The pinned Spectre.Console 0.57.2 uses the same converter for display and search and has no separate search predicate. Following the explicit UX decision to keep Spectre and truncate in the CLI, case-insensitive search matches only the visible prefix of a truncated label, not its hidden tail. No dependency update or custom prompt is introduced. Type-to-search moves to a matching choice; it does not filter the list.

Grouping and terminal display labels are optional interaction-service metadata. VS Code retains the unchanged flat string[] RPC and complete unique source-qualified labels; extension grouping and description search remain deferred. Existing inherited-source consent/no-fetch boundaries, explicit and noninteractive flows, source acquisition warnings, cached snapshots, authentication protections, and post-action authorization remain intact.

Validation for the latest friendly-heading revision:

dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class '*.ConsoleInteractionServiceTests' --filter-class '*.ExtensionInteractionServiceTests' --filter-class '*.NewCommandLocalTemplateTests' --filter-class '*.TemplateSourceConfigurationTests' --filter-class '*.AspireConfigFileTests' --filter-class '*.ConfigSourceServiceTests' --filter-class '*.SettingsSchemaBuilderTests' --filter-class '*.ConfigCommandTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'

Result: 1048 passed, 0 failed, 1 skipped. Covers typed serialization and schema, strict field validation, source updates/listing, inherited display names without persistence, complete global alias precedence, duplicate friendly headings and exact template generation, consent/no-fetch, unchanged extension fallback, terminal cell-width thresholds and narrow terminals, Unicode/combining sequences, escaped markup, normalized multiline labels and visible-prefix-only search. Rendering and configuration snapshots were reviewed and the suite rerun successfully.

dotnet build /t:UpdateXlf src/Aspire.Cli/Aspire.Cli.csproj -v:q
git diff --check

Result: both passed. Localized display-name validation and allowed-field diagnostics regenerated.

A refreshed screenshot of the actual repository-built CLI, with friendly source names, bold/default headings and a long description cropped with an ellipsis, is provided in the associated Copilot handoff, not uploaded GitHub media. Earlier screenshots and the description-search recording predate these latest formatting changes. No cloud resources or external account changes were used.

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

@github-actions

github-actions Bot commented Nov 4, 2026

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 -- 21754

Or

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

@github-actions

This comment has been minimized.

Copilot AI left a comment

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.

🟡 Changes recommended

Direct selection of configured templates from the initial picker lacks terminal end-to-end coverage, leaving keyboard selection and generation unverified outside the search flow.

1 open issue
What changed in this PR

This PR makes configured Git and directory templates discoverable in the initial interactive aspire new picker, alongside built-in templates.

Changes:

  • Adds source-qualified configured entries while preserving built-in ordering and exact template identity.
  • Reuses existing discovery and consent handling, with tests for collisions, source failures, and no-fetch boundaries.
  • Documents the initial-picker behavior and discovery exclusions.
File Description
tests/​Aspire.Cli.Tests/​Commands/​NewCommandLocalTemplateTests.SourceListGit.cs Tests inherited-source consent, cached decline, and global sources.
tests/​Aspire.Cli.Tests/​Commands/​NewCommandLocalTemplateTests.InitConfig.cs Updates configuration-source tests for direct picker selection.
tests/​Aspire.Cli.Tests/​Commands/​NewCommandLocalTemplateTests.ConfiguredSources.cs Tests directory-template selection, duplicate labels, and built-in-only exclusions.
tests/​Aspire.Cli.Tests/​Commands/​NewCommandLocalTemplateTests.ConfiguredGitSources.cs Covers direct Git-template selection, collisions, failures, and no-fetch boundaries.
tests/​Aspire.Cli.Tests/​Commands/​NewCommandLocalTemplateTests.ConfiguredGitSourceObjects.cs Updates scoped-source and Git-ref tests for initial selection.
src/​Aspire.Cli/​Commands/​NewCommand.cs Adds configured templates to the initial picker and shares unique-label handling.
docs/​specs/​git-templating.md Documents picker discovery, source identity, warnings, and exclusions.

Review effort: Balanced

Comment thread src/Aspire.Cli/Commands/NewCommand.cs Resolved
@github-actions

This comment has been minimized.

Copilot AI left a comment

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.

🔵 Needs a closer look

Hex1b end-to-end coverage is missing for selecting a configured template directly from the initial grouped picker and verifying source-specific generated output.

1 open issue
1 file not reviewed
  • src/Aspire.Cli/Resources/NewCommandStrings.Designer.cs: Generated file

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

This comment has been minimized.

Copilot AI left a comment

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.

🟡 Changes recommended

The existing E2E scenario still waits for removed search prompts and will time out; it needs updating to use the grouped picker and exercise description-only type-to-search.

2 open issues
1 file not reviewed
  • src/Aspire.Cli/Resources/NewCommandStrings.Designer.cs: Generated file

Review effort: Balanced

Comment thread src/Aspire.Cli/Commands/NewCommand.cs Resolved
@github-actions

This comment has been minimized.

Copilot AI left a comment

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.

🔵 Needs a closer look

The existing configured-source E2E test still drives the removed search/retry/back flow, causing it to time out before template selection; it must be updated for the grouped picker while retaining generated-output assertions.

2 open issues
1 file not reviewed
  • src/Aspire.Cli/Resources/NewCommandStrings.Designer.cs: Generated file

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copilot AI left a comment

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.

🔵 Needs a closer look

The configured-template E2E test still waits for removed search prompts, causing a deterministic timeout, and must be updated to search and select within the unified picker.

2 open issues
1 file not reviewed
  • src/Aspire.Cli/Resources/NewCommandStrings.Designer.cs: Generated file

Review effort: Balanced

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 4, 2026 11:43

Copilot AI left a comment

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.

🔵 Needs a closer look

The configured-template E2E scenario still waits for removed submenu prompts and will time out before generation, so it needs updating to exercise the new picker and retain generated-output assertions.

2 open issues
1 file not reviewed
  • src/Aspire.Cli/Resources/NewCommandStrings.Designer.cs: Generated file

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues are identified for the configured-template picker changes.

No open issues 🎉

2 resolved since last review
1 file not reviewed
  • src/Aspire.Cli/Resources/NewCommandStrings.Designer.cs: Generated file

Review effort: Balanced

Share invocation-scoped warning state across init configuration, templates, and other source consumers while retaining consent prompts and warnings in subsequent commands.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Tests selector

3 / 101 PR test projects · 4 PR jobs, from 58 changed files.

Selected PR test projects (3 / 101)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Infrastructure.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

🔧 src/Aspire.Cli/Resources/NewCommandStrings.resx (changed source)
→ 1 directly: Infrastructure.Tests

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

🧪 tests/Aspire.Cli.Tests/Commands/NewCommandLocalTemplateTests.ConfiguredGitSourceObjects.cs (changed test)
→ 1 directly: Aspire.Cli.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/Commands/NewCommandLocalTemplateTests.SourceListGit.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

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

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

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

🧪 tests/Aspire.Cli.Tests/Configuration/ConfigSourceServiceTests.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/Interaction/ExtensionInteractionServiceTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/AspireConfigFileTests.LoadAndSave_PreservesTypedTemplateSourcesAndUnmodeledSettings.verified.json (changed test)
→ 1 directly: Aspire.Cli.Tests

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

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

🧪 tests/Aspire.Cli.Tests/Snapshots/ConsoleInteractionServiceTests.PromptForSelectionAsync_GroupedLabelsFitWidthAndNormalizeMetadata.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/ConsoleInteractionServiceTests.PromptForSelectionAsync_GroupsRenderAsHeadingsAndKeepFirstLeafDefault.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/ConsoleInteractionServiceTests.PromptForSelectionAsync_GroupsWithSameIdShareOneHeadingAndRetainChildOrder.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/NewCommandLocalTemplateTests.ConfiguredSources_DescriptionAppearsInPickerWithoutSeparateSearchPrompt.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/NewCommandLocalTemplateTests.ConfiguredSources_NoMatchesCanSearchAgainAndGenerate.verified.txt (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Snapshots/NewCommandLocalTemplateTests.InitConfigSources_ListJsonIncludesInheritedSourcesWithoutSavingConfiguration.verified.json (changed test)
→ 1 directly: Aspire.Cli.Tests

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

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

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

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

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

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

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/CliExecutionContext.cs, src/Aspire.Cli/Commands/AddCommand.cs, src/Aspire.Cli/Commands/AgentInitCommand.cs, src/Aspire.Cli/Commands/BaseCommand.cs, src/Aspire.Cli/Commands/NewCommand.cs, src/Aspire.Cli/Commands/TemplateManagementCommand.cs, src/Aspire.Cli/Configuration/AspireConfigFile.cs, src/Aspire.Cli/Configuration/ConfigSourceService.cs, src/Aspire.Cli/Interaction/ConsoleInteractionService.cs, src/Aspire.Cli/Interaction/ExtensionInteractionService.cs, src/Aspire.Cli/Interaction/IInteractionService.cs, src/Aspire.Cli/Interaction/SelectionChoiceGroup.cs, src/Aspire.Cli/Resources/NewCommandStrings.Designer.cs, src/Aspire.Cli/Resources/NewCommandStrings.resx, src/Aspire.Cli/Resources/xlf/NewCommandStrings.cs.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.de.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.es.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.fr.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.it.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.ja.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.ko.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.pl.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.pt-BR.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.ru.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.tr.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.zh-Hans.xlf, src/Aspire.Cli/Resources/xlf/NewCommandStrings.zh-Hant.xlf, src/Aspire.Cli/Templating/ConfiguredTemplateSourceService.cs, src/Aspire.Cli/Templating/TemplateEngineFactory.cs, src/Aspire.Cli/Templating/TemplateSourceConfiguration.cs, src/Aspire.Cli/Utils/ConsoleHelpers.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit 9f6929e.

Copilot AI left a comment

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.

🟢 Approval recommended

There are no active review issues requiring resolution.

No open issues 🎉

1 file not reviewed
  • src/Aspire.Cli/Resources/NewCommandStrings.Designer.cs: Generated file

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@mitchdenny
Mitch Denny (mitchdenny) merged commit 6abf8ab into main Nov 5, 2026
427 of 430 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Nov 5, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #2057

Generated by PR Documentation Check · copilot · auto · 27.6 AIC · ⌖ 1.16 AIC · ⊞ 7.4K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#2057 targeting release/17.0.

Updated aspire new reference: template picker now shows configured sources under headings, and optional displayName for templateSources. Signals: cli_command_file_changed (NewCommand.cs), cli_resource_strings_changed (NewCommandStrings.resx), pr_body_has_cli_flag_mention. Modified: reference/cli/commands/aspire-new.mdx.

Note

This draft PR needs human review before merging.

Ankit Jain (radical) pushed a commit that referenced this pull request Nov 7, 2026
## 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>
Mitch Denny (mitchdenny) added a commit that referenced this pull request Nov 10, 2026
## 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)
Mitch Denny (mitchdenny) added a commit that referenced this pull request Nov 10, 2026
## 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)
Mitch Denny (mitchdenny) added a commit to microsoft/aspire.dev that referenced this pull request Nov 17, 2026
## Summary

Documents the CLI changes from microsoft/aspire#21754 (configured
templates in the `aspire new` picker), together with the related
template-source command reference. This PR now **consolidates #1974 and
#1983**, which are being closed in favor of this one.

- `aspire new`: new **Select a template** section that describes the
grouped picker, entry labels, truncation, and search behavior. A
**Configure template sources** subsection links to `aspire template
source add` and `remove` instead of encouraging direct config-file
edits.
- New reference pages: `aspire template`, `aspire template source`,
`aspire template source add` (trust confirmation and `--yes`, from
#1983), `aspire template source list`, and `aspire template source
remove`.
- Registers the new pages under an **aspire template** group in the CLI
reference sidebar, and adds `aspire template` to the root `aspire`
command table.
- Adds `cli-command-sidebar.vitest.test.ts` (from #1983), which ensures
that every CLI command page appears in the sidebar.

Validated against the `release/17.0` CLI source:

- `add` takes `name`, `--path`, `--repository`, `--ref`, and `-y/--yes`.
It has no display-name option.
- Source names must be 1–64 ASCII letters, digits, dots, hyphens, or
underscores, starting with a letter or digit.
- `add` fails if the name already exists.
- `list` supports `--format`.

#1974's "Search for more templates" section was dropped because #21754
replaced it with the grouped picker.

## Third-party links and affiliations

None

## Validation

- `npx vitest run --config vitest.config.ts
tests/unit/cli-command-sidebar.vitest.test.ts
tests/unit/seo-lengths.vitest.test.ts
tests/unit/cli-config-schema.vitest.test.ts` (in `src/frontend`): passed
(18 tests)
- `npx prettier --check` and `npx eslint --max-warnings 0` on the
sidebar config and new test: passed
- Live preview via `aspire start --isolated`: all seven changed or new
command pages return 200 and show the new sidebar entries.
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.

4 participants