{"id":25100,"library":"commithelper","title":"commithelper","description":"A CLI tool for creating and linting commit messages. Current stable version is 1.2.0 (released 2021-06-11), with a maintenance cadence. It offers two modes: `prompt` for interactively building a commit message and `check` for linting existing messages. Unlike commitlint, it provides guided prompts with valid options, and unlike commitizen, it also supports linting. Configuration can be placed in package.json or a separate config file. Integrates with git hooks via husky or ghooks.","status":"maintenance","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/jvanbruegge/commithelper","tags":["javascript","commit","lint","cli"],"install":[{"cmd":"npm install commithelper","lang":"bash","label":"npm"},{"cmd":"yarn add commithelper","lang":"bash","label":"yarn"},{"cmd":"pnpm add commithelper","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only since v1.2.0. Default import works.","wrong":"const commithelper = require('commithelper')","symbol":"default","correct":"import commithelper from 'commithelper'"},{"note":"Named export for linting mode.","wrong":"const check = require('commithelper/check')","symbol":"check","correct":"import { check } from 'commithelper'"},{"note":"Named export for interactive prompt mode.","wrong":"import { prompt } from 'commithelper/prompt'","symbol":"prompt","correct":"import { prompt } from 'commithelper'"}],"quickstart":{"code":"import { check } from 'commithelper';\nimport fs from 'fs';\n\nconst commitMessage = fs.readFileSync('.git/COMMIT_EDITMSG', 'utf8');\nconst result = check(commitMessage);\nif (!result.valid) {\n  console.error('Commit message invalid:', result.errors);\n  process.exit(1);\n} else {\n  console.log('Commit message is valid.');\n}\n","lang":"typescript","description":"Demonstrates how to programmatically lint a commit message using the check function and handle validation errors."},"warnings":[{"fix":"Use import syntax or switch to a dynamic import if using CJS.","message":"Package is ESM-only since v1.2.0. CommonJS require() will fail.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Upgrade to 1.2.0+.","message":"Version 1.1.1 had a missing shebang in the CLI entry point, causing scripts to fail.","severity":"deprecated","affected_versions":"1.1.1"},{"fix":"Use --fix only on files under version control or after review.","message":"Check mode with --fix may rewrite your commit message file; ensure you have a backup.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure the file is empty or contains only comments for interactive prompting.","message":"Prompt mode reads from a file path specified by --file. If the file contains non-comment lines, no questions are asked and the program exits successfully.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install commithelper --save-dev' and ensure you are using the correct import syntax.","cause":"Package not installed or incorrect import path.","error":"Cannot find module 'commithelper'"},{"fix":"Set 'type': 'module' in package.json or use .mjs extension for your script.","cause":"Running ESM code in a CommonJS context.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Use npx commithelper or ensure node_modules/.bin is in PATH.","cause":"CLI not in PATH or bin not linked.","error":"commithelper: command not found"},{"fix":"Use import { check } from 'commithelper' instead of default import.","cause":"Wrong import or using default export instead of named export.","error":"TypeError: commithelper.check is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}