بنقرة واحدة
upgrade-from-github
从 GitHub release 拉取最新 naozhi binary 并部署。当用户要求升级、更新、拉新版本、naozhi upgrade 时触发。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
从 GitHub release 拉取最新 naozhi binary 并部署。当用户要求升级、更新、拉新版本、naozhi upgrade 时触发。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Engineering workflow gate for the naozhi repo. Enforces a hard "isolated worktree → independent review → PR" loop on every code-touching task: every feature or bug fix starts on a fresh git worktree (never main / never the current working branch), runs a code review before the PR opens, and ships through a PR — no direct push to the main branch. Also enforces design-doc requirements for features, classifies bug fixes by size and risk, blocks PRs that lack tests/regression evidence/rollback plans, and routes deployment through the `naozhi upgrade` release pipeline. TRIGGER when working in the naozhi repo and the user asks to implement a feature, refactor, fix a bug, or release a new version; or when about to write code that touches >20 lines, >3 files, or any item on the risk checklist. DO NOT TRIGGER for typo fixes, comment-only edits, or pure documentation changes.
Triage raw review-agent findings before they become noise. Takes a `docs/review/R{ROUND}-raw.md` file (one finding per `- ` bullet, with anchor like `R249-GO-3`) and routes each to one of three buckets - GitHub Issue (real problems), `docs/cosmetic-backlog.md` (godoc/naming/comment-only), or discarded (false positive / already fixed / duplicate). Verifies each finding against the current code (grep file paths, line numbers, function names) before opening anything. TRIGGER when a review skill produces `docs/review/R*-raw.md`, when the user says "triage these findings" / "process this review output", or when about to bulk-import historical findings into issues. DO NOT TRIGGER for one-off bug reports the user types directly - those go straight to a normal bug-fix workflow.
Engineering workflow gate for the naozhi repo. Enforces a hard "isolated worktree → independent review → PR" loop on every code-touching task: every feature or bug fix starts on a fresh git worktree (never main / never the current working branch), runs a code review before the PR opens, and ships through a PR — no direct push to the main branch. Also enforces design-doc requirements for features, classifies bug fixes by size and risk, blocks PRs that lack tests/regression evidence/rollback plans, and routes deployment through the `naozhi upgrade` release pipeline. TRIGGER when working in the naozhi repo and the user asks to implement a feature, refactor, fix a bug, or release a new version; or when about to write code that touches >20 lines, >3 files, or any item on the risk checklist. DO NOT TRIGGER for typo fixes, comment-only edits, or pure documentation changes.
| name | upgrade-from-github |
| description | 从 GitHub release 拉取最新 naozhi binary 并部署。当用户要求升级、更新、拉新版本、naozhi upgrade 时触发。 |
| disable-model-invocation | true |
| allowed-tools | Bash |
curl -s http://localhost:8180/health 2>/dev/null | python3 -c 'import json,sys;d=json.load(sys.stdin);print(d.get("version","unknown"))' 2>/dev/null || echo "服务未运行"launchctl list com.naozhi.agent 2>/dev/null | head -3 || echo "未注册"ls -la /Users/zhaokm/workspace/naozhi/bin/naozhi 2>/dev/null || echo "缺失"naozhi-darwin-amd64,Linux 改对应 release 资源名com.naozhi.agent),naozhi upgrade 内部会调 launchctl kickstart -k 自动重启go build。本 skill 只走 release 流程;本地编译产物 ldflags 没注入,version 会是 dev,导致 naozhi upgrade 必须 --force 才能升/Users/zhaokm/workspace/naozhi/bin/naozhi upgrade --check-only
Already at the latest version (vX.Y.Z). → 已最新,停止并报告用户New version available: vA → vB → 继续步骤 2Running a dev build. Use --force... → 当前是本地编译产物,需要先讨论:
--force/Users/zhaokm/workspace/naozhi/bin/naozhi upgrade
内部依次:下载 naozhi-darwin-arm64 → SHA-256 校验 → atomic rename bin/naozhi → launchctl kickstart -k com.naozhi.agent。
任何一步失败它会自动 rollback 备份,不会留下半残状态。
sleep 3 && curl -s http://localhost:8180/health | python3 -c 'import json,sys;d=json.load(sys.stdin);print("version:",d["version"]);print("uptime:",d["uptime"])'
uptime 应 < 10 秒(刚被 launchd 重启)、version 应是新 tag。
防止 launchd race(老进程 mmap 老 inode + mv 之后没生效的情况):
PID=$(launchctl list com.naozhi.agent | awk '/PID/{print $3}')
DISK_SIZE=$(stat -f%z /Users/zhaokm/workspace/naozhi/bin/naozhi)
PROC_SIZE=$(lsof -p "$PID" 2>/dev/null | awk '$4=="txt" && /bin\/naozhi$/{print $7}')
[ "$DISK_SIZE" = "$PROC_SIZE" ] && echo "OK: process maps new binary ($PROC_SIZE bytes)" || echo "MISMATCH: disk=$DISK_SIZE proc=$PROC_SIZE — run launchctl kickstart -k gui/$(id -u)/com.naozhi.agent"
MISMATCH 时执行提示里那条 kickstart 命令,再回到步骤 3 验证。
dashboard 注册了 /sw.js,旧 SW 会劫持资源即使后端是新的也读老缓存。升级后必须告诉用户手工清:
Chrome 打开 http://localhost:8180/dashboard
Cmd+Option+I → Application → Service Workers → Unregister
→ Storage → Clear site data
关 DevTools,Cmd+Shift+R 硬刷新
PWA(MBP Naozhi.app)同步骤,在 PWA 窗口里开 DevTools。
go buildlaunchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.naozhi.agent.plist,不在本 skill 范围,提示用户先恢复/health 返回 connection refused: 进程没起来。看 ~/.naozhi/logs/stderr.log 报告错误,不要自动 rollback — 用户的 config 可能跟新 binary 不兼容(rare)