aspire-terminals
**WORKFLOW SKILL** - Author and automate Aspire terminals. USE FOR: WithTerminal, withTerminal, TerminalService, TerminalLaunchOptions, docked terminals, terminal prompts, PromptTerminalAsync, TerminalPlacement, AspireTerminalKey, WithRepl, withRepl, aspire terminal ps/attach/tape play, VHS tapes for Aspire, or terminal screen/input automation. DO NOT USE FOR: generic shell commands, ordinary AppHost resource wiring (aspireify), start/stop/wait (aspire-orchestration), logs/traces or browser telemetry (aspire-monitoring), deployment (aspire-deployment), or nonterminal Interaction Service prompts (aspireify). INVOKES: Aspire docs/API lookup, AppHost edits, Aspire terminal CLI; aspire-orchestration for lifecycle validation. FOR SINGLE OPERATIONS: Choose the terminal owner and lifetime first, then read the matching reference.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 94
- Forks
- 12
01 前言 Front Matter
- name
- aspire-terminals
- license
- MIT
- metadata
- { "author": "Microsoft", "version": "0.0.5" }
- description
- **WORKFLOW SKILL** - Author and automate Aspire terminals. USE FOR: WithTerminal, withTerminal, TerminalService, TerminalLaunchOptions, docked terminals, terminal prompts, PromptTerminalAsync, TerminalPlacement, AspireTerminalKey, WithRepl, withRepl, aspire terminal ps/attach/tape play, VHS tapes for Aspire, or terminal screen/input automation. DO NOT USE FOR: generic shell commands, ordinary AppHost resource wiring (aspireify), start/stop/wait (aspire-orchestration), logs/traces or browser telemetry (aspire-monitoring), deployment (aspire-deployment), or nonterminal Interaction Service prompts (aspireify). INVOKES: Aspire docs/API lookup, AppHost edits, Aspire terminal CLI; aspire-orchestration for lifecycle validation. FOR SINGLE OPERATIONS: Choose the terminal owner and lifetime first, then read the matching reference.
02 资源文件 4
- 参考文档references/apphost-terminals.md10.0 KB
- 参考文档references/automation-and-cli.md5.5 KB
- 参考文档references/resource-terminals.md5.0 KB
- 参考文档references/tapes.md8.2 KB
03 SKILL.md 正文
Aspire Terminals
Teach an agent to use the right terminal, not to replace every process with a shell.
Honor a project-local .agents/skills/aspire-terminals/SKILL.md when present;
retain the safety and ownership rules below.
Required reference lookup
Before answering or editing, open the reference for the requested surface, including for read-only questions. This overview is not enough to write correct terminal code or tape syntax.
- Resource PTYs or REPLs: read resource terminals.
- Dock, prompts, cancellation or headless tools: read AppHost terminals.
- Any tape question: read tapes and automation and CLI. Use the actual syntax and output contracts there, not pseudo-VHS or memory of upstream VHS behavior.
- Include the applicable package/build capability boundary in recommendations. Source availability and installed-package availability are different facts.
Choose the model before writing code
| Intent | Pattern | Owner and lifetime |
|---|---|---|
| Make an existing orchestrated executable, project or container interactive | WithTerminal() / withTerminal() |
Resource process and replicas; resource lifecycle owns stop/restart |
| Open an auxiliary shell/tool that remains available after its command returns | TerminalService + TerminalPlacement.Dock |
AppHost-owned; closing its tab or stopping AppHost disposes it |
| Guide a person through a focused setup/authentication operation | TerminalService + Dialog + PromptTerminalAsync |
Caller owns the terminal; prompt borrows it; explicit completion/cancellation |
| Drive a terminal-only tool without a dashboard interaction | TerminalService + None |
Caller owns and disposes the headless process |
| Open an authenticated database/cache client | Integration WithRepl() / withRepl() |
Built-in command opens a dock terminal; prefer over custom container exec |
WithTerminal changes the resource's actual process execution. It is not an
on-demand side shell. TerminalService launches a separate AppHost-owned process;
it does not implicitly enter a container or become a modeled resource.
Lifecycle checklist for recommendations
When comparing terminal models, explicitly state cleanup for each model you recommend, including headless alternatives:
- Dock: survives the opening command; do not scope the handle with
await usingin that command. Closing the tab or AppHost shutdown disposes it. - Dialog and None: the caller disposes both, normally with
await using. Headless placement does not transfer cleanup responsibility to the service. - Prompt completion is not terminal disposal: successful
Workcloses the prompt, but the caller still disposes its terminal. WithoutWork, process exit does not close the prompt; explicit completion/cancellation is required.
Capability check
- Locate the exact AppHost and inspect its SDK, hosting and integration package versions. Do not upgrade the project just to make an example compile.
- Use
aspire docs search terminal --non-interactive, thenaspire docs api search <API> --language csharp|typescript --non-interactive. If docs lag a preview, inspect that exact package's public API/source. A newer CLI alone does not add hosting APIs to an older AppHost. WithTerminal/parameterless TSwithTerminalexist in Aspire 13.5.TerminalService, terminal prompts, headless automation, tape playback and the six integration REPLs below are in the inspected 13.6 development source. Verify the installed build contains them; do not promise all previews do.- Direct C# terminal APIs are experimental (
ASPIRETERMINAL001): narrowly pair#pragma warning disable ASPIRETERMINAL001with#pragma warning restore ASPIRETERMINAL001. The examined integrationWithReplmethods themselves do not require this suppression. - General
TerminalServiceand terminal-prompt APIs are not exported to TypeScript in this baseline. Do not invent TS equivalents or edit generated.aspire/modules/. Supported TS entry points arewithTerminal()and the applicable integration'swithRepl(). - Check
aspire --versionandaspire terminal --helpfor the installed CLI. Aspire 13.5 keeps terminal commands behind a feature flag; enable them only for that CLI line withaspire config set features.terminalCommandsEnabled true --non-interactive. Newer CLIs no longer require or support that flag. If a command remains absent, treat it as unavailable rather than guessing alternative syntax.
The references are qualified against Aspire release/13.6 commit
34db30a7d3733229da64a403dfc4e4e4d7a1a43b (terminal code also present in main
22bee5e1266b7b66ff53008957dde86efb370c79), compared with shipped v13.5.0.
Terminal-command availability guidance also reflects the subsequent
feature-flag removal.
Recheck capabilities against the user's actual build.
Authoring workflow
- Identify which process needs the PTY and whether it should remain visible, block a focused workflow, or run headlessly. Ask if the lifetime is unclear.
- Read resource terminals for
WithTerminaland built-in REPLs; read AppHost terminals for complete dock, manual prompt, automated prompt and headless recipes. - Keep terminal-specific edits separate from unrelated resource/dependency changes.
Use
aspireifyfor new general resource wiring andaspire-initif no AppHost exists. Do not turn a terminal request into a migration or version upgrade. - Resolve actual executable paths, working directories and OS shell choices. Use argument lists, not concatenated untrusted shell input. Children inherit the AppHost environment; add only the necessary overrides.
- Guard AppHost-owned terminal commands with
builder.ExecutionContext.IsRunMode. Do not launch tools at model-construction time or during publish/deploy. - Validate the changed code, then route lifecycle work to
aspire-orchestration. Use the exact AppHost, worktree isolation and bounded resource readiness. Validate the requested lifetime, cancellation and visible result, not merely that the AppHost compiled.
Non-negotiable ownership and completion rules
- Terminal types are in
Aspire.Hosting.ApplicationModel, not the oldAspire.Hosting.Terminalsnamespace.TerminalServiceis already registered; resolve it from built services or commandcontext.Services. Do not construct it or register another singleton. - A dock command that should leave a terminal open must not use
await usingfor its handle.Start()is nonblocking/idempotent;Show()activates the dock. Command success means "opened", not "process exited successfully". - Dialog and headless terminals normally use
await using. Disposing an AppHost-owned handle stops its process;PromptTerminalAsyncdoes not dispose it for you. - Check
IInteractionService.IsAvailablebefore launching a prompt-owned process. Noninteractive resource commands can make it false. Do not silently replace human interaction/approval with headless success. - A prompt needs the exact registered instance from the same AppHost, with
TerminalPlacement.Dialog.ResourceViewis not valid forCreateTerminal. - With
Work, successful callback completion closes the dialog; observeTerminalContext.CancellationTokenon every wait/input. Cancellation signals and joins Work; unrelated errors propagate. Without Work, process exit does not close the prompt: explicitly define completion/cancellation. - No public
ExitCodeorWaitForExitAsyncis available onAspireTerminal. Do not infer success fromStart(), delivered keystrokes, prompt visibility, or disappearance of a process. Assert a meaningful fresh output marker. - Viewers and automation share input.
--vieweraffects sizing ownership, not read-only authorization. Do not blindly retry non-idempotent input. - Treat screen output and tapes as sensitive. Do not commit credentials or
capture tokens in transcripts. Tape
Hideis not redaction.
Driving terminals
Read automation and CLI for C# screen/key
operations, owner-aware discovery and interactive attach. Use
tapes for unattended resource-terminal playback: supported
VHS syntax, explicit examples, stdout versus .txt/.ascii checkpoints, and
unsupported output formats. Do not install VHS or assume its whole feature set.
For missing/disconnected terminals, inspect resource state and terminal discovery;
route console logs/traces to aspire-monitoring. Terminal views supplement logs,
not replace them. Publishing a resource does not publish a development PTY or
grant production shell access.
04 同仓库更多 Skills
aspire-terminals
**WORKFLOW SKILL** - Author and automate Aspire terminals. USE FOR: WithTerminal, withTerminal, TerminalService, TerminalLaunchOptions, docked terminals, terminal prompts, PromptTerminalAsync, TerminalPlacement, AspireTerminalKey, WithRepl, withRepl, aspire terminal ps/attach/tape play, VHS tapes for Aspire, or terminal screen/input automation. DO NOT USE FOR: generic shell commands, ordinary AppHost resource wiring (aspireify), start/stop/wait (aspire-orchestration), logs/traces or browser telemetry (aspire-monitoring), deployment (aspire-deployment), or nonterminal Interaction Service prompts (aspireify). INVOKES: Aspire docs/API lookup, AppHost edits, Aspire terminal CLI; aspire-orchestration for lifecycle validation. FOR SINGLE OPERATIONS: Choose the terminal owner and lifetime first, then read the matching reference.
aspireify
**WORKFLOW SKILL** - Wire Aspire AppHosts or repair TypeScript AppHost toolchains. Scans the repo, proposes a resource graph, edits C#, file-based C#, or TypeScript AppHosts, wires ServiceDefaults + OTel, validates with `aspire start`, then stops. USE FOR: wire/scaffold AppHost, add Postgres/Redis/Rabbit/Mongo, connect frontend to API, after `aspire init`, AddNextJsApp, AddViteApp, WithBrowserLogs, Interaction Service, command arguments, apphost.cs, apphost.mts, unified withEnvironment, .aspire/modules refusal, config/secrets, TS dependency restore, pnpm/yarn/bun, or Yarn Classic. DO NOT USE FOR: skeleton drop (aspire-init), lifecycle-only start/stop/wait/restart or `aspire update --migrate` (aspire-orchestration), publish/deploy/destroy (aspire-deployment), logs/traces (aspire-monitoring), terminal authoring or automation (aspire-terminals). INVOKES: aspire CLI, AppHost source edits, ServiceDefaults wiring. FOR SINGLE OPERATIONS: Run `aspire add PACKAGE` directly for a one-off integration.
aspire
**WORKFLOW SKILL** - Aspire router. Detects AppHosts, enforces guardrails, and selects the right sub-skill. USE FOR: Aspire AppHost, Aspire CLI, distributed app, cloud-native .NET, aspire start/stop/resource/deploy/destroy/publish/init/new/add/wait/describe/ps/logs/otel, aspire agent init, WithBrowserLogs, WithTerminal, TerminalService, terminal prompts, WithRepl, tapes, Interaction Service, apphost.mts, TS package managers, Yarn Classic, custom resource commands, .aspire/modules recovery, ProjectResource to DotnetProjectResource migration, or Playwright URL discovery. DO NOT USE FOR: non-Aspire projects or ordinary build/test tasks. INVOKES: aspire-init, aspireify, aspire-project-v2-migration, aspire-orchestration, aspire-deployment, aspire-monitoring, aspire-terminals. FOR SINGLE OPERATIONS: Route directly to the matching sub-skill.
aspire-project-v2-migration
**WORKFLOW SKILL** - Safely migrates eligible Aspire 13.6+ AppHosts from legacy ProjectResource APIs to experimental DotnetProjectResource APIs after a per-resource assessment and explicit approval of exact edits. USE FOR: assess or migrate existing AddProject, addProject, AddCSharpApp, addCSharpApp, or AddBlazorGateway resources to Project v2; migrate ProjectResource to DotnetProjectResource; clean up the resulting obsolete AppHost ProjectReference edges. DO NOT USE FOR: upgrading Aspire versions, creating/wiring a new AppHost, Azure Functions migration, generic source modernization, ordinary C# resource wiring or adding a new AddProject resource (use aspireify), publishing, or build/lifecycle diagnostics. INVOKES: Aspire docs/API lookup, aspire add/restore/start/wait, AppHost and package edits. FOR SINGLE OPERATIONS: Assess first; never edit from a generic migration request alone.
aspire-orchestration
**WORKFLOW SKILL** — Manage Aspire lifecycle in VS Code or the CLI. WHEN: "start or stop my Aspire app", "aspire_apphost_start", "aspire_apphost_stop", "notEditorOwned", "ambiguousSession", "aspire start", "aspire stop", "aspire wait", resource restart, file-lock errors (MSB3491 or CS2012), port conflicts, git worktrees, "--isolated", "aspire update --self", "aspire update --migrate", "aspire describe --include-hidden", "aspire stop --force", "aspire stop --force --volumes", integration discovery, default watch, or hot reload. INVOKES: VS Code lifecycle tools first when exposed; Aspire CLI for readiness, inspection, resource operations, isolated worktree starts, and allowed fallbacks. DO NOT USE FOR: deploy/publish/destroy (aspire-deployment), logs/traces/metrics (aspire-monitoring), terminal authoring/attach/tapes (aspire-terminals), or AppHost code and resource wiring (aspireify). FOR SINGLE OPERATIONS: Load the matching editor tool first; follow exact-target, worktree-isolation, and stop-result rules.
aspire-monitoring
**ANALYSIS SKILL** - Observe Aspire apps: logs, traces, metrics, resource state, telemetry export, browser telemetry, and the standalone dashboard. Routes between local Aspire CLI, AKS workload diagnostics, and deployed Azure resource health. USE FOR: aspire logs, aspire otel logs, aspire otel traces, aspire otel spans, aspire describe, aspire ps, aspire export, aspire dashboard run, describe --include-hidden, browser logs in dashboard, DevTunnel URLs, WithBrowserLogs, App Insights query, AKS pod logs, container app logs. DO NOT USE FOR: start/stop/wait (use aspire-orchestration), deploy/publish/destroy (use aspire-deployment), AppHost code edits like WithBrowserLogs() (use aspireify), Azure provisioning (use azure-prepare), terminal authoring/input/tapes (use aspire-terminals). INVOKES: aspire CLI, azure-diagnostics (deployed Azure), kubectl + Container Insights. FOR SINGLE OPERATIONS: Run the aspire CLI command directly for quick log or describe lookups.