swain-release by cristoslc/swain
npx skills add https://github.com/cristoslc/swain --skill swain-release通过检测项目的版本控制上下文、生成更新日志、提升版本号并打标签来完成发布。通过读取 git 历史记录和项目结构中的上下文而非硬编码假设,可在任何代码库中工作。
开始之前,如果存在 .agents/release.override.skill.md 文件,请先读取它。这是一个由项目所有者编写的自由格式 Markdown 文件,其指令将叠加在此技能之上——当内容冲突时,以该文件的内容为准。它可以缩小默认范围、指定版本文件位置、设置标签格式、添加发布前/后步骤,或任何其他操作。
如果不存在覆盖文件,则仅使用上下文检测继续。
从现有内容推断项目的发布约定。在向用户提出任何建议之前,先完成所有这些检查。
标签历史:
git tag --sort=-v:refname | head -20
从现有标签中推断:
v1.2.3、1.2.3、name-v1.2.3 或其他格式如果根本没有标签,请注明这是首次发布,并询问用户他们想要什么格式。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
自上次发布以来的提交:
git log <last-tag>..HEAD --oneline --no-decorate
如果不存在标签,则使用所有提交(或一个合理的窗口——如果提交数量有数百个,则询问用户)。
版本文件 — 扫描通常包含版本号的文件:
# 查找常见的版本载体
grep -rl 'version' --include='*.json' --include='*.toml' --include='*.yaml' --include='*.yml' -l . 2>/dev/null | head -20
同时检查 VERSION 文件、SKILL.md 前言中的 version:、package.json、pyproject.toml、Cargo.toml 等文件中的 version 字段。暂时不要修改任何内容——只需记录存在的内容。
解析自上次标签以来的提交,使用约定式提交前缀来建议版本提升级别:
| 提交前缀 | 建议 |
|---|---|
feat | 次版本提升 |
fix | 修订版本提升 |
docs、chore、refactor、test、ci | 修订版本提升 |
正文中包含 BREAKING CHANGE,或类型后带有 ! | 主版本提升 |
最高级别的信号胜出(任何破坏性变更 = 主版本,任何新功能 = 至少次版本,否则为修订版本)。
如果提交不遵循约定式提交格式,则回退到列出它们并询问用户认为合适的版本提升级别。
在执行任何操作之前,向用户展示发布计划。包括:
等待用户确认、调整版本或中止。如果用户想要与建议不同的版本,则使用他们的版本——建议只是一个起点,不是强制要求。
按约定式提交类型对提交进行分组。使用清晰、易于理解的标题:
## [1.5.0] - 2026-03-06
### 新功能
- 添加超能力计划摄取脚本 (#SPEC-003)
- 添加超能力检测和路由到 swain-design (#SPEC-004)
### 错误修复
- 修复跨目录引用上的 specwatch 误报
### 文档
- 完成 SPIKE-008 超能力评估
- 将 EPIC-009 过渡为完成状态
### 其他变更
- 更新 list-epics.md 和 list-specs.md 索引
约定:
feat:)将更新日志放在哪里:
CHANGELOG.md,则将新部分添加到顶部(在任何标题下方)更新步骤 1 中识别的文件中的版本字符串。要精确——只更改版本值,不更改周围内容。对于每种文件类型:
"version" 字段version = "..."version:如果一个文件有多个类似版本的字符串,并且不清楚要更新哪一个,请询问用户而不是猜测。
暂存更改的文件(更新日志 + 版本提升)并提交:
git add <changed-files>
git commit -m "release: v1.5.0"
然后创建一个带注释的标签:
git tag -a <tag> -m "Release <tag>"
使用步骤 1 中检测到的标签格式(或用户指定的格式)。
询问用户是否希望推送提交和标签:
git push && git push --tags
未经询问不要推送——用户可能希望先进行审查,或者他们可能有一个在标签上触发的 CI 流水线。
具有多个版本流的单体仓库: 如果标签历史表明存在按包的标签(例如,frontend-v1.2.0、api-v3.1.0),询问用户他们正在发布哪个包,而不是假设。
预发布版本: 如果用户要求预发布版本(alpha、beta、rc),则将预发布后缀附加到版本号:1.5.0-alpha.1。如果存在先前的预发布标签,则遵循现有约定。
没有约定式提交: 如果提交历史不使用约定式前缀,不要强制分组。提供一个扁平列表,让更新日志成为一个简单的变更项目列表。
工作区不干净: 如果在调用 /swain-release 时有未提交的更改,警告用户并询问是继续(更改不会包含在发布中)还是中止以便他们可以先提交。
每周安装次数
18
仓库
首次出现
3 天前
安全审计
安装于
opencode18
gemini-cli18
github-copilot18
codex18
amp18
cline18
Cut a release by detecting the project's versioning context, generating a changelog, bumping versions, and tagging. Works across any repo by reading context from git history and project structure rather than hardcoding assumptions.
Before starting, read .agents/release.override.skill.md if it exists. This is a freeform markdown file authored by the project owner whose instructions layer on top of this skill — its contents take precedence where they conflict. It can narrow defaults, specify version file locations, set tag formats, add pre/post-release steps, or anything else.
If no override exists, proceed with context detection alone.
Infer the project's release conventions from what already exists. Do all of these checks up front before proposing anything to the user.
Tag history:
git tag --sort=-v:refname | head -20
From existing tags, infer:
v1.2.3, 1.2.3, name-v1.2.3, or something elseIf there are no tags at all, note that this is the first release and ask the user what format they want.
Commits since last release:
git log <last-tag>..HEAD --oneline --no-decorate
If no tags exist, use all commits (or a reasonable window — ask the user if there are hundreds).
Version files — scan for files that commonly hold version numbers:
# Look for common version carriers
grep -rl 'version' --include='*.json' --include='*.toml' --include='*.yaml' --include='*.yml' -l . 2>/dev/null | head -20
Also check for VERSION files, version: in SKILL.md frontmatter, version fields in package.json, pyproject.toml, Cargo.toml, etc. Don't modify anything yet — just catalog what exists.
Parse commits since the last tag using conventional-commit prefixes to suggest a bump level:
| Commit prefix | Suggests |
|---|---|
feat | minor bump |
fix | patch bump |
docs, chore, refactor, test, ci | patch bump |
BREAKING CHANGE in body, or ! after type |
The highest-level signal wins (any breaking change = major, any feat = at least minor, otherwise patch).
If commits don't follow conventional-commit format, fall back to listing them and asking the user what bump level feels right.
Present the user with a release plan before executing anything. Include:
Wait for the user to confirm, adjust the version, or abort. If the user wants a different version than what was suggested, use theirs — the suggestion is a starting point, not a mandate.
Group commits by conventional-commit type. Use clear, human-readable headings:
## [1.5.0] - 2026-03-06
### New Features
- Add superpowers plan ingestion script (#SPEC-003)
- Add superpowers detection and routing to swain-design (#SPEC-004)
### Bug Fixes
- Fix specwatch false positives on cross-directory refs
### Documentation
- Complete SPIKE-008 superpowers evaluation
- Transition EPIC-009 to Complete
### Other Changes
- Update list-epics.md and list-specs.md indexes
Conventions:
feat: when it's already under "New Features")Where to put the changelog:
CHANGELOG.md exists, prepend the new section at the top (below any header)Update version strings in the files identified in step 1. Be surgical — only change the version value, not surrounding content. For each file type:
"version" fieldversion = "..."version: in YAML headerIf a file has multiple version-like strings and it's ambiguous which one to update, ask the user rather than guessing.
Stage the changed files (changelog + version bumps) and commit:
git add <changed-files>
git commit -m "release: v1.5.0"
Then create an annotated tag:
git tag -a <tag> -m "Release <tag>"
Use the tag format detected in step 1 (or what the user specified).
Ask the user if they want to push the commit and tag:
git push && git push --tags
Don't push without asking — the user may want to review first, or they may have a CI pipeline that triggers on tags.
Monorepo with multiple version streams: If the tag history suggests per-package tags (e.g., frontend-v1.2.0, api-v3.1.0), ask the user which package they're releasing rather than assuming.
Pre-release versions: If the user asks for a pre-release (alpha, beta, rc), append the pre-release suffix to the version: 1.5.0-alpha.1. Follow the existing convention if prior pre-release tags exist.
No conventional commits: If the commit history doesn't use conventional prefixes, don't force the grouping. Present a flat list and let the changelog be a simple bullet list of changes.
Dirty working tree: If there are uncommitted changes when /swain-release is invoked, warn the user and ask whether to proceed (changes won't be included in the release) or abort so they can commit first.
Weekly Installs
18
Repository
First Seen
3 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode18
gemini-cli18
github-copilot18
codex18
amp18
cline18
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
138,800 周安装
| major bump |