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

@sehaj23/commit-craft

v1.0.1

Published

A Git hook utility for formatting commit messages with conventional commit types

Readme

CommitCraft

A Git hook utility for formatting commit messages with conventional commit types. This tool helps you maintain consistent commit message formatting by prompting you to select a commit type and automatically prefixing your commit messages.

Features

  • 🎯 Interactive commit type selection
  • ✨ Beautiful emoji-enhanced commit types
  • 🚀 Conventional Commits standard compliance
  • 🔄 Automatic merge commit detection and skipping
  • 🚪 Easy commit abortion option
  • 🐕 Husky integration support
  • 🔧 Automatic hook setup on installation
  • 💻 Works in both traditional Git hooks and Husky

Installation

Global Installation

npm install -g commit-craft

Local Installation (Recommended)

npm install --save-dev commit-craft

The hook will be automatically set up when you install the package! 🎉

Usage

Automatic Setup

When you install CommitCraft, it automatically:

  1. ✅ Detects if you're using Husky or traditional Git hooks
  2. ✅ Creates the appropriate prepare-commit-msg hook
  3. ✅ Configures TTY redirection for interactive prompts
  4. ✅ Makes the hook executable

You should see output like:

🔍 Setting up CommitCraft in: /path/to/your/project
🔍 Husky detected: true
📝 Creating Husky hook at: /path/to/your/project/.husky/prepare-commit-msg
✅ Husky prepare-commit-msg hook created successfully!
🎉 CommitCraft is ready to use! Try making a commit.

Manual Setup (if needed)

If automatic setup doesn't work, you can set up manually:

# Run the setup command
npx commit-craft-setup

With Husky

If you're using Husky for Git hooks:

  1. Install CommitCraft and Husky:
npm install --save-dev commit-craft husky
  1. Initialize Husky (if not already done):
npx husky install
  1. The hook will be automatically created, or you can create it manually:
npx husky add .husky/prepare-commit-msg "exec < /dev/tty && npx commit-craft \$1 \$2"

Your .husky/prepare-commit-msg file should look like:

#!/usr/bin/env sh
exec < /dev/tty && npx commit-craft $1 $2

Traditional Git Hooks

For traditional Git hooks, the hook will be automatically created at .git/hooks/prepare-commit-msg:

#!/bin/sh
exec < /dev/tty && npx commit-craft "$1" "$2"

Manual Usage

You can also use CommitCraft manually:

commit-craft <commit-file-path> [commit-source]

Commit Types

CommitCraft supports the following conventional commit types:

  • feat: A new feature
  • 🐛 fix: A bug fix
  • 📝 docs: Documentation only changes
  • 💄 style: Changes that do not affect the meaning of the code
  • ♻️ refactor: A code change that neither fixes a bug nor adds a feature
  • test: Adding missing tests or correcting existing tests
  • 🔧 chore: Changes to the build process or auxiliary tools

Example

When you make a commit, CommitCraft will prompt you:

? Choose a commit type: (Use arrow keys)
❯ ✨ feat
  🐛 fix
  📝 docs
  💄 style
  ♻️ refactor
  ✅ test
  🔧 chore
  ────────────────
  🚪 Exit (abort commit)

Your commit message will be automatically formatted:

Original: "add user authentication"
Result: "feat: add user authentication"
✅ Commit message formatted: feat: add user authentication

Troubleshooting

Interactive Prompt Not Working

If the prompt appears but doesn't wait for your input, the hook might be missing TTY redirection. Ensure your hook includes:

exec < /dev/tty && npx commit-craft $1 $2

Hook Not Running

  1. Check if the hook exists:

    # For Husky
    ls -la .husky/prepare-commit-msg
       
    # For Git hooks
    ls -la .git/hooks/prepare-commit-msg
  2. Ensure it's executable:

    chmod +x .husky/prepare-commit-msg
    # or
    chmod +x .git/hooks/prepare-commit-msg
  3. Re-run setup:

    npx commit-craft-setup

Husky Deprecation Warnings

If you see Husky deprecation warnings, update your hook to use the modern format (without the deprecated husky.sh sourcing). CommitCraft automatically creates hooks in the correct format.

Integration Examples

Complete Husky Setup

Here's a complete example of integrating CommitCraft with other common tools:

{
  "scripts": {
    "prepare": "husky install"
  },
  "devDependencies": {
    "commit-craft": "^1.0.0",
    "husky": "^8.0.0",
    "lint-staged": "^13.0.0"
  }
}

Husky hooks:

  • .husky/pre-commit: npx lint-staged
  • .husky/prepare-commit-msg: exec < /dev/tty && npx commit-craft $1 $2

With Commitizen Alternative

CommitCraft can be used as a lightweight alternative to Commitizen for teams that prefer a simpler setup with automatic installation.

Local Development

Installing from Local Path

To install CommitCraft from a local directory in another project:

# Install as dev dependency from local path
npm install --save-dev /path/to/CommitCraft

# The hook will be automatically set up!

Available Commands

  • commit-craft: Main command for formatting commit messages
  • commit-craft-setup: Manual setup command for hooks

Development

Building

npm run build

Development Mode

npm run dev

Testing

# Test the setup script
npm run build
node dist/setup.js

# Test the main script
echo "test message" > test-commit.txt
node dist/index.js test-commit.txt
cat test-commit.txt

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Changelog

v1.0.0

  • ✨ Initial release
  • 🎯 Interactive commit type selection
  • 🐕 Husky integration support
  • 🔧 Automatic hook setup
  • 💻 TTY redirection for proper interactive prompts
  • 🚀 Modern Husky format (no deprecation warnings)