aspire-init
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAspire Init
Aspire Init
First-run only. This skill owns the skeleton drop and template choice for repositories that do not yet have an Aspire AppHost. Once the skeleton is in place, hand off tofor the actual resource wiring.aspireify
仅首次运行适用。本技能负责为尚未拥有Aspire AppHost的仓库完成骨架生成和模板选择。骨架生成完成后,将实际的资源连接工作交接给。aspireify
Prerequisites
前提条件
| Requirement | Install |
|---|---|
| .NET 10.0 SDK | https://dotnet.microsoft.com/download |
Node.js | https://nodejs.org |
| Aspire CLI (curl installer) | |
| Aspire CLI (npm) | |
| Aspire CLI (NativeAOT global tool) | |
| Diagnose missing prerequisites | |
Aspire also supports Nix, Homebrew, WinGet, mise, and the curl/PowerShell installers. Use the installation method already owned by the user's environment.
| 要求 | 安装方式 |
|---|---|
| .NET 10.0 SDK | https://dotnet.microsoft.com/download |
Node.js | https://nodejs.org |
| Aspire CLI(curl安装器) | |
| Aspire CLI(npm) | |
| Aspire CLI(NativeAOT全局工具) | |
| 诊断缺失的前提条件 | |
Aspire还支持Nix、Homebrew、WinGet、mise以及curl/PowerShell安装器。请使用用户环境中已采用的安装方式。
Detection
检测逻辑
Activate only when adding Aspire to a workspace that does not yet have one. Confirm ALL
of the following before running :
aspire init| Signal | How to Detect | Meaning |
|---|---|---|
| No C# AppHost | No | OK to init |
| No file-based AppHost | No | OK to init |
| No TypeScript AppHost | No current | OK to init |
| No Aspire config | No | OK to init |
| User intent | Explicit "add Aspire", "scaffold Aspire", "aspire init" | OK to init |
If any AppHost signal is already present, do not run . Route to
(re-wire) or
(lifecycle).
aspire initaspireifyaspire-orchestration仅在向尚未拥有AppHost的工作区添加Aspire时激活。运行前需确认以下所有条件:
aspire init| 信号 | 检测方式 | 含义 |
|---|---|---|
| 无C# AppHost | 不存在包含 | 可执行init |
| 无文件型AppHost | 不存在包含 | 可执行init |
| 无TypeScript AppHost | 仓库中不存在当前版本的 | 可执行init |
| 无Aspire配置 | 仓库根目录不存在 | 可执行init |
| 用户意图 | 明确提出“添加Aspire”、“搭建Aspire脚手架”、“aspire init” | 可执行init |
Decision: aspire new
vs aspire init
aspire newaspire init决策:aspire new
vs aspire init
aspire newaspire init| Situation | Command | Why |
|---|---|---|
| Empty directory or brand-new project | | Generates a full starter solution |
| Existing repo with services to model | | Drops minimal skeleton + |
| User wants a sample to learn from | | Includes ApiService + Web + ServiceDefaults |
| User wants the smallest possible scaffold | | No resources pre-wired |
| User wants Python services | | Not |
See references/templates.md for the complete template list and
options.
| 场景 | 命令 | 原因 |
|---|---|---|
| 空目录或全新项目 | | 生成完整的入门解决方案 |
| 包含待建模服务的现有仓库 | | 在现有代码旁生成最小化骨架 + |
| 用户需要学习用的示例 | | 包含ApiService + Web + ServiceDefaults |
| 用户需要最小化脚手架 | | 无预连接资源 |
| 用户需要Python服务 | | 请勿使用 |
完整模板列表和选项请参考references/templates.md。
Workflow A — aspire new <template>
(new project)
aspire new <template>工作流A — aspire new <template>
(新项目)
aspire new <template>For brand-new projects in an empty or non-existent directory:
- Confirm prerequisites with if the CLI install is uncertain.
aspire doctor - Pick a template from references/templates.md.
- Run the template, append for agent flows:
--non-interactivebashaspire new aspire-starter --name MyApp --output ./MyApp --non-interactive - The new directory is fully wired by the template — no aspireify handoff needed.
- Route to for first run (
aspire-orchestration).aspire start
针对空目录或不存在的目录中的全新项目:
- 若CLI安装情况不确定,使用确认前提条件。
aspire doctor - 从references/templates.md中选择模板。
- 运行模板,在Agent流程中添加参数:
--non-interactivebashaspire new aspire-starter --name MyApp --output ./MyApp --non-interactive - 新目录已由模板完成完整配置——无需交接给aspireify。
- 转至进行首次运行(
aspire-orchestration)。aspire start
Workflow B — aspire init
(existing repo)
aspire init工作流B — aspire init
(现有仓库)
aspire initFor repositories that already contain services (Express API, .NET API, Python service, etc.)
and need an AppHost added alongside them:
- Verify the Detection table — confirm no AppHost is present.
- Run , choosing language explicitly for non-interactive flows:
aspire initbashaspire init --language csharp --non-interactive # or aspire init --language typescript --non-interactive - drops:
aspire init- The AppHost skeleton (with
apphost.csdirectives, or#:sdkwith the generatedapphost.mtsfolder).aspire/modules/ - AppHost configuration describing language + AppHost path
- The agent skill into the project's skill directory (same one
aspireifyuses)aspire agent init
- The AppHost skeleton (
- Hand off to —
aspireifydoes not wire resources, projects, or integrations on its own.aspire init - After finishes wiring, validate via
aspireify(aspire start).aspire-orchestration
In 13.5, a TypeScript init inside a repo that already has a root creates a
nested package and points the root at
. A solution-backed C# repo can receive a project-based AppHost;
new C# AppHosts enable by default. Preserve these generated choices.
package.jsonaspire-apphost/aspire.config.jsonaspire-apphost/apphost.mtsAspireUseCliBundle=trueSee references/init-workflow.md for the full sequence
including what contains and what to do if fails partway.
aspire.config.jsonaspire init针对已包含服务(Express API、.NET API、Python服务等)且需在旁添加AppHost的仓库:
- 验证检测逻辑表——确认无AppHost存在。
- 运行,在非交互式流程中明确指定语言:
aspire initbashaspire init --language csharp --non-interactive # 或 aspire init --language typescript --non-interactive - 会生成:
aspire init- AppHost骨架(包含指令的
#:sdk,或生成了apphost.cs文件夹的.aspire/modules/)apphost.mts - 描述语言 + AppHost路径的AppHost配置
- 项目技能目录中的****Agent技能(与
aspireify使用的目录相同)aspire agent init
- AppHost骨架(包含
- 交接给——
aspireify本身不会连接资源、项目或集成。aspire init - 完成资源连接后,通过
aspireify验证(aspire start)。aspire-orchestration
在13.5版本中,若仓库根目录已存在,在其中执行TypeScript init会创建嵌套的包,并将根目录的指向。基于解决方案的C#仓库可接收基于项目的AppHost;新的C# AppHost默认启用。请保留这些生成的设置。
package.jsonaspire-apphost/aspire.config.jsonaspire-apphost/apphost.mtsAspireUseCliBundle=true完整流程(包括的内容以及中途失败的处理方式)请参考references/init-workflow.md。
aspire.config.jsonaspire initHandoff Rules
交接规则
After | Route To |
|---|---|
| Skeleton dropped, resources need wiring | → |
| Skeleton dropped, validate it starts | → |
| New project from template, ready to run | → |
| User asks to deploy after init | → |
| User asks for logs/traces after init | → |
| Existing AppHost detected — do NOT run init | → |
| 转至 |
|---|---|
| 骨架已生成,资源需要连接 | → |
| 骨架已生成,验证是否能启动 | → |
| 从模板生成新项目,可直接运行 | → |
| 用户要求在init后部署 | → |
| 用户要求在init后查看日志/追踪 | → |
| 检测到已有AppHost — 请勿运行init | → |
Project-Local Skill Override
项目本地技能覆盖
If exists project-locally (legacy install from an
older run), warn the user and defer to it. The legacy project-local skill
may carry repo-specific guidance that should not be overridden by this in-plugin skill.
.agents/skills/aspire-init/SKILL.mdaspire initThe project-local skill (installed by ) takes precedence
over this plugin's in-plugin for the same reason — defer to the project-local
copy and warn.
aspireifyaspire initaspireify如果项目本地存在(由旧版运行安装的遗留版本),请向用户发出警告并优先使用该版本。遗留的项目本地技能可能包含仓库特定的指导,不应被插件内的技能覆盖。
.agents/skills/aspire-init/SKILL.mdaspire init出于相同原因,安装的项目本地技能优先于插件内的——请优先使用项目本地副本并发出警告。
aspire initaspireifyaspireifyError Handling
错误处理
| Symptom | Cause | Action |
|---|---|---|
| Repo already has an AppHost | Stop. Route to |
| Multiple language paths available | Re-run with |
| Path exists and is non-empty | Use a different |
| CLI not installed | |
| SDK missing | Install .NET 10 SDK before retrying |
| Agent skill directory not detected | Run |
| Skeleton dropped but resources not wired | Expected — | Hand off to |
Existing TypeScript AppHost still uses | Legacy entry point and package graph | Hand off to |
| 症状 | 原因 | 操作 |
|---|---|---|
| 仓库已包含AppHost | 停止操作。转至 |
| 存在多种语言路径可选 | 使用 |
| 路径已存在且非空 | 使用其他 |
找不到 | CLI未安装 | 执行 |
| SDK缺失 | 先安装.NET 10 SDK再重试 |
| 未检测到Agent技能目录 | 运行 |
| 骨架已生成但资源未连接 | 此为预期行为 — | 交接给 |
现有TypeScript AppHost仍使用 | 遗留入口点和包依赖图 | 转至 |
References
参考资料
- templates.md — templates and options
aspire new - init-workflow.md — flow,
aspire initlayout, andaspire.config.jsonhandoffaspireify - aspire-13-5-breaking-changes.md — 13.5.3 versions, migrations, and CLI-bundle behavior
- templates.md — 模板及选项
aspire new - init-workflow.md — 流程、
aspire init结构及aspire.config.json交接说明aspireify - aspire-13-5-breaking-changes.md — 13.5.3版本、迁移及CLI捆绑包行为