Skip to content

Commit 4a50724

Browse files
authored
feat: add release-pr skill (#58)
1 parent 545eb37 commit 4a50724

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

.agents/skills/release-pr/SKILL.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
name: release-pr
3+
description: Prepare a version release pull request for this repository by validating a target semver, bumping Cargo package metadata, running pre-release checks, and creating a GitHub PR with gh. Use when asked to prepare a release PR, bump the crate version, run release readiness checks, or open the GitHub PR for a new gitee-cli release.
4+
---
5+
6+
# Release PR
7+
8+
Prepare a release branch and GitHub pull request for this Rust CLI repository.
9+
Stop after the PR is open. Do not create a tag or publish a GitHub release unless the user explicitly asks.
10+
11+
## Input
12+
13+
- Target version in semver form, for example `0.2.0`
14+
- Optional base branch; default to `main`
15+
16+
If the version is missing, ask for it before making changes.
17+
18+
## Preconditions
19+
20+
- Run from the repository root.
21+
- Check `git status --short`. If the worktree is not clean, stop and ask the user how to proceed.
22+
- Confirm `origin` points to the GitHub repository.
23+
- Confirm GitHub CLI authentication with `gh auth status`.
24+
- Prefer `git fetch origin --prune` before creating the release branch.
25+
26+
If any prerequisite is missing or fails, stop and explain the blocker before editing files.
27+
28+
## Guardrails
29+
30+
- Read the current version from `Cargo.toml`.
31+
- Accept only a valid semver target version.
32+
- Require the target version to differ from the current version.
33+
- Check whether `release/v<version>` already exists locally or remotely. If it exists, stop and ask.
34+
- Check whether tag `v<version>` already exists. If it exists, stop and ask.
35+
- Check whether an open GitHub PR already exists for `release/v<version>` or title `release: v<version>`. If it exists, stop and ask.
36+
- Do not edit `CHANGELOG.md`; this repository keeps release notes on the GitHub releases page.
37+
38+
## Version Update
39+
40+
Update only the release metadata:
41+
42+
- `Cargo.toml`: set `[package].version` to the target version
43+
- `Cargo.lock`: allow the root `gitee-cli` package version to change if Cargo updates it as part of the version bump
44+
45+
Do not make unrelated dependency or source changes as part of this workflow.
46+
47+
## Validation
48+
49+
Run the standard release checks after the version bump:
50+
51+
```bash
52+
cargo fmt -- --check
53+
cargo clippy --all-targets --all-features -- -D warnings
54+
cargo test
55+
```
56+
57+
If any command fails, stop and report the failure. Do not push a branch or create a PR with failing checks unless the user explicitly asks.
58+
59+
## Branch, Diff, and Commit
60+
61+
- Create branch `release/v<version>` from the chosen base branch. Default to `origin/main` when no base branch is provided.
62+
- Review `git diff --stat` and `git diff`.
63+
- Keep the diff limited to the version bump in `Cargo.toml` and, when applicable, the matching root package version change in `Cargo.lock`.
64+
- Commit with this exact message: `release: v<version>`
65+
66+
## Pull Request
67+
68+
Push the branch and create the PR non-interactively with `gh pr create`.
69+
70+
Use:
71+
72+
- Branch: `release/v<version>`
73+
- Title: `release: v<version>`
74+
- Base branch: the selected base branch, default `main`
75+
76+
Use a PR body with these sections:
77+
78+
- `Summary`: `Prepare gitee-cli v<version> for release.`
79+
- `Validation`: list the commands you ran
80+
- `Release Plan`: state that merging the PR should be followed by creating tag `v<version>`, and that `.github/workflows/release.yml` will draft the GitHub release assets
81+
82+
Prefer `--body-file` when creating a multiline PR body.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "Release PR"
3+
short_description: "Prepare release checks and GitHub PRs"
4+
default_prompt: "Use $release-pr to prepare a new version release branch and GitHub PR for this repository."

0 commit comments

Comments
 (0)