@roland.botka/dep-guard
v1.0.0
Published
Guardrail for safe npm dependency updates
Maintainers
Readme
dep-guard
Guardrail CLI for safer npm dependency management.
dep-guard provides secure workflows for installing, updating, and adding npm dependencies with built-in security checks and time-based safety buffers.
dep-guard is intentionally opinionated: it favors security and explicit decisions over speed and convenience.
This is the first stable (1.0.0) release. Commands and flags are considered stable across 1.x versions.
Quick Start
npm install -g @roland.botka/dep-guard
dep-guard update --dry-runKey Features
🔒 Security-First
- Integration with scfw (Supply Chain Firewall)
- NPQ security checks for every package
- Time-based safety buffer (default: 7 days)
- All installs run with
--ignore-scriptsby default
🎯 Interactive & User-Friendly
- Interactive package selection (checkboxes)
- Clear confirmation prompts at every step
- Dry-run mode to preview updates safely
- Helpful, actionable error messages
✅ Quality Gates (Optional)
- Lint, typecheck, test, and build verification
- Configurable script names
- Graceful skips for missing scripts
📦 Exact Version Management
- All installs use
--save-exact(no^or~) - Reproducible dependency trees
- Only versions older than the safety buffer are allowed
Commands
dep-guard install
Fresh install of all dependencies from package.json:
- Uses
scfw run npm install --ignore-scripts --before <date> - Falls back to
npm installwith the same flags when--allow-npm-installis used - Applies the safety buffer (default: 7 days)
- Regenerates
package-lock.json
dep-guard update
Safe dependency updates with multiple guardrails.
Workflow:
- Check for updates via npm-check-updates
- Apply safety buffer (exclude versions < 7 days old)
- Group updates by Major / Minor / Patch
- Interactive selection
- NPQ security validation
- Secure installation via scfw
- Clean reinstall (
npm ci --ignore-scripts) - Optional quality checks
- Optional build verification
Highlights:
- Interactive update selection
- Per-package NPQ validation
--dry-runmode (no install, no scfw required)- User can cancel at any point (Ctrl+C)
dep-guard add <package>
Add a new dependency with security validation:
- Resolves user-specified or latest safe version
- Applies safety buffer (default: 7 days)
- Detects existing dependencies (update / keep / cancel)
- NPQ security validation before install
- Installs with
--save-exact - Supports dev dependencies via
-D - One package per invocation
Requirements
- Node.js >= 24
- npm
- scfw (Supply Chain Firewall) — strongly recommended
- Install via
pipx install scfw(recommended) orpip install scfw - https://github.com/DataDog/supply-chain-firewall
- If scfw is not available, use
--allow-npm-installto fall back to npm
- Install via
Security Model
scfw (Supply Chain Firewall)
When available, dep-guard always prefers scfw to:
- Block known vulnerable packages
- Detect suspicious behavior
- Enforce security policies during install
NPQ (Node Package Query)
NPQ checks run before every install:
- Supply-chain risk signals
- Package health & maintenance status
- Provenance verification
Users must explicitly approve risky packages.
Why a Safety Buffer?
Waiting N days (default: 7) protects against:
- Typosquatting attacks
- Compromised maintainer accounts
- Rushed or broken releases
- Early-stage supply-chain attacks
Usage
dep-guard <command> [options]Commands
install– Fresh install from package.jsonupdate– Safe dependency updatesadd <package>– Securely add a dependency
Options
-d, --days <n>– Safety buffer in days (default: 7)--allow-npm-install– Allow npm fallback--dry-run– Preview updates without installing (update only)-D, --save-dev– Add as dev dependency (add only)--lint <script>– Lint script (update only)--typecheck <script>– Typecheck script (update only)--test <script>– Test script (update only)--build <script>– Build script (update only)-v, --version-h, --help
Install / Run
npm install -g @roland.botka/dep-guard
dep-guard install
dep-guard update
dep-guard add vueOr without installing:
npx @roland.botka/dep-guard update --dry-runDevelopment
npm run typecheck
npm test
npm run test:coverageNotes
- Quality checks are optional and skipped if scripts are missing
- All installs intentionally use
--ignore-scriptsby default
License
MIT (see LICENSE)
