Skip to main content

See which dependencies a lockfile change adds, removes, or bumps — review the supply-chain surface of a PR. Zero dependencies, no account.

Project description

locksift

See what a lockfile change actually did to your dependencies. A PR touches package-lock.json and the diff is 4,000 unreadable lines — you can't tell which packages were added (the supply-chain surface you actually need to eyeball), which got a major bump, which were quietly downgraded. locksift turns that noise into a short, reviewable changelog. Zero dependencies, no account, no network.

pip install locksift

# What did my uncommitted changes do to the tree?
locksift package-lock.json --git

Added (2)   new in tree, review these
  + ansi-styles@6.2.1
  + picocolors@1.0.1

Removed (1)
  - request@2.88.2

Changed (2)
   chalk  4.1.2  5.3.0 [major]
   semver  7.5.4  7.3.8 [downgrade]

+2  -1  ~2   (1 major, 1 downgrade)

This is the Python build. A byte-for-byte-equivalent Node build is on npm: npx locksift (https://github.com/jjdoor/locksift).

Why

The big supply-chain incidents all enter the same way: a new (often transitive) package lands in your lockfile and nobody looks, because the lockfile diff is unreadable by design. git shows you thousands of churned hash/resolved lines; what you want is the dependency-level answer — what's new, what's gone, what jumped a major. locksift computes exactly that from the lockfile itself. It runs locally, talks to nothing, and needs no registry token.

Usage

# Diff two lockfiles
locksift old/package-lock.json new/package-lock.json

# Diff your working tree against a git ref (default HEAD) — the PR-review case
locksift package-lock.json --git
locksift package-lock.json --git main

# Just the new packages, one per line — pipe into review tooling
locksift package-lock.json --git --added-only

# Machine-readable
locksift a.json b.json --json

# CI gate: fail the job if the lockfile changed at all
locksift package-lock.json --git --exit-code

Options

Flag Effect
--git [ref] Compare the working-tree lockfile against ref (default HEAD)
--json Emit { added, removed, changed, summary } as JSON
--added-only Print only newly added packages as name@version, one per line
--exit-code Exit 1 when there are any changes (for CI gates)
-v, --version Print version
-h, --help Show help

Supported lockfiles

File Notes
package-lock.json lockfileVersion 1, 2, and 3. v2/v3 read the authoritative packages map; v1 walks the nested dependencies tree; workspace source dirs are skipped. When a package resolves to several versions in one tree, the diff compares a single representative (the last seen in traversal).
Pipfile.lock pipenv — both default and develop sections. Entries without a pinned version (git/VCS/editable/local-path installs) are not surfaced.

Both are plain JSON, which is what keeps locksift dependency-free.

Bump classification

A changed package is tagged by comparing the numeric major.minor.patch core (range prefixes like ^, ~, v and prerelease/build suffixes are tolerated):

  • [major] / [minor] / [patch] — the first component that moved up
  • [downgrade] — the new version is lower than the old (worth a second look)
  • [other] — same numeric core, different string (e.g. prerelease tag changed)

--json carries the same bump value per changed entry, plus a summary with majors and downgrades counts.

Exit codes

Code Meaning
0 success (default — even when changes are found)
1 changes found and --exit-code was passed
2 error (bad args, unreadable/invalid lockfile, git failure)

By default locksift is a viewer and exits 0; add --exit-code to make it a gate (the git diff --exit-code convention).

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

locksift-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

locksift-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file locksift-0.1.0.tar.gz.

File metadata

  • Download URL: locksift-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for locksift-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d90013edf82ddd23433c8feeede0074d5994f8c88d3fcea2d6040a207133de2
MD5 7d8180d29ef2b8f18dfd35e22b86e04a
BLAKE2b-256 ebdabd9f157d50944196197dd779931114be7311bf60d76cccb307da9cc5d9b2

See more details on using hashes here.

File details

Details for the file locksift-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: locksift-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for locksift-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b8819c34cb1a72f5a8fed7e1287e12de8402568095213e956c2d418927a758b
MD5 ab1d24b80c1308c37bb282928c5e1e1a
BLAKE2b-256 0f0958146b4f5f40748a8f899082557563ef7282e83964e6426931d1a8c96fae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page