Files
pkg/skills/pkg-update/SKILL.md
2026-08-21 13:08:43 +08:00

23 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: pkg-update
description: Update every external package of a project to its latest stable version using list-packages.sh and latest-version.sh, then run build and tests. Revert all changes on failure. Supports nodejs, python, and dotnet projects. Use for dependency refresh; not for adding or removing packages.
---
# pkg-update — 套件批次更新
## 步驟
1. `tools/list-packages.sh {專案目錄}` 取得所有外部套件(ecosystem / name / current)。
2. 確認工作樹乾淨:有未認可變更就先停止並回報(避免還原時誤傷)。
3. 逐 ecosystem 更新,此步驟**必須以 sub agent 執行**(每個 ecosystem 一個 sub agent):
1. 對每個套件 `tools/latest-version.sh {ecosystem} {name}` 查最新穩定版。
2. 改寫版本來源檔(package.json / requirements.txt / pyproject.toml / *.csproj)。
3. 重新解析安裝(`npm install` / `pip install -r` / `dotnet restore`)。
4. 執行建置與測試:
- nodejs:`npm run build`(如有)+ `npm test`(如有)。
- python:`pytest`(如有測試)。
- dotnet:`dotnet build` + `dotnet test`。
- 推斷不出指令時依 `jsc-ask:ask` 規則詢問使用者。
5. 建置或測試失敗 → 還原全部變更(`git checkout -- .` 與清除未追蹤的 lock 變更),回報失敗套件與錯誤摘要。
6. 成功 → 回報更新清單(套件 / 舊版 / 新版),交由 `jsc-git:commit` 認可。