Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
aspire【部署与运维】Build, upgrade, and operate Aspire 13.5.x C# or TypeScript application hosts with the current CLI, AppHost, ServiceDefaults, integrations, dashboard, testing, MCP, and deployment patterns for distributed apps. USE FOR: Aspire.AppHost.Sdk, Aspire.Hosting.*, DistributedApplication.CreateBuilder, apphost.mts, createBuilder, WithReference, WaitFor, AddPr…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Aspire.AppHost.Sdk, Aspire.Hosting.*, DistributedApplication.CreateBuilder, apphost.mts, createBuilder, WithReference, WaitFor, AddProject, addNodeApp, addViteApp, AddRedis, AddPostgres, aspire run, aspire init, aspire add, or aspire updateAspire.Hosting.Testing, DistributedApplicationTestingBuilder, or a test harness that mixes an Aspire AppHost with WebApplicationFactoryServiceDefaults, service discovery, OpenTelemetry, health checks, or the Aspire DashboardCommunityToolkit/Aspireapphost.mts for JavaScript/TypeScript-first repositories; both are first-class in 13.5. Use the Aspire CLI and current SDK-generated app model instead of writing new guidance around the deprecated legacy workload.Aspire.AppHost.Sdk, and closely coupled hosting or testing packages on the same line, then rerun the AppHost and deployment checks after aspire update.ServiceDefaults narrow. It exists for telemetry, health checks, resilience, and service discovery, not shared domain models or general utility code.CommunityToolkit/Aspire only when the capability gap is real: unsupported language hosts, extra dev infrastructure, or extension packages the official project does not provide.WithReference, the dashboard shows the expected resource graph, and end-to-end tests can exercise the topology.Aspire.Hosting.Testing to boot the distributed app, create HttpClient or SignalR clients from the AppHost, and layer WebApplicationFactory on top only when tests need direct Host DI, grains, or runtime services. Fixture sharing amortizes startup and must not serialize tests; keep consumers parallel and isolate their mutable state.For test diagnostics, follow the output budget in references/testing.md: retain native progress and ANSI, show Warning/Error only plus a final summary, cap diagnostic responses at 80 lines / 8 KiB, and link artifacts instead of dumping logs.
flowchart LR
A["Distributed-app task"] --> B{"Need code-first orchestration?"}
B -->|No| C["Stay in service-level skills such as ASP.NET Core, Worker, or Orleans"]
B -->|Yes| D["Create or update the AppHost"]
D --> E["Model resources and services with `WithReference` and `WaitFor`"]
E --> F{"Official Aspire integration exists?"}
F -->|Yes| G["Use first-party Aspire integration"]
F -->|No or gap remains| H["Evaluate `CommunityToolkit/Aspire`"]
G --> I["Apply `ServiceDefaults`, dashboard, and tests"]
H --> I
I --> J{"Publishing now?"}
J -->|No| K["Run locally with `aspire run` or the AppHost project"]
J -->|Yes| L["Choose `azd`, App Service, or the CLI deploy/publish pipeline"]
Aspire.AppHost.Sdk/<version>, a file-based C# apphost.cs, or a TypeScript apphost.mts. For TypeScript, aspire init --language typescript writes aspire.config.json and the generated .aspire/modules/ SDK; do not hand-edit generated modules, and run aspire restore after package/integration changes.createBuilder, addNodeApp, addViteApp, withReference, waitFor, build().run()). In an existing repository with a root package.json, expect the CLI to create a nested aspire-apphost/ package so the application and orchestration toolchains stay separate.aspire new for starter projects, aspire init to add Aspire support to an existing solution or create a single-file AppHost, aspire add to add integrations or starter pieces, aspire run for local orchestration, aspire start/aspire stop/aspire ps for detached lifecycle management, aspire describe for live resource inspection, aspire doctor for environment diagnostics, aspire secret for user secrets, aspire docs for terminal documentation lookup, aspire agent for AI agent integration, aspire deploy for the current CLI deploy pipeline, aspire restore for AppHost and TypeScript resource refresh, and aspire update for version-aware upgrades. aspire terminal attaches to an opt-in WithTerminal() resource; do not make an interactive terminal a hidden dependency of normal orchestration. aspire publish still exists for explicit artifact-generation flows and remains preview-sensitive.13.5.0 adds cross-language interaction controls, experimental WithTerminal() resources, a refreshed dashboard, and more deployment modeling. Before upgrading, audit its breaking changes: hosting-context ServiceProvider became Services, PublishAsConnectionString is superseded by AddConnectionString, and the removed aspire ps --resources / --include-hidden views become aspire describe. Align package versions, run aspire update --migrate when it applies, then revalidate local orchestration and the chosen deployment path.ExcludeFromMcp() filtering is now consistently honored by CLI MCP tools such as resource, log, command, and trace listings. Use it deliberately for resources that should not leak into agent context.13.5.3. 13.5.1 fixes macOS startup crashes for polyglot AppHosts and older-CLI compatibility, while 13.5.3 fixes Dashboard Graph crashes for multi-path resource icons and restores DevTunnel public URLs in the dashboard and MCP snapshots. Upgrade the CLI and SDK together before adding local lifecycle, graph, or endpoint workarounds.WithReference(...) for dependency and configuration flow, and WaitFor(...) for startup ordering. Use WithExternalHttpEndpoints() only when the resource truly needs an externally reachable endpoint for the chosen runtime or publish target.AddServiceDefaults() should stay focused on OpenTelemetry, health endpoints, service discovery, HttpClient resilience, and related cross-cutting infrastructure.DistributedApplicationTestingBuilder plus a shared fixture for AppHost lifecycle, App.CreateHttpClient(...) for resource-bound clients, and a WebApplicationFactory<TEntryPoint> wrapper only when the test must resolve DI services or in-process runtime state from the hosted app. For UI flows, initialize Playwright once in the shared fixture, create a fresh browser context per test, and capture failure artifacts..NET 10.CommunityToolkit/Aspire when you need polyglot app hosts beyond official coverage, extra dev-time tools around a resource, or community-maintained integrations. Toolkit 13.5.0 aligns with Aspire 13.5 and adds integrations such as Logto, RustFs, dbx, SeaweedFS, Bitwarden, Squad, K3s, Kind, Redpanda, listmonk, Posta, stable-diffusion.cpp, and Mosquitto. Add only the focused integration package the topology actually needs.WithReferenceServiceDefaults into a dumping ground for shared models or helpersCommunityToolkit/Aspire when first-party Aspire already covers the requirementCommunityToolkit/Aspire package decisionaspire run or the AppHost projectWithReference and WaitFor relationships where neededServiceDefaults contains only cross-cutting infrastructure concernsWebApplicationFactory layer reuses connection strings and endpoints from the AppHost instead of duplicating local configServiceDefaults, testing, and upgrade checkpointsDistributedApplicationTestingBuilder, WebApplicationFactory integration, Playwright bootstrapping, and diagnosticsCommunityToolkit/Aspire packages, capability gaps, and selection rules