aspire-orchestration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAspire Orchestration
Aspire 编排
MANDATORY COMPLIANCE — This skill prevents agent self-harm in Aspire projects. Violating these rules causes file locks, orphaned processes, and user frustration (#15801).
强制合规要求 —— 本技能可避免Aspire项目中的代理自损问题。 违反这些规则会导致文件锁、孤立进程和用户困扰(#15801)。
Prerequisites
前置条件
| Requirement | Install |
|---|---|
| .NET 10.0 SDK | https://dotnet.microsoft.com/download |
| Aspire CLI (curl/PowerShell) | |
| Aspire CLI (NativeAOT global tool, .NET 10) | |
Either install method works. The path produces a NativeAOT binary
(instant startup, no JIT warmup) and is the recommended option when .NET 10 is already present.
dotnet tool install| 要求 | 安装方式 |
|---|---|
| .NET 10.0 SDK | https://dotnet.microsoft.com/download |
| Aspire CLI(curl/PowerShell) | |
| Aspire CLI(NativeAOT全局工具,.NET 10) | |
两种安装方式均可。若已安装.NET 10,推荐使用方式,该方式会生成NativeAOT二进制文件(启动速度快,无需JIT预热)。
dotnet tool installDetection
检测机制
Activate when ANY signal is present:
| Signal | How to Detect | Confidence |
|---|---|---|
| C# AppHost | | ✅ Definitive |
| File-based C# AppHost | | ✅ Definitive |
| TypeScript AppHost | | ✅ Definitive |
| Aspire config | | High |
| Aspire settings | | High |
| Generated TS modules | | High |
| Service defaults | | Medium |
See detection.md for detailed fingerprinting.
当出现以下任一信号时激活本技能:
| 信号 | 检测方式 | 置信度 |
|---|---|---|
| C# AppHost | 包含 | ✅ 确定 |
| 基于文件的C# AppHost | 包含 | ✅ 确定 |
| TypeScript AppHost | 项目中的 | ✅ 确定 |
| Aspire配置 | 项目根目录下的 | 高 |
| Aspire设置 | 存在 | 高 |
| 生成的TS模块 | 存在 | 高 |
| 服务默认项 | 项目引用中包含 | 中 |
详细指纹识别规则请查看detection.md。
Safety Guardrails
安全防护规则
| Situation | ✅ ALWAYS Do | ❌ NEVER Do |
|---|---|---|
| Start an Aspire app | | |
| Wait for resource ready | | |
| Code changed in a resource | Prefer resource commands, runtime watch/HMR, dashboard actions, or IDE-managed debugging | |
| Task complete | | Leave processes running |
| Check resource status | | Manual process inspection |
| Working in git worktree | | |
| Running from AI agent | Add | Assuming interactive terminal |
| Editing unfamiliar API | | Guessing API shape |
| C# AppHost API inspection | Use | Guessing overloads or builder chains |
| Adding custom dashboard/resource commands | | Inventing |
| Installing Aspire support | Use | |
See safety-guardrails.md for detailed rules and recovery patterns.
| 场景 | ✅ 必须执行 | ❌ 禁止执行 |
|---|---|---|
| 启动Aspire应用 | | 在AppHost上执行 |
| 等待资源就绪 | | 使用 |
| 资源代码变更 | 优先使用资源命令、运行时监视/HMR、仪表板操作或IDE托管调试 | 对锁定文件执行 |
| 任务完成 | | 让进程持续运行 |
| 检查资源状态 | | 手动检查进程 |
| 在git工作树中操作 | | 不添加隔离参数直接执行 |
| 通过AI代理运行 | 为所有命令添加 | 假设终端为交互式 |
| 编辑不熟悉的API | 先执行 | 猜测API结构 |
| 检查C# AppHost API | (若可用)使用 | 猜测重载或构建链 |
| 添加自定义仪表板/资源命令 | 先执行 | 未查阅文档就自定义 |
| 安装Aspire支持 | 使用 | |
详细规则和恢复模式请查看safety-guardrails.md。
Default Workflow
默认工作流
- Confirm workspace is Aspire — identify the AppHost
- (or
aspire startin worktrees)aspire start --isolated - before interacting with any resource
aspire wait <resource> - to inspect state, then work
aspire describe - If AppHost code changed, rerun ; if only one resource changed, prefer the resource's commands/watch/HMR/debug workflow
aspire start - when cleanup is explicitly requested or needed to release locks/ports
aspire stop
- 确认工作区为Aspire项目——识别AppHost
- 执行(在工作树中执行
aspire start)aspire start --isolated - 与任何资源交互前执行
aspire wait <resource> - 执行检查状态,再开展操作
aspire describe - 若AppHost代码变更,重新执行;若仅单个资源变更,优先使用资源的命令/监视/HMR/调试工作流
aspire start - 当明确需要清理或释放锁/端口时,执行
aspire stop
Quick Reference
快速参考
| Task | Command |
|---|---|
| Start app (agents) | |
| Start app (human) | |
| Stop app | |
| Wait for resource | |
| Check status | |
| Show hidden resources (proxies, helpers, migrations) | |
| Resource operation | |
| Create new project | |
| Add Aspire to existing | |
| Add integration | |
| Discover integrations | |
| Upgrade the CLI itself | |
| Update project package refs | |
| Restore generated files | |
| Environment maintenance | |
| Diagnose environment | |
| Machine-readable output | |
| Look up API reference | |
| Browse API entries | |
| Get API detail | |
| 任务 | 命令 |
|---|---|
| 启动应用(代理) | |
| 启动应用(人工) | |
| 停止应用 | |
| 等待资源就绪 | |
| 检查状态 | |
| 显示隐藏资源(代理、辅助工具、迁移) | |
| 资源操作 | |
| 创建新项目 | |
| 为现有项目添加Aspire支持 | |
| 添加集成 | |
| 发现集成 | |
| 升级CLI本身 | |
| 更新项目包引用 | |
| 恢复生成的文件 | |
| 环境维护 | |
| 诊断环境 | |
| 机器可读输出 | |
| 查找API参考 | |
| 浏览API条目 | |
| 获取API详情 | |
Error Handling
错误处理
| Symptom | Cause | Action |
|---|---|---|
File lock errors during build ( | Aspire is running and holds locks on | Run |
| "Port already in use" | Previous instance running | |
| Resource not found | App not started or name wrong | |
| Build errors in resource | Code error, not Aspire issue | Fix code, then use resource commands/watch/HMR/debug workflow or rerun |
| Environment issues | Missing SDK or tools | |
JSON parse failure from | Mixed human/JSON output (#15843) | Strip non-JSON lines before parsing |
| Use | Use |
| AppHost on breakpoint (#15576) | Use timeout, check AppHost process |
| Non-interactive terminal (#16264) | Run from standard terminal |
| Docker daemon unavailable | Container-backed resources fail to start | Start Docker Desktop, then |
| Multiple AppHosts detected | Wrong AppHost targeted | Use |
| 症状 | 原因 | 操作 |
|---|---|---|
构建时出现文件锁错误( | Aspire正在运行,锁定了 | 先执行 |
| "端口已被占用" | 之前的实例仍在运行 | |
| 资源未找到 | 应用未启动或名称错误 | 执行 |
| 资源构建错误 | 代码错误,与Aspire无关 | 修复代码,然后使用资源命令/监视/HMR/调试工作流;若AppHost代码变更,重新执行 |
| 环境问题 | 缺少SDK或工具 | 执行 |
| 混合了人工输出和JSON输出(#15843) | 解析前剔除非JSON行 |
| 应使用 | 使用 |
| AppHost处于断点状态(#15576) | 设置超时,检查AppHost进程 |
| 非交互式终端(#16264) | 在标准终端中运行 |
| Docker守护进程不可用 | 基于容器的资源启动失败 | 启动Docker Desktop,然后执行 |
| 检测到多个AppHost | 目标AppHost错误 | 使用 |
🔒 File-Lock Recovery (MSB3491 / CS2012) — Always aspire stop
First
aspire stop🔒 文件锁恢复(MSB3491 / CS2012)—— 务必先执行aspire stop
aspire stopWhen a build fails with or
, the project itself is healthy —
Aspire is running and holding file locks on the resource's output assemblies.
The recovery is always the same:
error MSB3491: Could not write to output file ...error CS2012: Cannot open ... for writingbash
undefined当构建失败并提示或时,项目本身并无问题——Aspire正在运行并锁定了资源的输出程序集。恢复步骤始终如下:
error MSB3491: Could not write to output file ...error CS2012: Cannot open ... for writingbash
undefined✅ Correct recovery sequence
✅ 正确恢复流程
aspire stop # release the locks
aspire stop # 释放锁
... then either rebuild / restart one resource if the resource exposes commands ...
... 若资源暴露了命令,可重新构建/重启单个资源 ...
aspire resource <name> rebuild # example: C# project resource with rebuild command
aspire resource <name> rebuild # 示例:带rebuild命令的C#项目资源
... or restart the whole AppHost ...
... 或重启整个AppHost ...
aspire start # if AppHost code changed or Aspire was already stopped
| ❌ NEVER do | ✅ ALWAYS do |
|------------|-------------|
| Tell the user the project has a permanent build failure | Recognize the lock as Aspire holding outputs and run `aspire stop` |
| `dotnet build` again with locks held | `aspire stop` first, then `dotnet build` (or prefer resource commands/watch/HMR/debug workflow) |
| Delete `bin/` / `obj/` to "fix" the lock | `aspire stop` — deletion may succeed but the next build relocks |
| `pkill dotnet` or `kill <PID>` to free locks | `aspire stop` — clean shutdown via the CLI, no orphans |
| Tell the user to "reboot" or "restart your machine" | `aspire stop` — single command, instant fix |
The same rule applies to any "file in use", "cannot access the file", or
"another process is using" error during a build of an Aspire-managed resource.aspire start # 若AppHost代码已变更或Aspire已停止
| ❌ 禁止操作 | ✅ 必须操作 |
|------------|-------------|
| 告知用户项目存在永久性构建故障 | 识别出是Aspire锁定了输出文件,执行`aspire stop` |
| 在锁存在的情况下再次执行`dotnet build` | 先执行`aspire stop`,再执行`dotnet build`(或优先使用资源命令/监视/HMR/调试工作流) |
| 删除`bin/` / `obj/`来"修复"锁 | 执行`aspire stop`——删除操作可能成功,但下次构建仍会锁定 |
| 使用`pkill dotnet`或`kill <PID>`释放锁 | 执行`aspire stop`——通过CLI优雅关闭,无孤立进程 |
| 告知用户"重启"或"重启机器" | 执行`aspire stop`——单个命令即可快速修复 |
上述规则同样适用于Aspire托管资源构建时出现的任何"文件正在使用"、"无法访问文件"或"其他进程正在使用"错误。Handoff Rules
移交规则
| Scenario | Route To |
|---|---|
AppHost wiring after | → |
Browser logs ( | → |
Custom resource commands ( | → |
Lifecycle hooks ( | → |
Endpoint authoring ( | → |
Deploy, publish, pipeline steps, | → |
Logs, traces, metrics, dashboard, | → |
| Deployed app diagnostics | → |
| 场景 | 移交至 |
|---|---|
| → |
浏览器日志( | → |
自定义资源命令( | → |
生命周期钩子( | → |
端点创作( | → |
部署、发布、流水线步骤、 | → |
日志、追踪、指标、仪表板、 | → |
| 已部署应用的诊断 | → |
Runtime Settings And Environment
运行时设置与环境
| Variable | Default | Purpose |
|---|---|---|
| | Container tunnel provides uniform host connectivity across Docker Desktop, Docker Engine, and Podman. Set to |
| unset | Selects the environment-specific config profile — controls which |
| | The Aspire trusted developer certificate is used by DCP on Windows. Set to |
| false unless configured | Enables Aspire default watch for supported C# and TypeScript AppHosts. Do not treat this as per-resource rebuild, restart, or hot reload for resource source changes. |
| 变量 | 默认值 | 用途 |
|---|---|---|
| | 容器隧道可在Docker Desktop、Docker Engine和Podman之间提供统一的主机连接。设置为 |
| 未设置 | 选择特定环境的配置文件——控制加载哪个 |
| | Windows系统上的DCP使用Aspire可信开发者证书。设置为 |
| 除非配置否则为false | 为受支持的C#和TypeScript AppHost启用Aspire默认监视。请勿将其视为针对资源源码变更的逐资源重建、重启或热重载。 |
TypeScript AppHost Note
TypeScript AppHost注意事项
Detection covers TS AppHosts (), but all TS AppHost authoring is delegated to .
Current rules to apply when handing off:
apphost.tsaspireify| Rule | Why |
|---|---|
Prefer unified | Per-kind helpers are deprecated — single API now handles all value types |
Never edit | Generated; use |
Use | TS surface differs from C# |
本技能可检测TS AppHost(),但所有TS AppHost创作工作均委托给技能。移交时需遵循以下规则:
apphost.tsaspireify| 规则 | 原因 |
|---|---|
优先使用统一的 | 按类型划分的辅助方法已废弃——单个API现在可处理所有值类型 |
切勿直接编辑 | 该目录为生成目录;使用 |
使用 | TS接口与C#不同 |
Skill Routing — In-Plugin Sibling Skills
技能路由——插件内同级技能
After drops a skeleton AppHost + , route AppHost wiring
(scan repo → propose resource graph → edit AppHost → wire / OTel →
validate via ) to the in-plugin aspireify skill: .
For first-run flows that only need the skeleton drop, see the in-plugin aspire-init skill:
. This orchestration skill stays focused
on lifecycle (start/stop/wait/restart) and never edits AppHost code itself.
aspire initaspire.config.jsonAspire.ServiceDefaultsaspire startaspireify/SKILL.mdaspire-init/SKILL.mdaspire initaspire.config.jsonAspire.ServiceDefaultsaspire startaspireify/SKILL.mdaspire-init/SKILL.mdProject-Local Skill Precedence
项目本地技能优先级
If exists (from ), defer to it for:
C# AppHost editing, TS AppHost editing, Playwright handoff, investigation workflows.
Safety guardrails from this plugin ALWAYS apply.
.agents/skills/aspire/SKILL.mdaspire agent initIf exists project-locally (installed by in
current Aspire), warn the user that a project-local aspireify skill is present and defer to it
for AppHost wiring instead of the in-plugin sibling. Same precedence rule as the project-local
skill above: project-local wins, plugin guardrails still apply.
.agents/skills/aspireify/SKILL.mdaspire initaspire若存在(由生成),则在以下场景中优先使用该本地技能:C# AppHost编辑、TS AppHost编辑、Playwright移交、调查工作流。本插件的安全防护规则始终适用。
.agents/skills/aspire/SKILL.mdaspire agent init若项目本地存在(由当前Aspire版本的安装),需告知用户存在项目本地的aspireify技能,并优先使用该本地技能处理AppHost连接配置,而非插件内的同级技能。优先级规则与上述项目本地技能相同:项目本地技能优先,插件防护规则仍适用。
.agents/skills/aspireify/SKILL.mdaspire initaspireReferences
参考文档
- safety-guardrails.md — Detailed rules and recovery patterns
- detection.md — Project fingerprinting
- app-commands.md — App lifecycle and bootstrap commands
- resource-management.md — Resource wait, restart, and operations
- agent-workflows.md — Common agent investigation, integration, TypeScript, and handoff workflows
- safety-guardrails.md —— 详细规则和恢复模式
- detection.md —— 项目指纹识别
- app-commands.md —— 应用生命周期和引导命令
- resource-management.md —— 资源等待、重启和操作
- agent-workflows.md —— 常见代理调查、集成、TypeScript和移交工作流