chore: add commit message normalizer and validator - #186
Draft
gregggreg wants to merge 1 commit into
Draft
Conversation
gregggreg
force-pushed
the
nightshift/commit-normalize
branch
from
July 15, 2026 09:14
7530169 to
ea52342
Compare
This was referenced Aug 22, 2026
This was referenced Aug 29, 2026
Standardize on Conventional Commits: a documented convention, a bash normalizer/validator pair behind an opt-in commit-msg hook, and a CI job that validates every commit subject a pull request adds. Normalization is conservative and only rewrites what is mechanically safe (whitespace, casing of a recognized type, a trailing period, subject/body separation). Type inference stays behind an explicit --infer flag, and git-generated subjects (merge, revert, fixup/squash/amend, stash) plus comment-only templates are never rewritten or rejected. Git's scissors marker and everything below it are passed through byte for byte so `git commit -v` diffs cannot leak into the commit body. Nightshift-Task: commit-normalize Nightshift-Ref: https://github.com/marcus/nightshift
gregggreg
force-pushed
the
nightshift/commit-normalize
branch
from
September 6, 2026 10:07
a818f1a to
c8ebf07
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Standardizes commit messages on Conventional Commits with a documented convention, an opt-in git hook, and CI enforcement.
Format
Types:
build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test. Scope and!are optional. Subjects are lowercase imperative, no more than 72 chars, no trailing period, blank line before the body.What's here
docs/commit-conventions.mdscripts/commit-msg-lib.shscripts/normalize-commit-msg.shscripts/validate-commit-msg.sh.githooks/commit-msgscripts/install-hooks.shmake install-hooks->git config core.hooksPath .githookstests/commit-msg-test.sh.github/workflows/commit-lint.ymlOpt-in, and conservative by design
Hooks are opt-in via
core.hooksPath- nothing changes for contributors who don't runmake install-hooks. CI still checks every PR, so enforcement doesn't depend on local setup.Normalization only rewrites what is mechanically safe: whitespace, casing of a recognized type, a trailing period, and the subject/body blank line. It never invents a type unless you explicitly pass
--infer. Merge, revert,fixup!/squash!/amend!, stash subjects, and comment-only templates are passed through untouched - a hook that blocksgit mergeis worse than an inconsistent history.Git's scissors marker and everything below it are copied through byte for byte, so a
git commit -vdiff can never leak into the commit body. An end-to-end test drives a realgit commit -vthrough the installed hook and asserts the stored message.Verification
./tests/commit-msg-test.sh- 49/49 pass on bash 3.2 (macOS system bash)go build ./...andgo test ./...- cleanNightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
Generated with Claude Code