export-api
Generate api.md artifacts for changed Rust crates after code generation or source edits.
来源信息
- 仓库
- Azure/azure-sdk-for-rust
- 最近来源活动
- 2026年9月24日 21:39
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 886
- Forks
- 377
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- export-api
- description
- Generate api.md artifacts for changed Rust crates after code generation or source edits.
# Export API artifacts
Run this after regenerating sources or changing Rust code that can affect a crate's public API.
## Default workflow
1. Collect changed non-deleted files from Git. By default, use both staged and unstaged local changes:
```bash
{ git diff --staged --name-only --diff-filter=d; git diff --name-only --diff-filter=d; git ls-files --others --exclude-standard -- 'sdk'; } | sort -u
```
2. If the user wants branch-based detection instead, diff against the merge base with `main`:
```bash
base="$(git merge-base main HEAD)"
git diff --name-only --diff-filter=d "$base"...HEAD | sort -u
```
This branch-based mode only considers tracked branch changes; use the default local-change mode
when untracked files should also trigger API regeneration.
3. Assume service crates live under `sdk/<service-directory>/<crate-name>`. For each changed file under `sdk/`,
derive the candidate crate directory from the first three path segments and keep it only when
`<crate-directory>/Cargo.toml` exists.
4. For each affected crate, run the explicit generator command from the repository root:
```bash
cargo run --manifest-path eng/tools/generate_api/Cargo.toml -- \
--manifest-path <crate>/Cargo.toml
```
## Optional outputs
- Pass `--review` to also generate `api.metadata.yml`, `api.md.map`, and
`api.documentation.patch`.
## No changed crates
If no changed files map to a crate directory under `sdk/<service-directory>/<crate-name>`, stop and
report that no crate API artifacts need regeneration.
## Validation
After generation, check the resulting `api.md` files in `git diff` and report which crates were
updated.
在 GitHub 查看