Plan, batch, and verify dependency upgrades safely. Triages outdated packages into risk tiers, upgrades in order (dev/minor/patch first, runtime majors last), v
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-dependency-upgrade-47c45ff4789b ,按照其中的说明把「dependency-upgrade」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Invocation points:
/gsd start dep-upgrade workflow is running<core_principle>
BATCH BY RISK, NOT BY LAZINESS. npm update is a shortcut that blends safe and risky changes into one commit. When something breaks, you can't tell which dep caused it. Always separate: patches and dev-deps first, minors next, majors individually.
VERIFY BETWEEN BATCHES. Run the test suite after every batch. Don't stack five batches and hope. If a batch breaks something, you need to know which one.
ONE MAJOR PER COMMIT. Major version bumps are where real breakage lives. Keep them isolated so the commit history tells the truth. </core_principle>
Run the ecosystem's outdated check. Capture output, don't act on it yet:
npm outdated or pnpm outdated or yarn outdatedpip list --outdated or uv pip list --outdatedcargo outdatedbundle outdatedgo list -m -u allAlso capture:
npm audit (or equivalent) — security advisoriesFor each outdated package, note:
rg.)Order:
Skip (for now):
Present the plan to the user. One round of adjustment. Then execute.
For each batch:
git status — no uncommitted changes.npm install package@version ..., uv add …, cargo update -p …).lsp diagnostics on changed files + the project linter.If any step fails:
Commit with a precise message:
deps: bump <scope> — <what changed in one line>
- package-a: 1.2.3 → 1.2.9 (patch)
- package-b: 2.1.0 → 2.4.0 (minor — no breaking changes in CHANGELOG)
- package-c: 3.0.1 → 3.0.2 (patch)
Verified: npm test (84/84 pass), npm run build exit 0, lsp diagnostics clean.
For each major that breaks something:
rg for the symbols that changed./gsd start refactor follow-up and pin the current major for now.S##). The dep upgrade is only one task; the migration is the rest of the slice.After all batches, produce a rollup:
## Dependency Upgrade — <date>
### Completed
- Batch 1 (dev patches): 12 packages — commit abc1234
- Batch 2 (runtime patches): 5 packages — commit def5678
- Batch 3 (runtime minors): 3 packages — commit ...
- Batch 4 (React 18 → 19): commit ... — required refactors in <files>
### Deferred
- typescript 5.3 → 5.7 — requires updating 40+ decorator usages. Filed as M005.
- vite 4 → 5 — config shape changed. Owner assigned: <user>.
### Still outdated (intentional)
- <package> — pinned because <reason>
### Security advisories
- <CVE> resolved by <package upgrade>
- <CVE> still open — not exploitable in our usage (see comment in package.json)
Append to .gsd/KNOWLEDGE.md any non-obvious gotcha from the upgrade (API changes that tripped you up, migration rituals for this codebase).
<anti_patterns>
npm update blindly. Mixes safe and risky in one undiagnosable commit.--force. Leave it broken or roll back; don't lie to git.--legacy-peer-deps warnings. They're telling you the dep graph is incoherent.</anti_patterns>
<success_criteria>
verify-before-complete).</success_criteria>