更新部门
- 作者仓库星标 95
- 许可证 MIT
- 作者仓库 mui-file-input
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 94 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @viclafouch · MIT
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 运行环境要求
- Node.js · Bun
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
步骤 1 — 解析和分类
根据上面预加载的数据,构建每个过时软件包的列表,其中包含:软件包名称当前版本→所需版本(在 semver 范围内)→最新版本范围内:如果`wanted > current`(可更新而不更改`package.json`),则为yes,如果需要范围碰撞`dependency`或`devDependency`(使用DEV_DEPS列表),则为否
第 2 步 — 研究 + 影响分析(单程、并行代理)
启动并行代理调用。每个代理都会一次性研究变更日志并检查代码库影响。分组策略(目标:总共最多 10-12 个代理):每个包有一个代理,用于重大更新,预计会发生重大变化 按生态系统分组进行次要更新:所有 `@tanstack/*` 一起,所有 `@radix-ui/*` 一起,所有 `@sentry/*` 一起,所有 `eslint` 一起,等等。每组一个代理。
第 3 步 — 创建计划文件
所有代理完成后,写入`plan-update-deps-DATE.md`(一次写入,使用预加载数据中的今天日期)。将其放置在项目使用的任何计划目录中(检查`.claude/plans/`、`docs/`或项目根目录 - 更喜欢现有目录;如果不存在,则创建 `.claude/plans/` 作为默认目录)。结构:
# Dependency Update Audit
## Pre-loaded data
!`PM="npm"; if [ -f bun.lockb ] || [ -f bun.lock ]; then PM="bun"; elif [ -f pnpm-lock.yaml ]; then PM="pnpm"; elif [ -f yarn.lock ]; then PM="yarn"; fi; echo "=== PACKAGE_MANAGER ==="; echo "$PM"; echo "=== DATE ==="; date +%Y-%m-%d; echo "=== OUTDATED ==="; if [ "$PM" = "pnpm" ]; then pnpm outdated --json 2>/dev/null || true; elif [ "$PM" = "bun" ]; then bun outdated 2>/dev/null || true; elif [ "$PM" = "yarn" ]; then yarn outdated --json 2>/dev/null || true; else npm outdated --json 2>/dev/null || true; fi; echo "=== AUDIT ==="; if [ "$PM" = "pnpm" ]; then pnpm audit --json 2>/dev/null || true; elif [ "$PM" = "npm" ]; then npm audit --json 2>/dev/null || true; elif [ "$PM" = "yarn" ]; then yarn audit --json 2>/dev/null || true; fi; echo "=== OVERRIDES ==="; node -e "const p=require('./package.json'); console.log(JSON.stringify({overrides:p.overrides,pnpmOverrides:p.pnpm?.overrides,resolutions:p.resolutions}||{}))" 2>/dev/null || echo "{}"; echo "=== DEV_DEPS ==="; node -e "console.log(JSON.stringify(Object.keys(require('./package.json').devDependencies||{})))" 2>/dev/null || echo "[]"; echo "=== PINNED ==="; node -e "const p=require('./package.json'); const all={...p.dependencies,...p.devDependencies}; const pinned=Object.entries(all).filter(([,v])=>!v.startsWith('^')&&!v.startsWith('~')&&!v.startsWith('>')).map(([k,v])=>k+': '+v); console.log(JSON.stringify(pinned))" 2>/dev/null || echo "[]"; echo "=== ENGINES ==="; node -e "const p=require('./package.json'); console.log(JSON.stringify({node:p.engines?.node,typescript:p.devDependencies?.typescript,packageManager:p.packageManager}))" 2>/dev/null || echo "{}"; echo "=== NODE_VERSION ==="; node --version 2>/dev/null || echo "unknown"`
## Arguments
If arguments were passed (e.g., `/update-deps react`, `/update-deps major`):
- If the argument is `major`, `minor`, or `patch` — filter to only that update type
- Otherwise, treat it as a package name filter — only audit packages whose name contains the argument
- If no arguments, audit all outdated packages
Arguments: $ARGUMENTS
## Step 1 — Parse and categorize
From the pre-loaded data above, build a list of every outdated package with:
- Package name
- Current version → Wanted version (within semver range) → Latest version
- **In-range**: yes if `wanted > current` (updatable without changing `package.json`), no if requires range bump
- `dependency` or `devDependency` (use DEV_DEPS list)
- Update type: **major**, **minor**, or **patch** (compare current → latest)
- **Deprecated**: check `isDeprecated` field in pnpm JSON output. Flag prominently.
- **Pinned**: check PINNED list. Note if the package has no `^`/`~` prefix (intentionally locked).
- **Has override**: check OVERRIDES data. Flag if the package appears in overrides/resolutions.
- **Security advisory**: cross-reference with AUDIT data. Flag packages with known CVEs.
- **Engine constraints**: note the project's Node.js version (from ENGINES + NODE_VERSION) and TypeScript version. Agents must check if new package versions require a newer Node.js or TypeScript.
Apply argument filters if provided. If no packages are outdated (after filtering), inform the user and stop.
**Note on bun**: `bun outdated` outputs a human-readable table, not JSON. Parse accordingly.
**Note on Yarn Berry**: Yarn v2+ may not support `yarn outdated`. If the command failed, run `yarn npm info <pkg>` per package or fall back to `npm outdated --json`.
**Scale guard**: If there are more than 40 outdated packages after filtering, inform the user of the count and suggest narrowing scope (e.g., `/update-deps major` or `/update-deps react`). Proceed only with user confirmation, or automatically limit to major + minor updates only (skip patches).
## Step 2 — Research + impact analysis (single pass, parallel agents)
Launch **parallel Agent calls**. Each agent researches the changelog AND checks codebase impact in one pass.
**Grouping strategy** (target: max 10-12 agents total):
- **One agent per package** for major updates with breaking changes expected
- **Group by ecosystem** for minor updates: all `@tanstack/*` together, all `@radix-ui/*` together, all `@sentry/*` together, all `eslint`-related together, etc. One agent per group.
- **One single agent** for all `@types/*` packages (these are routine, lightweight treatment)
- **One single agent** for all patch-only updates (lightweight: just check for security fixes and notable bugs)
### Agent prompt template
Each agent MUST receive and follow these instructions:
**Part A — Research** (for each package assigned):
Find changelog info by trying these sources **in order** — stop as soon as you get meaningful results:
1. **npm registry metadata**: run `npm view [package-name] repository.url homepage` via Bash to get the repo URL and homepage
2. **GitHub Releases page**: if repo is on GitHub, `WebFetch` on `https://github.com/[org]/[repo]/releases` — this is where most projects document breaking changes and migration guides
3. **CHANGELOG.md in repo**: `WebFetch` on `https://raw.githubusercontent.com/[org]/[repo]/main/CHANGELOG.md` (try `master` branch too if `main` 404s). Many libraries (Radix, Prisma, TanStack, etc.) maintain a `CHANGELOG.md` instead of or alongside GitHub Releases. **Important**: CHANGELOGs can be very large — only extract entries between the current and latest version, skip everything older
4. **Migration guide**: for major updates, `WebFetch` on `https://github.com/[org]/[repo]/blob/main/MIGRATION.md` or `UPGRADING.md` — some libraries ship dedicated migration docs
5. **context7 MCP**: for **major updates only**, use `resolve-library-id` then `query-docs` to get up-to-date docs. Skip for minor/patch.
6. **WebSearch** as fallback: search `"[package-name] v[latest] changelog"`, `"[package-name] v[latest] breaking changes"`, `"[package-name] v[latest] migration guide"`
If none of these sources yield meaningful info, say so honestly — do not fabricate.
**Part B — Codebase impact** (for each package assigned):
1. `Grep` for imports: `from ['"][package-name]` and `require\(['"][package-name]`
2. Count files and list key usage locations
3. For each breaking change found: check if the deprecated/removed API is used in the codebase
4. For each notable new feature: note if it could replace existing patterns
5. For each deprecation: search for the deprecated API name in `src/`
6. Check peer dependency compatibility with current `package.json`
**Return format** (already in final plan markdown — no reformatting needed):
```markdown
### [package-name] (`current` → `latest`) — dependency/devDependency
**Update type**: major/minor/patch | **In-range**: yes/no | **Pinned**: yes/no
#### Changes
- **Bug fixes**: [version]: [concrete description of what was fixed]
- **New features**: [version]: [what the feature does, not just its name]
- **Breaking changes**: [description + migration steps]
- **Deprecations**: [what was deprecated + replacement]
- **Security**: [CVE if any, severity]
- **Peer deps**: [new or changed requirements]
- **License**: [only if changed between versions — e.g., MIT → GPL. Skip if unchanged]
- **Engine requirements**: [if minimum Node.js or TypeScript version changed, compare with project's versions from ENGINES data]
- **Notable**: [perf improvements, bundle size changes, other]
#### Impact on project
- **Files using this package**: X files (`src/...`, ...)
- **Bug fixes relevant to us**: yes/no — [details]
- **New features we could use**: yes/no — [details]
- **Deprecations affecting us**: yes/no — [files using deprecated API]
- **Breaking changes requiring migration**: yes/no — [files to modify]
- **Peer dependency conflicts**: yes/no — [details]
- **Override conflicts**: yes/no — [if package is in overrides, note whether override still needed]
#### Recommendation
🟢 Update now / 🟡 Update with migration / 🔴 Blocked (reason) / ⚪ Skip (reason)
#### Migration steps (if 🟡 or 🔴)
1. ...
```
For **patch-only packages** and **`@types/*`**, use a lighter format:
```markdown
| Package | Current | Latest | In-range | Security | Notable |
|---------|---------|--------|----------|----------|---------|
| name | x.y.z | x.y.w | yes/no | none/CVE | brief |
```
## Step 3 — Create the plan file
After ALL agents complete, write `plan-update-deps-DATE.md` (one single write, using today's date from pre-loaded data). Place it in whichever plan directory the project uses (check for `.claude/plans/`, `docs/`, or project root — prefer an existing directory; create `.claude/plans/` as default if none exists).
Structure:
```markdown
# Dependency Update Audit — [DATE]
## Summary
- **Package manager**: [detected PM]
- **X** packages outdated (Y major, Z minor, W patch)
- **Dependencies**: [count] | **Dev dependencies**: [count]
- **Security advisories**: [count] packages with known CVEs
- **Deprecated packages**: [count]
---
## Major updates
[Agent output for each major package, using the template above]
---
## Minor updates
[Agent output for each minor package/group, using the template above]
---
## Patch updates
[Lightweight table from agent output]
---
## Action plan
### 🟢 Safe to update now
- [package]: [one-line reason]
### 🟡 Update with migration needed
- [package]: [what needs to change]
### 🔴 Blocked
- [package]: [blocking reason — peer deps, breaking change too invasive, etc.]
### ⚪ Skip (no benefit / too risky)
- [package]: [reason]
```
## Rules
- **This is an audit only.** NEVER run install, update, add, or any command that modifies `package.json`, lockfiles, or source code. No `npm install`, `pnpm update`, `yarn add`, `bun add`, etc.
- If changelog/release info is unavailable, say so honestly — do not fabricate
- For packages with dozens of patch releases, focus on the most impactful changes (security, major bugs), not every single patch
- The plan file is temporary — the user will delete it after applying updates manually
- Linting is NOT needed (no code changes)
- Do NOT update any existing plan files — this audit is standalone
- Use the detected package manager consistently — never switch to a different one
章节与文件索引
按说明文件中的顺序排列。
预加载数据
论点
步骤 1 — 解析和分类
第 2 步 — 研究 + 影响分析(单程、并行代理)
代理提示模板
文件/命令 -> /update-deps react · /update-deps major · major · minor · patch · wanted > current · package.json · dependency
内容校验值 -> d21a0daabd39
当前原文的自动摘译,尚未人工审校。
预加载数据
!`PM="npm";如果[-fbun.lockb]|| [ -f 包子.lock ];然后PM =“面包”; elif [ -f pnpm-lock.yaml ];然后PM=“pnpm”; elif [ -f 纱线.lock ];然后 PM="纱线";菲;回声“ === PACKAGE_MANAGER = = =”;回显“$PM”;回声“===日期===”;日期+%Y-%m-%d;回声“===已过时===”;如果[“$PM”=“pnpm”];然后 pnpm outdated --json 2>/dev/null ||真的; elif [“$PM”=“小圆面包”];那么包过时了 2>/dev/null ||真的; elif [“$PM”=“纱线”];然后yarn outdated --json 2>/dev/null ||真的;否则 npm 过时 --json 2>/dev/null ||真的;菲; echo "=== 审核 ===";如果[“$PM”=“pnpm”];然后 pnpm Audit --json 2>/dev/null ||真的; elif [“$PM”=“npm”];然后 npm Audit --json 2>/dev/null ||真的; elif [“$PM”=“纱线”];然后纱线审计--json 2>/dev/null ||真的;菲; echo "=== 覆盖 ===";节点 -e "const p=require('./package.json'); console.log(JSON.stringify({overrides:p.overrides,pnpmOverrides:p.pnpm?.overrides,reso
论点
如果传递了参数(例如,
/update-deps react、/update-deps major): 如果参数是major、minor或patch— 仅过滤该更新类型 否则,将其视为包名称过滤器 — 仅审核名称包含该参数的包 如果没有参数,则审核所有过时的包 参数: $ARGUMENTS步骤 1 — 解析和分类
根据上面预加载的数据,构建每个过时软件包的列表:软件包名称当前版本 → 所需版本(在 semver 范围内)→ 最新版本 范围内:如果
wanted > current则为 yes(可更新而不更改package.json),如果需要范围提升dependency或devDependency,则为 no(使用 DEV_DEPS 列表)代理提示模板
每个代理必须接收并遵循以下说明: A 部分 — 研究(针对分配的每个包):通过按顺序尝试这些源来查找变更日志信息 — 一旦获得有意义的结果就停止: npm 注册表元数据:通过 Bash 运行
npm view [package-name] repository.url homepage以获取存储库 URL 和主页 GitHub 发布页面:如果存储库位于 GitHub 上,则在https://github.com/[org]/[repo]/releases上使用WebFetch— 这是大多数项目记录重大更改和迁移的地方指南