npmchangelogcheck
v0.1.0
Published
Detect public API changes in updated npm dependencies and map them to project usage
Downloads
94
Readme
npmchangelogcheck
npmchangelogcheck is a CLI that analyzes npm dependency updates, detects public API differences, and maps those differences to imports used in your project.
It helps answer:
- Which updated packages look breaking for my code?
- Which imports and symbols are affected?
- Do package changelogs/releases explain what changed?
Key Capabilities
- Detect version changes from:
package-lock.jsonold/new pair- git refs (
--base/--head) npm audit fix --dry-run --json(plan --source auditfix)
- Analyze project imports with
ts-morph(fallback: tree-sitter) - Snapshot package APIs using multiple strategies:
- native
.d.ts - generated declarations from JS entrypoints
- AST fallback (tree-sitter/regex)
- native
- Diff APIs and estimate release impact:
major/minor/patch/none/unknown
- Attach changelog context from:
- packaged changelog files
npm diff- GitHub Releases API
- Render reports in
console,json, ormarkdown
Requirements
- Node.js
>= 20.17 - npm (lockfile-based workflow)
package-lock.jsonwithpackagesentries (npm v7+ lockfile)gitif you use--base/--headmode- Internet access for package extraction/changelog providers
Installation
From source:
npm install
npm run buildRun without build:
npm run dev -- --helpRun built CLI:
node dist/cli.js --helpQuick Start
- Prepare two lockfiles (before/after update).
- Run scan and output Markdown report.
npm run dev -- scan \
--from-lock package-lock.old.json \
--to-lock package-lock.json \
--format markdown \
--out npmchangelogcheck-report.mdGit-based diff example (uses package-lock.json from refs):
npm run dev -- scan --base origin/main --head WORKTREECLI Reference
scan
Scans updated dependencies and produces an API-impact report.
npm run dev -- scan [options]Main options:
--from-lock <path>old lockfile path--to-lock <path>new lockfile path--base <git-ref>base git ref containingpackage-lock.json--head <git-ref>head git ref (default:WORKTREE)--project-root <path>project root--cache-dir <path>extraction cache directory--temp-dir <path>temp directory for generated artifacts--package <name...>restrict analysis to specific packages--format <console|json|markdown>output format--out <path>write output to file--no-changelogdisable all changelog providers--no-github-releasesdisable GitHub releases fetch--no-npm-diffdisable npm diff provider--github-token <token>GitHub token (or useGITHUB_TOKEN)
Notes:
scanrequires either:--from-lockand--to-lock, or--baseand--head
- Analysis is resilient: if one package fails, scanning continues and records errors.
plan
Shows planned dependency updates without full API diffing.
npm run dev -- plan --source lockdiff --from-lock package-lock.old.json --to-lock package-lock.json
npm run dev -- plan --source auditfixOptions:
--source <lockdiff|auditfix>update source (lockdiffdefault)--from-lock,--to-lock,--base,--head,--project-root--format <console|json|markdown>
explain
Wrapper around npm explain to inspect why a package is installed.
npm run dev -- explain lodash
npm run dev -- explain lodash --jsonHow It Works
- Build package update list from lockfile diff or git refs.
- Scan your source files to collect imported package specifiers/symbols.
- Extract old/new package versions via
pacote. - Snapshot public surface per used specifier (
.d.ts-> generated d.ts -> AST fallback). - Compare snapshots and estimate impact (
major/minor/patch/none/unknown). - Annotate with changelog/release notes and usage callsites.
Output
scan summary includes:
packagesChangedbreakingPackages(estimated)breakingChangesaffecting imports found in your code
releaseType is an estimate based on detected API changes, not a guarantee of runtime behavior.
Limitations
- Static analysis only; runtime behavior changes are out of scope.
- Dynamic imports/reflection patterns may be missed.
- Accuracy is best when packages provide high-quality
.d.ts. - Currently built around npm lockfile workflows (
package-lock.json).
Development
npm install
npm run lint
npm test
npm run buildContributing
Issues and pull requests are welcome.
- Bug reports: include lockfile inputs, command used, and output format.
- Feature requests: describe expected workflow and constraints.
License
AGPL-3.0-only (see LICENSE).
