Zero-config commitlint frontend for conventional commits
  • TypeScript 75.4%
  • Shell 18.6%
  • JavaScript 6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Łukasz Jerciński 76688084f9
All checks were successful
Release / Check tip (push) Successful in 3s
Release / reuse (push) Successful in 3s
Release / quality-checks-1 (push) Has been skipped
Release / qc-result (push) Successful in 2s
Release / quality-checks (push) Successful in 0s
Dedupe check / dedupe-check (push) Successful in 30s
Release / Release (push) Successful in 23s
chore: upgrade to Vitest 5.1 and align with j4k-align 18.3.1 (#18)
2026-11-05 17:18:28 +00:00
.forgejo/workflows chore: upgrade to Vitest 5.1 and align with j4k-align 18.3.1 (#18) 2026-11-05 17:18:28 +00:00
.githooks chore: upgrade to Vitest 5.1 and align with j4k-align 18.3.1 (#18) 2026-11-05 17:18:28 +00:00
.vscode fix: align repository config with j4k-align templates (#8) 2026-06-10 06:28:36 +02:00
bin chore: initial commit 2025-12-17 09:19:42 +01:00
scripts chore: upgrade to Vitest 5.1 and align with j4k-align 18.3.1 (#18) 2026-11-05 17:18:28 +00:00
src chore: align with @j4k/align 6.1.3 (#18) 2026-10-13 16:46:44 +02:00
types chore: re-render managed files with @j4k/align@1.82.1 (#14) 2026-07-11 16:54:37 +02:00
.gitignore chore: migrate to the @j4k scope on the Forge npm registry (#13) 2026-07-11 11:21:53 +02:00
.node-version fix: align with j4k-align 17.15.4 (#16) 2026-11-03 14:26:57 +00:00
.oxfmtrc.json chore: retire the legacy CI review pipeline (#16) 2026-09-04 13:28:37 +02:00
.review-enrolled fix: publish as @j4k-oss/conventional-commit-msg from code.j4k.dev (#1) 2026-10-21 14:06:31 +00:00
AGENTS.md chore: regenerate agent instructions (#10) 2026-10-25 11:35:10 +00:00
CLAUDE.md chore: initial commit 2025-12-17 09:19:42 +01:00
knip.json fix: publish as @j4k-oss/conventional-commit-msg from code.j4k.dev (#1) 2026-10-21 14:06:31 +00:00
LICENSE chore: initial commit 2025-12-17 09:19:42 +01:00
oxlint.config.ts fix: align with j4k-align 17.15.4 (#16) 2026-11-03 14:26:57 +00:00
package.json chore: upgrade to Vitest 5.1 and align with j4k-align 18.3.1 (#18) 2026-11-05 17:18:28 +00:00
pnpm-lock.yaml chore: upgrade to Vitest 5.1 and align with j4k-align 18.3.1 (#18) 2026-11-05 17:18:28 +00:00
pnpm-workspace.yaml fix: publish as @j4k-oss/conventional-commit-msg from code.j4k.dev (#1) 2026-10-21 14:06:31 +00:00
README.md docs: say why the @j4k-oss registry mapping is required (#4) 2026-10-23 07:14:32 +00:00
release.config.mjs chore: align with j4k-align 13.1.0 (#7) 2026-10-24 11:17:39 +00:00
tsconfig.app.json chore: retire the legacy CI review pipeline (#16) 2026-09-04 13:28:37 +02:00
tsconfig.base.json chore: retire the legacy CI review pipeline (#16) 2026-09-04 13:28:37 +02:00
tsconfig.build.json fix: separate TypeScript checking from package builds (#19) 2026-10-19 10:16:32 +02:00
tsconfig.check.json fix: keep checking ahead of scripts in typed lint (#23) 2026-10-20 01:20:22 +02:00
tsconfig.json fix: keep checking ahead of scripts in typed lint (#23) 2026-10-20 01:20:22 +02:00
tsconfig.scripts.json chore: align with @j4k/align 6.1.3 (#18) 2026-10-13 16:46:44 +02:00
tsconfig.test.json chore: align with @j4k/align 6.1.3 (#18) 2026-10-13 16:46:44 +02:00
vitest.config.ts fix: report every static hook failure (#20) 2026-10-19 12:22:35 +02:00

conventional-commit-msg

Source: https://code.j4k.dev/j4k-oss/conventional-commit-msg. github.com/Jercik/conventional-commit-msg is a read-only mirror; open issues and pull requests on the Forge.

Zero-config commitlint frontend for conventional commits.

Validates commit messages against the Conventional Commits specification using @commitlint/config-conventional.

Installation

The package is published only as @j4k-oss/conventional-commit-msg on the code.j4k.dev registry, which reads anonymously. The unscoped conventional-commit-msg on npmjs.org is deprecated and gets no updates.

Without a registry mapping, a bare @j4k-oss/... command looks on npmjs.org, finds nothing, and fails with a 404. Map the scope to code.j4k.dev once in ~/.npmrc:

@j4k-oss:registry=https://code.j4k.dev/api/packages/j4k-oss/npm/

The commands below also pass the registry as a flag, which is enough for a single npx run. Keep the ~/.npmrc line for global installs: npm update -g and npm outdated -g read the registry from the configuration, and without the line they look the scoped name up on npmjs.org.

If you installed the unscoped package globally, remove it first with npm uninstall -g conventional-commit-msg. Both packages provide the conventional-commit-msg command, and npm install -g stops with EEXIST while the old copy is there.

Install the command globally:

npm install -g --@j4k-oss:registry=https://code.j4k.dev/api/packages/j4k-oss/npm/ @j4k-oss/conventional-commit-msg

Or run it once without installing:

npx -y --@j4k-oss:registry=https://code.j4k.dev/api/packages/j4k-oss/npm/ @j4k-oss/conventional-commit-msg@latest --last

In a pnpm project, map the scope and exempt it from minimumReleaseAge in pnpm-workspace.yaml, then add the package:

registries:
  "@j4k-oss": https://code.j4k.dev/api/packages/j4k-oss/npm/
minimumReleaseAgeExclude:
  - "@j4k-oss/*"
pnpm add -D @j4k-oss/conventional-commit-msg

The package installs the conventional-commit-msg command, which the examples below run. After a pnpm project install, run it as pnpm exec conventional-commit-msg.

Quick Start: Git Hook

  1. Create .githooks/commit-msg:
#!/bin/sh
npm exec --yes --@j4k-oss:registry=https://code.j4k.dev/api/packages/j4k-oss/npm/ --package=@j4k-oss/conventional-commit-msg@latest -- conventional-commit-msg "$1"

npm exec --package=…@latest (not npx -y) keeps the hook working when an npm_config_package env var is inherited (some tool wrappers set it) and when the hook runs inside this package's own repository, where the local package name would otherwise shadow the published binary. The inline registry flag keeps the hook working for teammates who have not edited ~/.npmrc.

  1. Make it executable and enable the hooks directory:
chmod +x .githooks/commit-msg
git config core.hooksPath .githooks

Now every commit message will be validated automatically.

Usage

# Validate last commit
conventional-commit-msg --last

# CI mode: validate PR commits
conventional-commit-msg --from origin/main --to HEAD

# Read commit message from stdin
echo "feat: add feature" | conventional-commit-msg

# Validate commit message file
conventional-commit-msg .git/COMMIT_EDITMSG

# Verbose mode: show output even on success
conventional-commit-msg --last --verbose

Options

Option Description
<file> Commit message file (git hook mode)
--last Validate the last commit
--from <sha> Start of commit range (CI mode)
--to <sha> End of commit range (CI mode)
-v, --verbose Show output on success
-V, --version Output the version number
-h, --help Display help for command

Pipeline Examples

# Check if last commit is valid, exit 1 if not (for CI scripts)
conventional-commit-msg --last && echo "Valid" || { echo "Invalid"; exit 1; }

# Validate message from a file (silent on success, shows errors)
cat .git/COMMIT_EDITMSG | conventional-commit-msg

# Validate multiple messages from a file (one per line)
while IFS= read -r msg; do
  echo "$msg" | conventional-commit-msg || echo "Invalid: $msg"
done < messages.txt

License

MIT