Aspire 示例数据同步
update-samples
通过从 microsoft/aspire-samples GitHub 仓库获取示例元数据来更新示例数据文件。在添加新示例、刷新示例数据,或确保 samples.json 与上游仓库保持同步时使用。
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 206
- Forks
- 99
01 前言 Front Matter
- name
- update-samples
- description
- Update the samples data file by fetching sample metadata from the microsoft/aspire-samples GitHub repository. Use when adding new samples, refreshing sample data, or ensuring samples.json stays in sync with the upstream repo.
03 SKILL.md 正文
Update Samples Data
This skill synchronizes the samples data file with the microsoft/aspire-samples GitHub repository. It enumerates all sample projects in the samples/ directory, fetches each sample's README.md, and generates a structured JSON catalog.
Overview
The aspire.dev site maintains a data file for samples:
src/frontend/src/data/samples.json— Sample metadata including titles, descriptions, tags, deep links, and README content extracted from the upstream repo.
This skill keeps that file in sync with the microsoft/aspire-samples repository on GitHub.
Prerequisites
- Node.js installed and available on
PATH - Working directory is the repository root
- The frontend project dependencies are installed (
bun installinsrc/frontend/) - Optional:
GITHUB_TOKENenvironment variable for higher GitHub API rate limits
Step-by-Step Process
1. Run the update script
Fetch the latest sample data from the GitHub API:
cd src/frontend && node scripts/update-samples.js
This writes updated sample metadata to src/frontend/src/data/samples.json. The script queries the GitHub Contents API for directories in microsoft/aspire-samples/samples/, fetches each sample's README.md, and extracts structured metadata.
2. What the script does
For each subdirectory in samples/:
-
Lists directories — Calls the GitHub Contents API to enumerate entries in
samples/and filters to directories only (skipping files likeglobal.json,Directory.Build.props). -
Fetches README.md — Downloads the raw README.md for each sample directory.
-
Extracts metadata from the README:
name— The directory name (e.g.,aspire-shop)title— Extracted from the first# headingin the READMEdescription— The first paragraph of body text after the title (before any##heading)
href— Deep link to the sample on GitHub:https://github.com/microsoft/aspire-samples/tree/main/samples/{name}readme— The full Markdown content of the README.md, with image paths rewritten to local assets (see below)tags— Auto-detected tags based on technologies, languages, services, and features mentioned in the README and directory namethumbnail— Local asset path to the first image referenced in the README (if any), ornull
-
Downloads images — For each image referenced in the README (
):- Resolves the remote URL (relative paths are resolved against the GitHub raw content URL)
- Downloads the image to
src/frontend/src/assets/samples/{name}/{filename} - Rewrites the image reference in the README to use the local asset path:
~/assets/samples/{name}/{filename} - This ensures images are bundled with the site and served locally rather than hotlinked from GitHub
-
Writes output — Saves the result as a sorted JSON array to
src/frontend/src/data/samples.json.
3. Tag detection
Tags are automatically inferred from the README content and sample name. The script detects:
Languages
| Tag | Matched by |
|---|---|
csharp |
C#, .NET references |
python |
Python references |
javascript |
JavaScript references |
node |
Node.js references |
go |
Go/Golang references |
java |
Java, Spring Boot, Quarkus, Maven, Gradle references |
Services & Technologies
| Tag | Matched by |
|---|---|
redis |
Redis references |
postgresql |
PostgreSQL, Postgres, Npgsql references |
sql-server |
SQL Server, MSSQL references |
mysql |
MySQL references |
mongodb |
MongoDB references |
rabbitmq |
RabbitMQ references |
kafka |
Kafka references |
prometheus |
Prometheus references |
grafana |
Grafana references |
docker |
Docker, container references |
Azure Services
| Tag | Matched by |
|---|---|
azure |
Azure references |
azure-functions |
Azure Functions references |
azure-storage |
Azure Storage references |
azure-service-bus |
Azure Service Bus references |
Frameworks & Features
| Tag | Matched by |
|---|---|
blazor |
Blazor references |
orleans |
Orleans references |
grpc |
gRPC references |
ef-core |
Entity Framework Core references |
metrics |
Metrics, OpenTelemetry references |
health-checks |
Health check references |
containers |
Container build/deployment references |
databases |
Database-related references |
migrations |
Database migration references |
volumes |
Volume mount references |
dashboard |
Dashboard references |
4. Output format
The output samples.json is a JSON array with entries like:
[
{
"name": "aspire-shop",
"title": "Aspire Shop",
"description": "The app consists of four .NET services including a Blazor frontend, catalog API, catalog database manager, and basket service.",
"href": "https://github.com/microsoft/aspire-samples/tree/main/samples/aspire-shop",
"readme": "# Aspire Shop\n\n...",
"tags": ["csharp", "blazor", "postgresql", "redis", "grpc", "ef-core"],
"thumbnail": "~/assets/samples/aspire-shop/aspireshop-frontend-complete.png"
}
]
5. Manual review
After running the script:
- Review new entries — Verify titles and descriptions are meaningful
- Check tags — The auto-detection may miss niche technologies; manually add tags if needed
- Verify thumbnails — Ensure image URLs resolve correctly
- Remove stale samples — The script automatically handles this since it rebuilds from source
6. Environment variables
| Variable | Required | Description |
|---|---|---|
GITHUB_TOKEN |
No | GitHub personal access token for higher API rate limits (60 → 5000 requests/hour) |
SAMPLES_BRANCH |
No | Override the microsoft/aspire-samples ref to fetch from (default main). Useful for staging samples.json against a still-open upstream PR — set to the PR's head ref. The generated href fields stay anchored to main so links remain valid after the PR branch is deleted. |
7. Integration with build
The script is registered as an npm script in src/frontend/package.json:
bun run update:samples
It is also included in the update:all aggregate script so it runs alongside other data updates during builds.
04 同仓库更多 Skills
Aspire 入门指南
getting-started-with-aspire
当开发者询问如何开始使用 Aspire 时使用本技能——包括安装 Aspire CLI、创建新的 Aspire 应用、在本地运行,或在 aspire.dev 上查找权威文档、集成目录或 API 参考。适用于“如何安装 aspire?”“如何创建新的 aspire 应用?”“如何运行我的 aspire 应用?”“aspire 的文档在哪里?”等问题。不适用于:操作现有的 Aspire AppHost(使用 github.com/microsoft/aspire/tree/main/.agents/skills/aspire 上的官方 `aspire` 技能)、编写 AppHost 代码,或向现有应用添加集成。
Aspire 新特性发布说明编写
whatsnew
这是一个带步骤参数的技能,将编写 Aspire “What's new in N.N” 发布说明页面(src/frontend/src/content/docs/whats-new/aspire-N-N.mdx)规范为一套可重复的生命周期流程。以 `/whatsnew {modality}` 形式调用,其中 modality 为以下之一:draft/scaffold(init,初始化)、research(研究)、critique(评审)、validate(验证)、polish(润色)、review(审查)。适用于:为某个版本启动/搭建新的“新特性”页面,将版本变更研究整理成资料档案并撰写草稿正文,评审草稿,对差异进行事实核查/验证,润色并执行数据导入,或对 PR 做最终签核。不适用于:通用文档页面(使用 doc-writer)、审查任意文档 PR(使用 doc-pr-reviewer),或产品仓库的改动。编排的技能包括:doc-writer、doc-pr-reviewer、doc-tester、twoslash-validator、update-integrations、update-samples、container-images。
集成文档与 API 参考同步
update-integrations
通过将 NuGet 包名与其文档 URL 同步,并生成每个包的 API schema,来更新集成文档链接和 API 参考数据。在添加新集成、刷新包数据、确保 integration-docs.json 与 aspire-integrations.json 保持同步,或重新生成 API 参考 JSON 文件时使用。
Twoslash 示例校验与修复
twoslash-validator
为 aspire.dev 校验并修复双斜杠(twoslash)TypeScript 示例。在添加或编辑 `twoslash` 代码块、TypeScript AppHost 示例、生成的 TypeScript API 数据,或处理 `bun run test:unit:twoslash-blocks` 的失败时使用。
Playwright 浏览器自动化测试
playwright-cli
自动化浏览器交互,用于 Web 测试、表单填写、截图和数据提取。当用户需要浏览网站、与网页交互、填写表单、截取截图、测试 Web 应用或从网页提取信息时使用。
终端应用自动化操作
hex1b
用于自动化任何终端应用程序的 CLI 工具——TUI 应用、shell、CLI 工具、REPL 等。当需要在虚拟终端中启动进程、捕获其屏幕输出、注入键盘或鼠标输入、截取屏幕截图、录制会话或对可见内容进行断言时使用。