npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

abd-env-guard

v2.0.0

Published

Advanced CLI tool to protect .env files with Git history tracking, strict mode, JSON output, auto-backup, and support for multiple ignore files

Readme

🛡️ abd-env-guard v2.0

An advanced CLI tool to protect .env files and sensitive data with Git history tracking, strict mode for CI/CD, JSON output, auto-backup, and support for multiple ignore file types.

🚨 NEW in v2.0: Git history scanning, strict mode, JSON output, auto-backup, custom patterns, and much more!


📦 Installation

npm install -g abd-env-guard

Or use with npx (no install):

npx abd-env-guard

🚀 Usage

abd-env-guard [options]

🔧 Available Options

| Flag | Description | |------------------|--------------------------------------------------------------------------| | --fix | Automatically adds missing ignore patterns | | --interactive | Prompts user before creating or editing ignore file | | --verbose | Shows detailed logging output | | --file <name> | Use a custom ignore file (e.g. .dockerignore, .npmignore) | | --recursive | Recursively scans folders (e.g. for monorepos) | | --strict | NEW! Exit with code 1 if issues found (perfect for CI/CD) | | --json | NEW! Output results in JSON format for automation | | --ci | NEW! Alias for --strict --json | | --ignore | NEW! Add custom ignore patterns via command line | | --help | Displays help information |


🆕 New in v2.0 - Advanced Features

🚨 Feature 1: Git History Scanning

Detects if .env files were ever committed to Git history (even if now in .gitignore):

abd-env-guard
# Output: 🚨 These files were found in Git history:
#   - .env (first added: 12/25/2023, commit: a1b2c3d4)
#     └─ "Initial project setup"

⚙️ Feature 2: Strict Mode for CI/CD

Fail builds if sensitive files are detected:

abd-env-guard --strict
# Exit code 1 if issues found, 0 if all good

📦 Feature 3: Postinstall Hook

Add to package.json to protect new team members:

{
  "scripts": {
    "postinstall": "abd-env-guard --strict"
  }
}

🎨 Feature 4: Color-coded Output

Beautiful, readable terminal output with colors (optional dependency).

🤖 Feature 5: CI-friendly JSON Output

Perfect for DevOps pipelines:

abd-env-guard --json
# {
#   "status": "failed",
#   "missing": [".env"],
#   "gitIssues": {
#     "tracked": [],
#     "inHistory": [".env"]
#   }
# }

🔧 Feature 6: Custom Ignore Patterns

Add patterns via command line:

abd-env-guard --ignore ".env.secret" "config/*.key" "private/**"

💾 Feature 7: Auto-backup

Automatically creates .gitignore.bak before modifications.

🔍 Feature 8: Git History Details

Shows when and how sensitive files were first committed:

abd-env-guard --verbose
# Shows commit hash, date, and message for each file

🌐 Feature 9: Glob Pattern Support

Powerful pattern matching for complex file structures.

📁 Feature 10: Multiple Ignore File Support

Works with various ignore files:

abd-env-guard --file .dockerignore   # Docker builds
abd-env-guard --file .npmignore      # NPM publishing
abd-env-guard --file .eslintignore   # ESLint
abd-env-guard --file .prettierignore # Prettier

💡 Examples

✅ Check .gitignore in the current folder:

abd-env-guard

🛠️ Auto-fix missing ignore entries:

abd-env-guard --fix

👨‍💻 Interactive prompt for action:

abd-env-guard --interactive

📁 Use a custom ignore file:

abd-env-guard --file .dockerignore

🧭 Scan all folders recursively (monorepo mode):

abd-env-guard --recursive

🔐 What It Checks

By default, the tool checks for these common patterns:

  • .env
  • .env.local
  • .env.*.local

⚙️ Optional Configuration

You can create a .abd-env-guardrc JSON config file to define custom ignore patterns:

{
  "ignore": [".env", "config/secrets.env", "private/**"]
}

This allows you to customize the files to detect and suggest ignoring.


🔍 Git Awareness

  • Warns if sensitive files are already tracked by Git
  • Skips git check if run outside a Git repository

👨‍💻 Author

Abdullah Firdowsi
GitHub


📄 License

MIT