dependency-updater
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDependency Updater
依赖项更新工具
Smart dependency management for any language with automatic detection and safe updates.
适用于任意语言的智能依赖管理工具,支持自动检测与安全更新。
Quick Start
快速开始
update my dependenciesThe skill auto-detects your project type and handles the rest.
update my dependencies该工具会自动检测你的项目类型并处理后续操作。
Triggers
触发指令
| Trigger | Example |
|---|---|
| Update dependencies | "update dependencies", "update deps" |
| Check outdated | "check for outdated packages" |
| Fix dependency issues | "fix my dependency problems" |
| Security audit | "audit dependencies for vulnerabilities" |
| Diagnose deps | "diagnose dependency issues" |
| 触发指令 | 示例 |
|---|---|
| 更新依赖项 | "update dependencies", "update deps" |
| 检查过期依赖 | "check for outdated packages" |
| 修复依赖问题 | "fix my dependency problems" |
| 安全审计 | "audit dependencies for vulnerabilities" |
| 诊断依赖项 | "diagnose dependency issues" |
Supported Languages
支持的语言
| Language | Package File | Update Tool | Audit Tool |
|---|---|---|---|
| Node.js | package.json | | |
| Python | requirements.txt, pyproject.toml | | |
| Go | go.mod | | |
| Rust | Cargo.toml | | |
| Ruby | Gemfile | | |
| Java | pom.xml, build.gradle | | |
| .NET | *.csproj | | |
| 语言 | 包文件 | 更新工具 | 审计工具 |
|---|---|---|---|
| Node.js | package.json | | |
| Python | requirements.txt, pyproject.toml | | |
| Go | go.mod | | |
| Rust | Cargo.toml | | |
| Ruby | Gemfile | | |
| Java | pom.xml, build.gradle | | |
| .NET | *.csproj | | |
Quick Reference
快速参考
| Update Type | Version Change | Action |
|---|---|---|
| Fixed | No | Skip (intentionally pinned) |
| PATCH | | Auto-apply |
| MINOR | | Auto-apply |
| MAJOR | | Prompt user individually |
| 更新类型 | 版本变更 | 操作 |
|---|---|---|
| 固定版本 | 无 | 跳过(为有意固定的版本) |
| PATCH 版本 | | 自动应用 |
| MINOR 版本 | | 自动应用 |
| MAJOR 版本 | | 逐个询问用户 |
Workflow
工作流程
User Request
│
▼
┌─────────────────────────────────────────────────────┐
│ Step 1: DETECT PROJECT TYPE │
│ • Scan for package files (package.json, go.mod...) │
│ • Identify package manager │
├─────────────────────────────────────────────────────┤
│ Step 2: CHECK PREREQUISITES │
│ • Verify required tools are installed │
│ • Suggest installation if missing │
├─────────────────────────────────────────────────────┤
│ Step 3: SCAN FOR UPDATES │
│ • Run language-specific outdated check │
│ • Categorize: MAJOR / MINOR / PATCH / Fixed │
├─────────────────────────────────────────────────────┤
│ Step 4: AUTO-APPLY SAFE UPDATES │
│ • Apply MINOR and PATCH automatically │
│ • Report what was updated │
├─────────────────────────────────────────────────────┤
│ Step 5: PROMPT FOR MAJOR UPDATES │
│ • AskUserQuestion for each MAJOR update │
│ • Show current → new version │
├─────────────────────────────────────────────────────┤
│ Step 6: APPLY APPROVED MAJORS │
│ • Update only approved packages │
├─────────────────────────────────────────────────────┤
│ Step 7: FINALIZE │
│ • Run install command │
│ • Run security audit │
└─────────────────────────────────────────────────────┘用户请求
│
▼
┌─────────────────────────────────────────────────────┐
│ 步骤1:检测项目类型 │
│ • 扫描包文件(package.json、go.mod等) │
│ • 识别包管理器 │
├─────────────────────────────────────────────────────┤
│ 步骤2:检查前置条件 │
│ • 验证所需工具已安装 │
│ • 若缺失则建议安装 │
├─────────────────────────────────────────────────────┤
│ 步骤3:扫描更新 │
│ • 运行对应语言的过期依赖检查 │
│ • 分类:MAJOR / MINOR / PATCH / 固定版本 │
├─────────────────────────────────────────────────────┤
│ 步骤4:自动应用安全更新 │
│ • 自动应用MINOR和PATCH版本更新 │
│ • 报告已更新的内容 │
├─────────────────────────────────────────────────────┤
│ 步骤5:询问大版本更新 │
│ • 针对每个MAJOR版本更新询问用户 │
│ • 显示当前版本 → 新版本 │
├─────────────────────────────────────────────────────┤
│ 步骤6:应用已批准的大版本更新 │
│ • 仅更新已获批准的包 │
├─────────────────────────────────────────────────────┤
│ 步骤7:完成 │
│ • 运行安装命令 │
│ • 执行安全审计 │
└─────────────────────────────────────────────────────┘Commands by Language
各语言对应的命令
Node.js (npm/yarn/pnpm)
Node.js (npm/yarn/pnpm)
bash
undefinedbash
undefinedCheck prerequisites
检查前置条件
scripts/check-tool.sh taze "npm install -g taze"
scripts/check-tool.sh taze "npm install -g taze"
Scan for updates
扫描更新
taze
taze
Apply minor/patch
应用minor/patch版本更新
taze minor --write
taze minor --write
Apply specific majors
应用指定的大版本更新
taze major --write --include pkg1,pkg2
taze major --write --include pkg1,pkg2
Monorepo support
单仓库支持
taze -r # recursive
taze -r # 递归扫描
Security
安全检查
npm audit
npm audit fix
undefinednpm audit
npm audit fix
undefinedPython
Python
bash
undefinedbash
undefinedCheck outdated
检查过期依赖
pip list --outdated
pip list --outdated
Update all (careful!)
更新所有依赖(谨慎操作!)
pip-review --auto
pip-review --auto
Update specific
更新指定依赖
pip install --upgrade package-name
pip install --upgrade package-name
Security
安全检查
pip-audit
safety check
undefinedpip-audit
safety check
undefinedGo
Go
bash
undefinedbash
undefinedCheck outdated
检查过期依赖
go list -m -u all
go list -m -u all
Update all
更新所有依赖
go get -u ./...
go get -u ./...
Tidy up
整理依赖
go mod tidy
go mod tidy
Security
安全检查
govulncheck ./...
undefinedgovulncheck ./...
undefinedRust
Rust
bash
undefinedbash
undefinedCheck outdated
检查过期依赖
cargo outdated
cargo outdated
Update within semver
在语义化版本范围内更新
cargo update
cargo update
Security
安全检查
cargo audit
undefinedcargo audit
undefinedRuby
Ruby
bash
undefinedbash
undefinedCheck outdated
检查过期依赖
bundle outdated
bundle outdated
Update all
更新所有依赖
bundle update
bundle update
Update specific
更新指定依赖
bundle update --conservative gem-name
bundle update --conservative gem-name
Security
安全检查
bundle audit
undefinedbundle audit
undefinedJava (Maven)
Java (Maven)
bash
undefinedbash
undefinedCheck outdated
检查过期依赖
mvn versions:display-dependency-updates
mvn versions:display-dependency-updates
Update to latest
更新至最新版本
mvn versions:use-latest-releases
mvn versions:use-latest-releases
Security
安全检查
mvn dependency:tree
mvn dependency-check:check
undefinedmvn dependency:tree
mvn dependency-check:check
undefined.NET
.NET
bash
undefinedbash
undefinedCheck outdated
检查过期依赖
dotnet list package --outdated
dotnet list package --outdated
Update specific
更新指定依赖
dotnet add package PackageName
dotnet add package PackageName
Security
安全检查
dotnet list package --vulnerable
---dotnet list package --vulnerable
---Diagnosis Mode
诊断模式
When dependencies are broken, run diagnosis:
当依赖项出现问题时,运行诊断功能:
Common Issues & Fixes
常见问题与修复方案
| Issue | Symptoms | Fix |
|---|---|---|
| Version Conflict | "Cannot resolve dependency tree" | Clean install, use overrides/resolutions |
| Peer Dependency | "Peer dependency not satisfied" | Install required peer version |
| Security Vuln | | |
| Unused Deps | Bloated bundle | Run |
| Duplicate Deps | Multiple versions installed | Run |
| 问题 | 症状 | 修复方案 |
|---|---|---|
| 版本冲突 | "Cannot resolve dependency tree" | 清理后重新安装,使用覆盖/解析配置 |
| 对等依赖缺失 | "Peer dependency not satisfied" | 安装所需的对等依赖版本 |
| 安全漏洞 | | 执行 |
| 未使用的依赖 | 包体积臃肿 | 运行 |
| 重复依赖 | 安装了多个版本 | 执行 |
Emergency Fixes
紧急修复命令
bash
undefinedbash
undefinedNode.js - Nuclear reset
Node.js - 彻底重置
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
Python - Clean virtualenv
Python - 清理虚拟环境
rm -rf venv
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
rm -rf venv
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Go - Reset modules
Go - 重置模块
rm go.sum
go mod tidy
---rm go.sum
go mod tidy
---Security Audit
安全审计
Run security checks for any project:
bash
undefined为任意项目运行安全检查:
bash
undefinedNode.js
Node.js
npm audit
npm audit --json | jq '.metadata.vulnerabilities'
npm audit
npm audit --json | jq '.metadata.vulnerabilities'
Python
Python
pip-audit
safety check
pip-audit
safety check
Go
Go
govulncheck ./...
govulncheck ./...
Rust
Rust
cargo audit
cargo audit
Ruby
Ruby
bundle audit
bundle audit
.NET
.NET
dotnet list package --vulnerable
undefineddotnet list package --vulnerable
undefinedSeverity Response
漏洞严重程度应对策略
| Severity | Action |
|---|---|
| Critical | Fix immediately |
| High | Fix within 24h |
| Moderate | Fix within 1 week |
| Low | Fix in next release |
| 严重程度 | 操作 |
|---|---|
| Critical(严重) | 立即修复 |
| High(高) | 24小时内修复 |
| Moderate(中) | 1周内修复 |
| Low(低) | 在下一版本中修复 |
Anti-Patterns
反模式(需避免)
| Avoid | Why | Instead |
|---|---|---|
| Update fixed versions | Intentionally pinned | Skip them |
| Auto-apply MAJOR | Breaking changes | Prompt user |
| Batch MAJOR prompts | Loses context | Prompt individually |
| Skip lock file | Irreproducible builds | Always commit lock files |
| Ignore security alerts | Vulnerabilities | Address by severity |
| 需避免的操作 | 原因 | 替代方案 |
|---|---|---|
| 更新固定版本 | 这些版本是有意固定的 | 跳过此类版本 |
| 自动应用MAJOR版本更新 | 可能包含破坏性变更 | 询问用户 |
| 批量询问MAJOR版本更新 | 丢失上下文信息 | 逐个询问 |
| 跳过锁文件提交 | 导致构建无法复现 | 始终提交锁文件 |
| 忽略安全警报 | 存在漏洞风险 | 根据严重程度处理 |
Verification Checklist
验证清单
After updates:
- Updates scanned without errors
- MINOR/PATCH auto-applied
- MAJOR updates prompted individually
- Fixed versions untouched
- Lock file updated
- Install command ran
- Security audit passed (or issues noted)
<details> <summary><strong>Deep Dive: Project Detection</strong></summary>
The skill auto-detects project type by scanning for package files:
| File Found | Language | Package Manager |
|---|---|---|
| Node.js | npm/yarn/pnpm |
| Python | pip |
| Python | pip/poetry |
| Python | pipenv |
| Go | go modules |
| Rust | cargo |
| Ruby | bundler |
| Java | Maven |
| Java/Kotlin | Gradle |
| .NET | dotnet |
Detection order matters for monorepos:
- Check current directory first
- Then check for workspace/monorepo patterns
- Offer to run recursively if applicable
更新完成后:
- 更新扫描无错误
- MINOR/PATCH版本已自动应用
- MAJOR版本更新已逐个询问用户
- 固定版本未被修改
- 锁文件已更新
- 已运行安装命令
- 安全审计通过(或已记录问题)
<details> <summary><strong>深度解析:项目检测机制</strong></summary>
该工具通过扫描包文件自动检测项目类型:
| 检测到的文件 | 语言 | 包管理器 |
|---|---|---|
| Node.js | npm/yarn/pnpm |
| Python | pip |
| Python | pip/poetry |
| Python | pipenv |
| Go | go modules |
| Rust | cargo |
| Ruby | bundler |
| Java | Maven |
| Java/Kotlin | Gradle |
| .NET | dotnet |
单仓库检测顺序:
- 首先检查当前目录
- 然后检查工作区/单仓库模式
- 若适用,提供递归扫描选项
Prerequisites
前置条件
bash
undefinedbash
undefinedInstall taze globally (recommended)
全局安装taze(推荐)
npm install -g taze
npm install -g taze
Or use npx
或使用npx
npx taze
undefinednpx taze
undefinedSmart Update Flow
智能更新流程
bash
undefinedbash
undefined1. Scan all updates
1. 扫描所有更新
taze
taze
2. Apply safe updates (minor + patch)
2. 应用安全更新(minor + patch版本)
taze minor --write
taze minor --write
3. For each major, prompt user:
3. 针对每个大版本更新,询问用户:
"Update @types/node from ^20.0.0 to ^22.0.0?"
"Update @types/node from ^20.0.0 to ^22.0.0?"
If yes, add to approved list
若用户同意,添加至批准列表
4. Apply approved majors
4. 应用已批准的大版本更新
taze major --write --include approved-pkg1,approved-pkg2
taze major --write --include approved-pkg1,approved-pkg2
5. Install
5. 安装依赖
npm install # or pnpm install / yarn
undefinednpm install # 或 pnpm install / yarn
undefinedAuto-Approve List
自动批准列表
Some packages have frequent major bumps but are backward-compatible:
| Package | Reason |
|---|---|
| Icon library, majors are additive |
| Type definitions, usually safe |
部分包的大版本更新频繁但保持向后兼容:
| 包 | 原因 |
|---|---|
| 图标库,大版本更新仅添加新内容 |
| 类型定义,通常安全 |
Semantic Versioning
语义化版本控制
MAJOR.MINOR.PATCH (e.g., 2.3.1)
MAJOR: Breaking changes - requires code changes
MINOR: New features - backward compatible
PATCH: Bug fixes - backward compatibleMAJOR.MINOR.PATCH(示例:2.3.1)
MAJOR:破坏性变更 - 需要修改代码
MINOR:新增功能 - 向后兼容
PATCH:修复Bug - 向后兼容Range Specifiers
版本范围指定符
| Specifier | Meaning | Example |
|---|---|---|
| Minor + Patch OK | |
| Patch only | |
| Exact (fixed) | Only |
| At least | Any |
| Any | Latest (dangerous) |
| 指定符 | 含义 | 示例 |
|---|---|---|
| 允许Minor和Patch更新 | |
| 仅允许Patch更新 | |
| 精确版本(固定) | 仅 |
| 至少该版本 | 所有 |
| 任意版本 | 最新版本(危险) |
Recommended Strategy
推荐策略
json
{
"dependencies": {
"critical-lib": "1.2.3", // Exact for critical
"stable-lib": "~1.2.3", // Patch only for stable
"modern-lib": "^1.2.3" // Minor OK for active
}
}json
{
"dependencies": {
"critical-lib": "1.2.3", // 关键库使用精确版本
"stable-lib": "~1.2.3", // 稳定库仅允许Patch更新
"modern-lib": "^1.2.3" // 活跃库允许Minor更新
}
}Node.js Conflicts
Node.js 依赖冲突
Diagnosis:
bash
npm ls package-name # See dependency tree
npm explain package-name # Why installed
yarn why package-name # Yarn equivalentResolution with overrides:
json
// package.json
{
"overrides": {
"lodash": "^4.18.0"
}
}Resolution with resolutions (Yarn):
json
{
"resolutions": {
"lodash": "^4.18.0"
}
}诊断命令:
bash
npm ls package-name // 查看依赖树
npm explain package-name // 查看安装原因
yarn why package-name // Yarn 对应命令使用覆盖配置解决:
json
// package.json
{
"overrides": {
"lodash": "^4.18.0"
}
}使用解析配置解决(Yarn):
json
{
"resolutions": {
"lodash": "^4.18.0"
}
}Python Conflicts
Python 依赖冲突
Diagnosis:
bash
pip check
pipdeptree -p package-nameResolution:
bash
undefined诊断命令:
bash
pip check
pipdeptree -p package-name解决方法:
bash
// 使用虚拟环境
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
// 或使用约束文件
pip install -c constraints.txt -r requirements.txtUse virtual environment
脚本参考
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
| 脚本 | 用途 |
|---|---|
| 验证工具是否已安装 |
| 使用正确参数运行taze |
Or use constraints
相关工具
pip install -c constraints.txt -r requirements.txt
</details>
---| 工具 | 语言 | 用途 |
|---|---|---|
| taze | Node.js | 智能依赖更新工具 |
| npm-check-updates | Node.js | taze的替代工具 |
| pip-review | Python | 交互式pip更新工具 |
| cargo-edit | Rust | Cargo依赖管理工具 |
| bundler-audit | Ruby | 安全审计工具 |
Script Reference
—
| Script | Purpose |
|---|---|
| Verify tool is installed |
| Run taze with proper flags |
—
Related Tools
—
| Tool | Language | Purpose |
|---|---|---|
| taze | Node.js | Smart dependency updates |
| npm-check-updates | Node.js | Alternative to taze |
| pip-review | Python | Interactive pip updates |
| cargo-edit | Rust | Cargo dependency management |
| bundler-audit | Ruby | Security auditing |
—