feat: add pre-commit hooks and PR title validation#13
Merged
Conversation
- Add lefthook pre-commit hooks for gofmt, goimports, golangci-lint - Add CI job to validate PR titles follow conventional commits - Update MASTER.md to mark S4 (Pre-commit Hooks) as complete Note: Branch rulesets with commit_message_pattern not available in free tier, so enforcement relies on local hooks + PR title checks. Co-authored-by: Cursor <cursoragent@cursor.com>
📝 WalkthroughWalkthroughUpdates development workflows: adds Lefthook pre-commit and commit-msg checks, introduces a CI job to validate semantic PR titles, and marks two SDLC entries (S4 Pre-commit Hooks, S5 Test Coverage) as complete in the master plan. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@lefthook.yml`:
- Around line 4-20: The gofmt/goimports hooks hang and hide real failures when
no Go files are staged because the current run uses command substitution and
allows formatters to read stdin; update the gofmt and goimports command entries
(the "gofmt" and "goimports" commands) to first check whether {staged_files} is
empty and skip early if so, otherwise run the formatter directly on the file
list and return the formatter's exit status (do not wrap the formatter in test
-z "$(…)" which masks its exit code); ensure the implementation preserves and
propagates the formatter exit code so failures are visible in the pre-commit
hook.
- Guard when no Go files staged - Preserve formatter exit codes Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Feb 5, 2026
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
Implements S4: Pre-commit Hooks from the SDLC plan.
Changes
Local pre-commit hooks via
lefthook.yml:gofmt- checks code formattinggoimports- checks import formattinggolangci-lint- runs linter on staged filesCI PR title validation:
pr-titlejob validates PR titles follow conventional commitsamannn/action-semantic-pull-request@v5MASTER.md updated:
Architecture
Note on Branch Rulesets
GitHub's
commit_message_patternruleset feature is not available in the free tier. The implementation relies on:For enterprise repos, branch rulesets can be added via GitHub UI for additional enforcement.
Test Plan
make fmt && make lint && make test- all passTo test locally:
Made with Cursor
Summary by CodeRabbit