Lime release workflow

From limecloud/lime · View interactive version

Lime release workflow is an AI agent skill from the GitHub repository limecloud/lime. 准备并执行 Lime 发版;覆盖版本号、发布说明、产物清理、验证门禁、commit、tag 和推送。

How to use this skill

Skill file

Lime 发版流程

核心原则

入口判断

  1. 明确目标版本。
  1. 检查现状。
  1. 如果发现上一轮发版命令仍在跑,只停止自己启动且已被用户中断的进程;不杀掉明显属于用户的 dev server / test / Electron 进程。

Release Candidate 范围确认

发版前必须先回答“这次发布到底包含哪些改动”。不要把 dirty worktree 当成噪音,也不要默认只提交版本文件。

  1. 用 git status --short、git diff --stat、git diff --name-only 和 git ls-files --others --exclude-standard 盘点当前未提交 / 未跟踪文件。
  2. 如果用户说“发版 vX.Y.Z”“递交发布”“发布推送”,且工作区有未提交产品改动,默认这些改动属于本次 release candidate。
  3. 将改动分成:
  1. 如果无法从上下文确定哪些文件应排除,必须停下来向用户确认;不能自行假设“只提交发版文件”。
  2. 如果需要提交全部当前工作树,git add 应覆盖 tracked 和 untracked candidate files,例如 git add -A 或显式文件清单;提交前用 git diff --cached --stat 复核 staged 内容。
  3. 如果本地已经创建或推送 tag 后才发现漏发 candidate changes,不要继续普通提交并假装同一版本完成;必须说明现状,并在“重打 tag”或“发补丁版”之间让用户选择。已推送 tag 的删除 / 重建 / force push 必须单独危险确认。

更新版本事实源

必须同步这些事实源;仓库不存在或不包含显式版本的文件不要强行创建或改写:

更新方式优先使用结构化解析;锁文件和 Cargo lock 的 workspace 版本可做机械替换,但替换前后要用 rg 复核旧版本残留。

改完立即执行:

npm run verify:app-version

更新 Release Notes

事实源是根目录:

生成内容时同时参考:

整文件格式保持:

## Lime vX.Y.Z

### 新功能

### 修复

### 优化与重构

### 测试与质量

### 文档

### 其他

**完整变更**: `vA.B.C` -> `vX.Y.Z`

英文 companion 使用对应英文标题,保留 “Simplified Chinese release notes are the primary version” 说明。不要把内部 commit message 逐条照搬成 release note;要合并成面向发布的可读条目。写完后用 sed -n '1,120p' RELEASE_NOTES*.md 或等价方式确认文件内没有旧版本标题。

删除旧内容

验证矩阵

默认发版验证按“稳定必要门禁优先,重型矩阵按需扩展”执行。版本改动后必须先跑:

npm run verify:app-version
npm run typecheck

然后按改动风险补充:

npm run test:contracts      # 协议 / Bridge / command catalog / mock / governance 变更
npm run verify:gui-smoke    # GUI 壳、Workspace、主路径或正式发布尽量执行;跑不了要说明环境限制

不要把下面这些命令作为默认发版阻断项:

只有用户明确要求“完整矩阵 / 全量门禁 / CI 同款验证”,或当前改动直接需要它们时才执行。需要验证时优先使用更稳定的定向入口:

npx eslint "<changed-path>" --max-warnings 0
npm run test:related -- <files>
npm run test:changed -- <ref>
npm run test:resume
npm run test:rust:changed
npm run test:rust:related -- <paths...>
npm run test:rust:unit -- -p <crate> <filter>
cargo test --manifest-path "lime-rs/Cargo.toml" -p <crate> <filter>

前端全量 Vitest 通过 scripts/run-vitest-smart.mjs 分批执行并写入 .lime/test/vitest-smart-last-run.json。如果 npm test 已经失败或被用户中断,继续发版验证时默认先执行 npm run test:resume,也可以用 npm test -- --from-batch <N>、npm test -- --only-batch <N> 精确补批次。只有测试收集规则、批次大小、依赖图或目标分支已经改变,才从头执行裸 npm test,并在汇报中说明原因。

如果只做 release note 或文档更新,可按 internal/aiprompts/quality-workflow.md 降级;正式发版默认仍保留 npm run typecheck,但用户明确要求“马上递交”或“立即递交”时可跳过该项,最终汇报必须说明门禁降级理由。

Commit / Tag / Push

完整发版默认必须包含 commit / tag / push。不要在验证通过后只汇报“可以提交了”就结束;应主动给出危险操作确认请求。只有用户明确说“只准备、不提交 / 不打 tag / 不推送”时,才允许停在准备态,并在最终汇报中标明不是完整发布。

拿到 git 写操作确认后,必须把 git add、git commit、git tag、git push origin main、git push origin <tag> 与远端 tag 复核连续执行到底;不能在 commit 后停下让用户自己打 tag,也不能在 tag 后停下让用户自己 push。若中间失败,先修复或明确阻塞,不要把剩余步骤转交给用户。

执行任何 git 写操作前,先汇总:

然后按危险操作格式请求确认。确认后再执行:

git add <release-candidate-files>
git commit -m "Release vX.Y.Z"
git tag vX.Y.Z
git push origin main
git push origin vX.Y.Z

确认后不要只执行其中一部分。不要依赖 git push origin main --follow-tags 作为唯一 tag 推送方式:轻量 tag 不会被 --follow-tags 推送,容易造成 main 已发布但远端 release tag 缺失。若 main 已推送但 git ls-remote --tags origin "refs/tags/vX.Y.Z" 为空,必须继续执行 git push origin vX.Y.Z 并再次复核。若 git add、git commit、git tag 或任一 git push 失败,必须修复或明确说明阻塞点;成功后立即复核:

git status --short
git log --oneline --decorate --max-count=3
git tag --list "vX.Y.Z"
git ls-remote --tags origin "refs/tags/vX.Y.Z"

如果 tag 已存在或已推送,不要覆盖;先说明本地与远端 tag 状态,并单独确认删除或重建策略。重打已推送 tag 时,必须明确说明会改写远端发布引用,并优先建议补丁版,除非用户明确要求保留同一版本号。

收尾输出

最终汇报必须包含:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.