Dependency change guard
A deterministic Claude Code PreToolUse gate for Bash, Write, and Edit that prevents direct lockfile editing, rejects narrow package-manager safety bypass flags, and verifies at commit time that changed dependency manifests have a staged associated lockfile when one exists.
Runs on
What it does
Keep dependency changes reproducible and block explicit package-manager safety bypasses.
When it fires
- implementation
- pre-commit
- maintenance
How it behaves
Inspect bounded Git state and deterministically enforce reproducible dependency-change boundaries.
It does not install, remove, upgrade, resolve, audit, or choose a dependency for the user.
It does not claim that a matching manifest and lockfile diff proves dependency safety or build correctness.
It does not expose a project-writable policy, silently rewrite a lockfile, or approve a bypassing command.
Configuration
targets/claude-code/dependency-change-guard.mjs
- Version
- 1.0.0
- Requires
- Shell command guard
- Licence
- RiskThis automatic gate keeps dependency changes reproducible and block explicit package-manager safety bypasses; a false denial can interrupt legitimate work, but it does not execute the blocked action.
- Medium
- ModeHow it works: fixed rules, model instructions, or both.
- Deterministic only
- Behaviour
- Enforces, blocks on violation
- On failure
- Denies and blocks
- LatencyTo keep dependency changes reproducible and block explicit package-manager safety bypasses, the entrypoint may run a bounded local subprocess before returning.
- Bounded
- Data retentionWhether data remains after use and who manages its storage.
- Not retained
Often used with
All in Security