codebam/hermes-skills/npm-deps-hash-replication
Claude Code and agent skill by codebam/hermes-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when computing npmDepsHash without a Nix build.
Install
npx vskill@latest install codebam/hermes-skills/npm-deps-hash-replicationSKILL.md
The same SKILL.md was published earlier as codebam/hermes-skills/npm-deps-hash-replication.
npm-deps hash replication (no Nix build required)
When to Use
- You need
npmDepsHashfor abuildNpmPackagederivation but cannot run a
real Nix build (no daemon, sandbox store, or no substitute coverage for the pinned nixpkgs rev).
- Packaging a new npm-distributed CLI into a Nix config from a sandbox.
- Bumping a vendored npm package whose lockfile changed.
Replicate what prefetch-npm-deps would produce and hash the tree yourself.
Method
- Produce a clean lockfile: lockfile v2/v3 whose production graph is
registry tarballs only (for a published npm package, vendor the shipped lockfile with devDependencies stripped; a file: or git ref in the prod graph means the approach must change).
- Fetch every tarball to a content-addressed disk cache:
scripts/fetch-lock-tarballs.py package-lock.json cache-dir (resumable; verifies every SRI digest; safe to re-run).
- Assemble the prefetch tree:
scripts/assemble-cacache.py package-lock.json cache-dir outdir
- Hash it:
nix hash path outdir→ that is yournpmDepsHash
(the FOD uses outputHashMode = recursive).
- Always validate against a golden control before pinning. Find any
realized *-npm-deps FOD already in a store, run this pipeline on the same lockfile, and require a byte-for-byte identical tree (diff -r <golden> <replica> must be empty; nix hash path both sides). Only a golden reproduction makes the computed hash trustworthy.
Output format (prefetch-npm-deps 0.1.0, fetcherVersion=1)
- Tree root:
package-lock.json(bytes identical to input) +_cacache/. - Tarball bodies:
_cacache/content-v2/<algo>/<h[0:2]>/<h[2:4]>/<h[4:]>
where h = hex of the lockfile SRI digest.
- Index:
_cacache/index-v5/<sha256(key)[0:2]>/<[2:4]>/<[4:]>; each line is
sha1(json)\tjson with NO trailing newline (prefix "\n" only when appending to a non-empty file); json is the compact serialization of {key,integrity,time:0,size,metadata:{url,options:{compress:true}}}; key = "make-fetch-happen:request-cache:" + url.
- Selection: non-empty
packageskeys only; drop entries whoseresolved
is missing/not URL-shaped or starts with file:; refuse git/ssh; per duplicate URL keep the strongest integrity (sha512 > sha1).
- The derivation's env carries
NPM_FETCHER_VERSION=1— check the generated
FOD drv contains it together with your hash.
Pitfalls
- Dev deps must be stripped from the vendored lockfile: dev nodes often
point at file:/workspace refs that prefetch refuses, and npm ci --ignore-scripts in buildNpmPackage only needs the prod graph.
- A one-shot downloader that buffers bodies in RAM dies on large lockfiles;
use the fetch→cache→assemble two-phase scripts (resumable by design).
- Keep
os/cpufields on platform-specific packages — they are part of
the graph and the fetch set.
- A near-miss in index-line formatting (newline handling, json key order,
separator spacing) shifts the whole tree hash; the golden comparison is what catches it, not eyeballing.
- URL normalization: registry URLs are already canonical; only lowercase
scheme/host and drop default ports if a non-registry URL ever appears.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/software-development/npm-deps-hash-replication/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/codebam/hermes-skills/npm-deps-hash-replication)