Skip to content

Commit 2fb635e

Browse files
authored
Plugin: add prerelease release workflow (#7)
1 parent 4a0d1d0 commit 2fb635e

File tree

9 files changed

+303
-42
lines changed

9 files changed

+303
-42
lines changed

.agents/skills/release/SKILL.md

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: release
3-
description: "Plan and publish a GitHub Release in a tag-driven repository. Use when a user asks to cut, prepare, or publish a software release, propose the next vX.Y.Z tag, draft better release notes from PRs and direct commits since the last release, update CHANGELOG.md, create the tag pinned to an exact commit, and watch the publish workflow."
3+
description: "Plan and publish a GitHub Release in a tag-driven repository. Use when a user asks to cut, prepare, or publish a stable or prerelease, propose the next vX.Y.Z or vX.Y.Z-beta.N tag, draft better release notes from PRs and direct commits since the last release, update CHANGELOG.md when appropriate, create the tag pinned to an exact commit, and watch the publish workflow."
44
---
55

66
# Release
@@ -16,9 +16,12 @@ Use this skill for repos that publish from GitHub Releases and want human-writte
1616
- Fast-forward the default branch before editing: `git pull --ff-only origin <default-branch>`.
1717
- Never force-push the default branch.
1818
- Never use GitHub generated release notes for this workflow.
19-
- Always create the release tag with a leading `v`, for example `v0.1.0`.
19+
- Always create the release tag with a leading `v`, for example `v0.1.0` or `v0.2.0-beta.1`.
2020
- Always pin the release to the exact changelog commit SHA with `gh release create --target <sha>`.
2121
- If `origin/<default-branch>` moves after planning or before pushing, stop and regenerate the release plan.
22+
- For prereleases, use a semver prerelease tag that names the npm dist-tag you want, for example `v0.2.0-beta.1` -> npm `beta`.
23+
- For prereleases, create the GitHub release with `--prerelease`.
24+
- Prefer leaving `CHANGELOG.md` untouched for prereleases unless the user explicitly wants beta entries there; that keeps later promotion to stable cleaner.
2225

2326
## Helper Script
2427

@@ -28,6 +31,19 @@ Use the bundled planner to gather release facts and raw note inputs:
2831
python3 .agents/skills/release/scripts/release_plan.py --output-dir .local/release
2932
```
3033

34+
Examples:
35+
36+
```bash
37+
# Plan the next stable release.
38+
python3 .agents/skills/release/scripts/release_plan.py --output-dir .local/release
39+
40+
# Plan the next beta prerelease for the upcoming stable line.
41+
python3 .agents/skills/release/scripts/release_plan.py --channel beta --output-dir .local/release
42+
43+
# Promote an existing beta tag to a stable release from the same code base.
44+
python3 .agents/skills/release/scripts/release_plan.py --promote-from v0.2.0-beta.2 --output-dir .local/release
45+
```
46+
3147
It writes:
3248

3349
- `.local/release/release-plan.json`
@@ -38,9 +54,11 @@ The planner:
3854
- finds the latest published semver release
3955
- counts first-parent commits on the default branch since that release
4056
- filters leaked release-housekeeping commits such as changelog-only commits
41-
- proposes the next tag
57+
- proposes the next stable tag, prerelease tag, or promotion target
4258
- groups PR-backed changes separately from direct commits on `main`
4359
- captures contributor mentions for PR-backed items
60+
- when planning a prerelease, increments tags like `v0.2.0-beta.1`, `v0.2.0-beta.2`, and so on
61+
- when planning a promotion, pins the plan to the exact prerelease tag commit instead of whatever is now at `origin/<default-branch>`
4462

4563
## Approval Prompt
4664

@@ -49,8 +67,9 @@ Before making any changelog edit, commit, push, tag, or release, show the user:
4967
- the last release tag
5068
- the raw and meaningful commit counts since that release
5169
- the suggested new tag and why
52-
- whether the change looks like a minor release or a small emergency patch
53-
- the exact commit SHA currently at `origin/<default-branch>`
70+
- whether the change looks like a stable minor, a small emergency patch, a prerelease, or a prerelease promotion
71+
- the exact commit SHA currently targeted by the release plan
72+
- for prereleases, the npm dist-tag that will be used instead of `latest`
5473

5574
If the meaningful commit count is less than `3`, explicitly warn that there are not many changes in this release and ask whether they still want to proceed.
5675

@@ -60,7 +79,7 @@ If the meaningful commit count is less than `3`, explicitly warn that there are
6079
- Rewrite each PR-backed item into a clearer user-facing bullet.
6180
- For direct commits on `main` with no PR, use the commit subject and body as raw input and rewrite those too.
6281
- Add the PR author mention on the same line for PR-backed entries.
63-
- Keep the same substance in `CHANGELOG.md` and the GitHub release notes.
82+
- Keep the same substance in `CHANGELOG.md` and the GitHub release notes for stable releases.
6483
- Prefer grouped sections such as `Highlights`, `Fixes`, `Performance`, `Docs`, and `Internal` when they fit the release.
6584
- If `CHANGELOG.md` does not exist, create it with a `# Changelog` header.
6685
- Insert the new release section at the top, directly under the file header if there is one.
@@ -76,6 +95,9 @@ If the meaningful commit count is less than `3`, explicitly warn that there are
7695
docs: add changelog for v0.1.0
7796
```
7897

98+
- For prereleases, prefer writing only `.local/release/release-notes.md` and skipping a changelog commit unless the user explicitly wants prerelease changelog entries.
99+
- For promotion from `vX.Y.Z-beta.N` to `vX.Y.Z`, either tag the same prerelease commit for exact code parity or add only changelog/release-note edits on top before creating the stable tag.
100+
79101
## Versioning Heuristic
80102

81103
Use the planner's suggestion unless the user overrides it.
@@ -84,6 +106,9 @@ Use the planner's suggestion unless the user overrides it.
84106
- Use a patch bump only for a small hotfix shortly after the previous release.
85107
- Treat `v0.9.0` -> `v0.10.0` as the normal next minor bump.
86108
- Do not jump from `v0.9.0` to `v1.0.0` unless the user explicitly asks.
109+
- For prereleases, keep the stable base and add a channel suffix such as `v0.2.0-beta.1`.
110+
- The prerelease channel name becomes the npm dist-tag, so `v0.2.0-beta.1` publishes to `@beta` and does not replace `@latest`.
111+
- Promotion removes the prerelease suffix: `v0.2.0-beta.2` -> `v0.2.0`.
87112

88113
The bundled planner treats a patch release as the default only when all of these are true:
89114

@@ -105,14 +130,27 @@ git pull --ff-only origin "$default_branch"
105130
python3 .agents/skills/release/scripts/release_plan.py --output-dir .local/release
106131
```
107132

133+
For a beta prerelease:
134+
135+
```bash
136+
python3 .agents/skills/release/scripts/release_plan.py --channel beta --output-dir .local/release
137+
```
138+
139+
For promotion from an existing beta tag:
140+
141+
```bash
142+
python3 .agents/skills/release/scripts/release_plan.py --promote-from v0.2.0-beta.2 --output-dir .local/release
143+
```
144+
108145
2. Read `.local/release/release-plan.md` and summarize the proposed release for approval.
109146

110-
3. After approval, write:
147+
3. After approval:
111148

112-
- `.local/release/release-notes.md`
113-
- `CHANGELOG.md`
149+
- always write `.local/release/release-notes.md`
150+
- for stable releases, update `CHANGELOG.md`
151+
- for prereleases, skip `CHANGELOG.md` unless the user explicitly wants prerelease changelog entries
114152

115-
4. Commit and push the changelog commit on top of the planned branch tip.
153+
4. If you updated `CHANGELOG.md`, commit and push the changelog commit on top of the planned source tip.
116154

117155
```bash
118156
git add CHANGELOG.md
@@ -121,10 +159,28 @@ git push origin HEAD:"$default_branch"
121159
release_sha=$(git rev-parse HEAD)
122160
```
123161

162+
If you did not update `CHANGELOG.md`, release directly from the planned SHA:
163+
164+
```bash
165+
release_sha=$(jq -r '.planning.baseSha' .local/release/release-plan.json)
166+
```
167+
124168
5. Create the release from that exact commit.
125169

170+
Stable:
171+
172+
```bash
173+
gh release create "<tag>" \
174+
--target "$release_sha" \
175+
--title "<tag>" \
176+
--notes-file .local/release/release-notes.md
177+
```
178+
179+
Prerelease:
180+
126181
```bash
127182
gh release create "<tag>" \
183+
--prerelease \
128184
--target "$release_sha" \
129185
--title "<tag>" \
130186
--notes-file .local/release/release-notes.md
@@ -152,3 +208,4 @@ gh run view "$run_id" --log-failed
152208
- Mention direct-to-main commits that would otherwise be invisible to GitHub's PR-based notes.
153209
- If the approval gap was long, rerun the planner immediately before editing `CHANGELOG.md`.
154210
- If the push to the default branch is rejected, stop and regenerate notes from the new branch tip instead of rebasing blindly.
211+
- For prerelease promotion, do not mix new product commits into the promotion step. Either tag the exact beta commit or keep follow-up changes limited to changelog/release metadata.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
interface:
22
display_name: "Release"
33
short_description: "Plan and publish a GitHub release with a real changelog"
4-
default_prompt: "Use $release to prepare a GitHub Release, propose the next vX.Y.Z tag, draft better notes than GitHub's defaults, update CHANGELOG.md, and publish from the exact changelog commit."
4+
default_prompt: "Use $release to prepare a GitHub release, whether stable or prerelease. Propose the next vX.Y.Z or vX.Y.Z-beta.N tag, draft better notes than GitHub's defaults, update CHANGELOG.md when appropriate, publish from the exact target commit, and preserve an upgrade path from beta to stable on the same code base."

0 commit comments

Comments
 (0)