Add git repository-based templates for 'aspire new --template'#14631
Draft
mitchdenny wants to merge 3 commits intorelease/13.2from
Draft
Add git repository-based templates for 'aspire new --template'#14631mitchdenny wants to merge 3 commits intorelease/13.2from
mitchdenny wants to merge 3 commits intorelease/13.2from
Conversation
Introduce a new feature flag 'gitTemplatesEnabled' that enables using Git repositories as project templates. When enabled, adds a --template option to 'aspire new' that accepts a local path or remote Git URL. The GitTemplateService handles both local and remote templates: - Local paths: copies directory contents excluding .git/ - Remote URLs: git clone --depth 1, copy contents, clean up This is the first iteration of the git templates feature, providing basic file copy functionality. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14631Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14631" |
Contributor
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22331698740 |
When a git template contains a templatehost.cs file, it is now launched as a full apphost process using the existing backchannel infrastructure (DotNetCliRunner, JSON-RPC over Unix sockets). This allows template authors to use IInteractionService to prompt users during template application. Changes: - GitTemplateService: detect templatehost.cs, launch via DotNetCliRunner with backchannel, pass ASPIRE_TEMPLATE_OUTPUT_PATH env var - Aspire.Hosting.Templating: new package skeleton with TemplatePromptResource and AddTemplatePrompt() extension method - Added to Aspire.slnx Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…NewCommandPrompter Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a new feature flag
gitTemplatesEnabledthat enables using Git repositories as project templates. When enabled, adds a--templateoption toaspire newthat accepts a local path or remote Git URL.What's changed
gitTemplatesEnabled(default:false) inKnownFeatures--templateoption: Gated behind the feature flag, accepts a local directory path or a Git remote URLGitTemplateService: Handles both local and remote templates:.git/git clone --depth 1to a temp directory, copies contents, cleans upNewCommand.ExecuteAsync: When the feature is enabled and--templateis provided, it takes highest priority (before polyglot and standard template flows)--outputis not specifiedUsage
Enable the feature:
{ "features": { "gitTemplatesEnabled": true } }Then:
Notes
This is the first iteration of the git templates feature. Future iterations will add template variable substitution,
.aspire-template.jsonmanifest support, and more.