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 🙏

© 2025 – Pkg Stats / Ryan Hefner

git-validator-cli

v0.25.0

Published

A simple CLI tool to validate **commits** and **branches** following:

Readme

🚀 git-validator

A simple CLI tool to validate commits and branches following:

It automatically installs a pre-push Git hook that blocks invalid pushes.
Supports custom configuration, detailed error reports, and auto-suggestions for corrections.


📦 Installation

Clone the repository and install dependencies:

git clone https://github.com/danieltinois/git-validator.git
cd git-validator
npm install
npm run build

⚡ Usage

1. Install the hook in your repository

Inside the repository you want to protect, run:

npx git-validator init

This will automatically create the .husky/pre-push (if Husky is detected) or .git/hooks/pre-push hook.


2. Run validations manually

You can also validate manually:

# Validate a commit message
npx git-validator commit "feat: add login"

# Validate a branch name
npx git-validator branch "feature/new-feature"

✅ Examples

Valid commits

  • feat: add login
  • fix(auth): correct password hashing
  • chore: update dependencies
  • refactor(api): improve performance
  • docs: update README

Invalid commits (with auto-suggestions)

  • fiz: corrigir bug no login
    → 💡 Example: fix: corrigir bug no login

  • WIP: implementando tela de login
    → 💡 Example: feat: implementando tela de login

  • corrigir bug no login
    → 💡 Example: feat: corrigir bug no login

  • feat: add a very very very very very very very very very very very long message
    → 💡 Example: feat: add a very very very very very very very very very long...


Valid branches

  • feature/new-feature
  • hotfix/fix-bug
  • release/v1.0.0
  • bugfix/minor-adjustment
  • support/legacy
  • feature/correção-login ✅ (supports accents)

Invalid branches (with auto-suggestions)

  • featuree/login
    → 💡 Example: feature/login

  • bug/login
    → 💡 Example: bugfix/login

  • login
    → 💡 Example: feature/login

  • feature/teste com espaço
    → 💡 Example: feature/teste-com-espaço


⚙️ Configuration

You can customize rules with a .gitvalidatorrc.json file in your project:

{
  "commitTypes": ["feat", "fix", "chore", "docs", "refactor"],
  "branchPrefixes": ["feature", "hotfix", "release", "bugfix"],
  "maxCommitLength": 120
}

🔧 Development

Run in dev mode (without build):

npm run dev branch "feature/test"

Build:

npm run build

Run tests:

npm run test

🌍 Using in other projects

There are two ways to use it in other repositories:

1. Via npx (without global install)

Inside the project you want to protect:

npx git-validator init

This installs the pre-push hook and you’re ready to go 🚀


2. Global installation

If you want to use it in any project without installing locally:

npm install -g git-validator

Now in any repository:

git-validator init

🧪 Tests

We use Jest for automated tests.
Examples covered:

  • Commit autocorrections (fizfix, fetfeat, etc.)
  • Blocking WIP/fixup/squash commits
  • Branch autocorrections (featuree/feature/, bug/bugfix/)
  • Unicode support (commits and branches with accents)

Run tests:

yarn jest

📌 Roadmap

  • [x] Allow configuration via .gitvalidatorrc
  • [x] Advanced commit validation (body, footer, BREAKING CHANGE, WIP, etc.)
  • [x] Friendly error reports with auto-suggestions
  • [x] Branch autocorrection with Unicode support
  • [x] Jest automated tests
  • [ ] Publish to npm
  • [ ] Provide a GitHub Action for CI/CD validation
  • [ ] GitLab CI support
  • [ ] "fix" mode to auto-correct commits
  • [ ] Strict mode (block WIP, fixup, squash, pushes to main)