[docs] Add polyglot WithComputeEnvironment examples to Kubernetes and Docker integration pages#997
Conversation
…Docker integration pages WithComputeEnvironment is now available in polyglot (TypeScript, Python, Java, Go) app hosts as of microsoft/aspire#17093. Expand the existing tip asides on the Kubernetes and Docker integration pages to include C# and TypeScript code examples showing how to call the API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Kubernetes and Docker integration docs to show how to use compute environment disambiguation now that WithComputeEnvironment is available in polyglot AppHosts, adding side-by-side C# and TypeScript examples within the existing tip asides.
Changes:
- Expanded the existing
WithComputeEnvironmenttip on the Kubernetes integration page with synced C#/TypeScript examples. - Expanded the existing
WithComputeEnvironmenttip on the Docker integration page with synced C#/TypeScript examples.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/frontend/src/content/docs/integrations/compute/kubernetes.mdx | Expands the compute-environment disambiguation tip with C# and TypeScript examples. |
| src/frontend/src/content/docs/integrations/compute/docker.mdx | Expands the compute-environment disambiguation tip with C# and TypeScript examples. |
Comments suppressed due to low confidence (2)
src/frontend/src/content/docs/integrations/compute/kubernetes.mdx:121
- This tip is introduced as guidance for the existing
k8s(andapi) variables from the preceding example, but the snippet redeclares them and callsAddProject("api")again. Reusing the previously declaredapi(and just showing the.WithComputeEnvironment(k8s)call) would avoid implying a duplicate resource definition.
var k8s = builder.AddKubernetesEnvironment("k8s");
builder.AddProject<Projects.MyApi>("api")
.WithComputeEnvironment(k8s);
src/frontend/src/content/docs/integrations/compute/docker.mdx:156
- The C# example uses
Projects.MyApi, while the rest of this page’s examples useProjects.Api/Projects.Web. Aligning the placeholder project name/type with the surrounding examples would reduce confusion when readers copy/paste.
var compose = builder.AddDockerComposeEnvironment("compose");
builder.AddProject<Projects.MyApi>("api")
.WithComputeEnvironment(compose);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| With the `k8s` variable assigned, you can pass it to the `WithComputeEnvironment` API to | ||
| disambiguate compute resources for solutions that define more than one. Otherwise, the `k8s` | ||
| variable isn't required. This API is available in C# and polyglot (TypeScript, Python, Java, | ||
| Go) app hosts. |
| With the `compose` variable assigned, you can pass it to the `WithComputeEnvironment` API to | ||
| disambiguate compute resources for solutions that define more than one. Otherwise, the `compose` | ||
| variable isn't required. This API is available in C# and polyglot (TypeScript, Python, Java, | ||
| Go) app hosts. |
IEvangelist
left a comment
There was a problem hiding this comment.
This review was generated by running the doc-tester skill against PR #997 on the local Aspire docs site (http://localhost:54422).
Summary
Verdict: Comment — the changes are accurate, render cleanly, and the polyglot guidance is a real improvement. I found no blockers. The notes below are all minor / nit-level consistency items the author may or may not want to address before merge.
What I tested:
- Checked out PR #997 from
upstreaminto a worktree. - Started the docs site locally with
aspire start --isolated(frontend athttp://localhost:54422). - Used Playwright MCP-style automation to load both changed pages and exercise the new tip Asides:
/integrations/compute/docker/— clicked C# and TypeScript tabs in the new tip./integrations/compute/kubernetes/— clicked C# and TypeScript tabs in the new tip.
- Verified that
<Aside type="tip">with nested<Tabs>+<TabItem>+ fenced code blocks (indented by 2 spaces) renders correctly — the Tabs are interactive, the code highlights, and the copy-to-clipboard button works. - Cross-checked the polyglot TypeScript syntax against the rest of
docker.mdxandkubernetes.mdx(e.g. the existingaddDockerComposeEnvironment,addKubernetesEnvironment,addContainer,addNodeAppexamples). - Confirmed the local CLI in this environment is
13.4.0-preview.1.26269.1, which matches the PR'srelease/13.4target where microsoft/aspire#17093 lights up the polyglotwithComputeEnvironmentexport.
Overall the PR does exactly what the description says, and the rendering is solid.
Findings
Minor
1. title= inconsistency on the Kubernetes C# block.
src/frontend/src/content/docs/integrations/compute/kubernetes.mdx line 117 uses:
```csharp title="AppHost.cs"but every other C# code block on that page uses title="C# — AppHost.cs" (e.g. lines 39, 78, 142, 190). For consistency with the rest of the page, consider:
```csharp title="C# — AppHost.cs"(Docker is fine — docker.mdx already uses bare title="AppHost.cs" everywhere, so the PR matches its page convention there.)
2. C# fluent-call indentation differs from the surrounding file style.
The new C# snippet uses aligned indentation:
builder.AddProject<Projects.MyApi>("api")
.WithComputeEnvironment(compose);…whereas every other multi-line fluent call in both files uses a 4-space continuation:
var api = builder.AddProject<Projects.Api>("api")
.WithReference(cache)
.PublishAsDockerComposeService(...);Not wrong, just stylistically inconsistent with the rest of these two pages.
Nit
3. Asymmetric resource type between C# and TypeScript in the Docker tip.
The Docker C# example adds a project:
builder.AddProject<Projects.MyApi>("api").WithComputeEnvironment(compose);The Docker TypeScript example adds a container instead:
const api = await builder.addContainer("api", "nginx:alpine");
await api.withComputeEnvironment(compose);The Kubernetes tip is symmetric (project ↔ addNodeApp). For Docker, consider using addProject(...) in the TypeScript variant too so the languages tell the same story — or alternatively keep the divergence on purpose but call it out.
4. Project type names drift from the section above.
The main "Add Docker Compose environment resource" example just above uses Projects.Api, Projects.Web. The new tip introduces a fresh Projects.MyApi. Not a problem on its own, but a reader scrolling continuously sees three different project type names in adjacent code blocks. (The Kubernetes page already establishes Projects.MyApi higher up, so it's fine there.)
Knowledge gap
5. "C# and polyglot (TypeScript, Python, Java, Go)" but only TS is shown.
The new prose explicitly calls out Python, Java, and Go as supported, but only TypeScript appears in the tabs. A reader writing a Python or Go AppHost has no concrete syntax to copy and must guess the casing/builder pattern in their language. A few options:
- Soften the claim to "available in polyglot app hosts" without enumerating every language, OR
- Add Python/Java/Go tabs (matches the claim, but is a heavier lift), OR
- Add a one-line pointer ("See the polyglot reference for Python/Java/Go syntax") so users aren't left guessing.
This is the kind of gap the doc-tester skill specifically asks to flag — I had to fall back on my prior knowledge of polyglot naming conventions to be confident the unshown languages mirror the TS shape.
Suggested wording (optional)
For the new sentence in both Asides:
This API is available in C# and polyglot (TypeScript, Python, Java, Go) app hosts.
Could be tightened to either:
This API is available in C# AppHosts and in all polyglot AppHosts (TypeScript, Python, Java, Go).
…or, if not adding examples for every language:
This API is available in C# AppHosts and, starting in 13.4, in polyglot AppHosts. The TypeScript snippet below applies analogously to Python, Java, and Go.
Things I explicitly did not flag
- The MDX shape (
<Aside>wrapping<Tabs>wrapping fenced code blocks with 2-space indentation) — I was initially worried CommonMark indentation would eat the fences, but Starlight's MDX handles it correctly. Renders fine in both pages. - The lack of a
twoslashdirective on the new TypeScript blocks — this is appropriate, since the bundledaspire.d.tssnapshot is still 13.3 and doesn't yet exposewithComputeEnvironment; running twoslash on these snippets right now would falsely fail. - The
awaiton a synchronous-lookingaddContainer/addNodeAppcall — this matches the existing polyglot convention used throughout the same files.
Generated by running the doc-tester skill against PR #997.
Documents changes from microsoft/aspire#17093 by
@sebastienros.Targeting
release/13.4based on the source PR milestone13.4.Why this PR is needed
WithComputeEnvironmentwas previously only available in C# app hosts — it was excluded from the polyglot (TypeScript, Python, Java, Go) SDK export via[AspireExportIgnore]. microsoft/aspire#17093 changed it to[AspireExport], making the API available in all polyglot app hosts.The existing Kubernetes and Docker integration docs referenced
WithComputeEnvironmentonly in a brief tip aside ("you can pass that toWithComputeEnvironment...") without showing how to call it — and the API simply wasn't usable in polyglot before this change.What was changed
The
WithComputeEnvironmenttip asides on both integration pages are expanded to include:WithComputeEnvironment/withComputeEnvironmentFiles modified
src/frontend/src/content/docs/integrations/compute/kubernetes.mdx— expanded tip aside with C#/TypeScript examples forWithComputeEnvironmentsrc/frontend/src/content/docs/integrations/compute/docker.mdx— expanded tip aside with C#/TypeScript examples forwithComputeEnvironment