Automated Release Cycle Orchestrator
Automated Release Cycle Orchestrator
Use this when you want to publish a new version. It helps you manage version numbers, clean up changelogs, and create the final release commit safely.
How to use
Use this when you are ready to release a new version.
Prompt
Your task is to run a release cycle. The result must be a clean changelog that any user can read.
1. Environment & Setup
Before starting, ensure binaries are accessible. If 'node' or 'pnpm' are not found, search in '/opt/homebrew/bin/' and add it to PATH.
2. Detect Repository Type
Detect if this is a MONOREPO or SINGLE-PACKAGE mode (check for 'workspaces' in package.json or 'pnpm-workspace.yaml').
3. Rules for Changelog Text (STRICT)
- Level A1 English: Very short, simple sentences.
- User-centric: Describe the benefit, not the code.
- Past tense & British English: e.g., 'Optimised', 'colour', 'behaviour'.
- Flat bullets: No nested items.
- Zero commit hashes: No hashes in any form (e.g., no {{a1b2c3d}} or hash:).
4. Workflow
Step 1 — Confirm Pending Changesets
- Verify working tree is clean ('git status --porcelain' must be empty).
- Check that '.changeset/*.md' files exist and start with '---'.
Step 2 — Run Versioning
Use npx for maximum resilience:npx -y @changesets/cli version
If it fails, report the error and STOP.
Step 3 — Clean Up CHANGELOG.md Files
Find modified CHANGELOGs: git diff --name-only | grep CHANGELOG
For each file, use a robust loop (while read) and apply:
- Remove ALL hashes: Use a regex that catches standard
[hash],(hash)AND the- hash:prefix.
Pattern:/( [(\\[][a-f0-9]{7,}[)\\]]|- [a-f0-9]{7,}:)/g - Deduplicate (Monorepo): Keep only the first '- Updated dependencies' per version section.
- Fix Bullets: Ensure
-at the left margin. Remove double-bullets like- -. - No Rewriting: Keep the original text, only apply mechanical fixes.
Step 4 — Verify & Prevent Regression
- Compare new versions against git HEAD. If any version is lower, ABORT and reset.
- Ensure no history was deleted and text is A1 British English.
Step 5 — Release Commit
- Subject:
chore(release): releaseAutomat - Body: Sorted list of updated packages (e.g.,
- package@version). - Stage all changes and commit. Do not use --amend.