Production-grade CLI tool, Git Pre-Commit Security Shield, and Secret Leak Prevention engine for Node.js, React, and Full-Stack codebases.
Prevent catastrophic API key leaks, auto-harden .gitignore, extract secrets to .env, and block unsafe Git commits before code leaves your local machine!
Automated Refactoring: Extracts string secrets from code and replaces them with process.env.KEY or import.meta.env.VITE_KEY while creating .env and .env.example.
Git Pre-Commit Shield: Blocks git commit if .env is staged or hardcoded secrets are present in staged diffs.
🚀 Quick Start & Installation
Install globally or run on any project with npx:
# Run secret scan on current project
npx api-guard-sec scan
# Auto-harden .gitignore, extract secrets to .env, and install Git Pre-Commit Shield
npx api-guard-sec fix
# Install Git pre-commit hook only
npx api-guard-sec install-hook
🛠️ CLI Commands
Command
Description
npx api-guard-sec scan
Scans all project files for 50+ secret regex patterns and high entropy strings.
npx api-guard-sec scan --staged
Scans only Git staged changes (used by pre-commit hook).