Files
pkg/skills/pkg-update/SKILL.md
T
jiantw83 5ae3611960 feat(pkg-update): 新增版本改寫工具並改用工具呼叫
What: 新增 tools/apply-version.sh,依 ecosystem 改寫專案的版本來源檔(package.json / requirements.txt / pyproject.toml / *.csproj),把指定套件釘選到指定版本;skills/pkg-update/SKILL.md 的改寫步驟改成呼叫這支工具;README.md 補上工具說明;plugin.json、.claude-plugin/plugin.json、.codex-plugin/plugin.json 版本號由 0.0.1 升到 0.0.2。
Why: jsc-meta:skill-check 稽核發現 SKILL.md 用文字描述改寫邏輯,不符合「邏輯放工具、SKILL.md 只放步驟」的準則,需要把改寫邏輯抽成獨立工具。
How: 依 tools/list-packages.sh 已支援的四種生態(nodejs 的 package.json、python 的 requirements.txt 或 pyproject.toml、dotnet 的 *.csproj)撰寫對應的 parse 與 rewrite 邏輯,找不到檔案時 exit 3、找不到套件時 exit 4;SKILL.md 步驟改成呼叫 `tools/apply-version.sh {ecosystem} {project dir} {name} {version}`;三份 manifest 版本號同步升級。
Who: jsc-pkg 套件更新流程,影響 pkg-update 技能與所有安裝 jsc-pkg 的使用者。
2026-08-24 14:48:30 +08:00

23 lines
1.6 KiB
Markdown

---
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 — batch-update packages
## Steps
1. Run `tools/list-packages.sh {project dir}` to get every external package (ecosystem, name, current version).
2. Confirm the working tree is clean: stop and report when uncommitted changes exist, so the revert cannot destroy them.
3. Update ecosystem by ecosystem. This step **MUST run as a sub agent** (one sub agent per ecosystem):
1. For every package, run `tools/latest-version.sh {ecosystem} {name}` to get the latest stable version.
2. Run `tools/apply-version.sh {ecosystem} {project dir} {name} {version}` to rewrite the version source file (package.json / requirements.txt / pyproject.toml / *.csproj).
3. Re-resolve and install (`npm install` / `pip install -r` / `dotnet restore`).
4. Run build and tests:
- nodejs: `npm run build` (if present) plus `npm test` (if present).
- python: `pytest` (when tests exist).
- dotnet: `dotnet build` plus `dotnet test`.
- When the commands cannot be inferred, ask the user per the `jsc-ask:ask` rules.
5. Build or tests fail → revert every change (`git checkout -- .` and clean untracked lock changes), then report the failing packages with an error summary.
6. Success → report the update list (package, old version, new version) and hand off to `jsc-git:commit`.