Diff two package.json/lockfile snapshots
diff_dependenciesCompares two raw snapshots of a package.json, package-lock.json (npm v1-v3), yarn.lock (classic v1 or Berry), or pnpm-lock.yaml — e.g. before/after a PR — and reports which packages were added, removed, or version-bumped. For every added or bumped package (up to 100 per call), also checks whether its resolved version carries a preinstall/install/postinstall/prepare lifecycle script that the before-version did NOT have (installScriptIntroduced, the highest-signal field here — a routine-looking patch bump quietly adding a postinstall is exactly the shape of a compromised-maintainer supply-chain attack) and batch-checks it against OSV.dev, reporting vulnerabilityDelta (introduced/fixed/still-vulnerable/still-clean) rather than just a bare isVulnerable flag. Scope notes: only direct dependencies are diffed for package.json/package-lock.json/pnpm-lock.yaml (their own formats distinguish direct from transitive); yarn.lock has no such distinction, so its side of the diff covers every resolved package in the file — expect a larger added/removed count when diffing a yarn.lock, and check comparisonNote when the two snapshots are different formats. The install-script check is presence-only (read from the registry packument or lockfile metadata, not a tarball content scan) — use analyze_install_script for a deep-dive on anything flagged here. Ideal for a CI gate reviewing a dependency-changing PR.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | Yes | Raw file content of the "after" snapshot — a package.json, package-lock.json (npm v1-v3), yarn.lock (classic v1 or Berry), or pnpm-lock.yaml. Format is auto-detected; before/after may be different formats. | |
| before | Yes | Raw file content of the "before" snapshot — a package.json, package-lock.json (npm v1-v3), yarn.lock (classic v1 or Berry), or pnpm-lock.yaml. Format is auto-detected; before/after may be different formats. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| added | Yes | ||
| changed | Yes | ||
| removed | Yes | ||
| summary | Yes | ||
| truncated | Yes | ||
| totalAdded | Yes | ||
| afterFormat | Yes | ||
| beforeFormat | Yes | ||
| flaggedCount | Yes | ||
| totalChanged | Yes | ||
| totalRemoved | Yes | ||
| comparisonNote | Yes | ||
| enrichmentNote | Yes | ||
| truncationNote | Yes |