Repository navigation
Conversation
Add internal/commits with pure Normalize/validate functions enforcing the project's Conventional Commits rules (known type set, lowercase type and subject, 72-char subject limit, whitespace trimming, and 72-column body wrapping). Wire it into the CLI as 'nightshift commit normalize' (positional, --file, and stdin sources; --check to validate only; --file rewrites the message in place), ship a commit-msg git hook under scripts/ with make install-hooks support, and document the format and installation in docs/commit-messages.md. Nightshift-Task: commit-normalize Nightshift-Ref: https://github.com/marcus/nightshift
wrapBody used to join every run of consecutive non-blank body lines into a single paragraph before wrapping, which merged multi-line git trailers (Signed-off-by, Co-authored-by) onto one line and destroyed intentional line structure such as lists and indented code blocks. The final paragraph is now detected as a git trailer block and emitted verbatim, and structured lines (list items, quotes, indented or fenced code) keep their own lines while prose around them is still joined and wrapped. Nightshift-Task: commit-normalize Nightshift-Ref: https://github.com/marcus/nightshift
Bring the PR branch up to date with origin/main (dc3b319, agent guidance docs refresh). No code changes; keeps the PR current for review. Nightshift-Task: commit-normalize Nightshift-Ref: https://github.com/marcus/nightshift
Author
|
Closing as a duplicate: superseded by #248, which contains the complete Commit Message Normalizer implementation (normalizer package, CLI command, commit-msg hook, docs) with review findings addressed. |
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.
Summary
Carries forward the Conventional Commits message normalizer originally submitted in #240, re-verified against current
main(dc3b319). This PR supersedes the earlier duplicate PRs for this feature so they can be consolidated: #226, #228, #229, #231, #232, #234, #235, #236, #237, and #240. Please review this one and close the others.Contents (unchanged from #240):
internal/commits— pureNormalize/validate: known type set (feat/fix/docs/style/refactor/test/chore/perf/build/ci), lowercased type, 72-char subject, whitespace trim, 72-column body wrap with verbatim git-trailer and structured-line preservation; idempotentnightshift commit normalizeCLI — positional/--file/stdin input,--checkmodescripts/commit-msg.sh— git commit-msg hook that rewrites the message file in place (or aborts on unrecoverable messages)docs/commit-messages.md— format documentationVerification (2026-09-13, against main @ dc3b319)
go build ./cmd/nightshift— passgo vet ./...— passgofmt -l .— cleango test ./...— all packages pass (incl.internal/commits)main(pending chore(lint): add golangci-lint config and fix the 71 findings it surfaces #241), so lint not run against a config--file/--checkall behave as specified (type lowercased, whitespace trimmed, body wrapped, trailers kept verbatim)scripts/commit-msg.shinstalled in a throwaway repo: a real commit's message was rewritten in place (header normalized, body wrapped, max line length exactly 72,Signed-off-by/Nightshift-*trailers preserved on separate lines), and a non-Conventional message was rejected with a non-zero exit aborting the commitnightshiftbinary on$PATH; a stale installed version (e.g. v0.3.4 viago install) prints the normalized message to stdout but does not rewrite the file in place — rebuild/reinstall before testing the hook.Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift