build(hooks): add installable pre-commit hook (gofmt + go vet + golangci-lint --fast-only)#513
Merged
Conversation
…ev target Three independent developer-tooling designs from a brainstorming session: - pre-commit hook (gofmt + go vet + golangci-lint --fast-only, blocking) - CI security scanners (govulncheck blocking + standalone gosec informational) - k3s dev deployment target (CLUSTER=k3s, self-contained remote cluster) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk9GxWS9EpazjbwBKfMpUX
…s, k3s dev target One plan per spec: - pre-commit hook (2 tasks) - CI security scanners (4 tasks) - k3s dev target (6 tasks + pre-flight); flags migration-Job -> startup-AutoMigrate deviation Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk9GxWS9EpazjbwBKfMpUX
…nstall-hooks output
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
Adds a tracked, installable Git pre-commit hook that runs lightweight static analysis on staged Go files and blocks the commit on failure.
scripts/hooks/pre-commit— on staged Go files only, runsgofmt→go vet→golangci-lint run --fast-only(scoped to the staged files' package dirs), aggregates failures, and blocks the commit (exit 1) on any failure. No-op when no Go files are staged. Honors the existing.golangci.ymlexclusions. Missinggolangci-lintfails with an install hint (never silently skips). Bypass withgit commit --no-verify.scripts/hooks/post-commit— the existing version-bump hook, relocated verbatim from the untracked.git/hooks/post-commitso it survives the switch tocore.hooksPath.make install-hooks— pointsgit config core.hooksPathatscripts/hooks; run once per clone. Output notes it supersedes any personal.git/hooks/.Design & plan
docs/superpowers/specs/2026-07-01-precommit-hook-design.mddocs/superpowers/plans/2026-07-01-precommit-hook.mdVerification
make install-hookssetscore.hooksPath→scripts/hooks; relocatedpost-commitis byte-for-byte identical to the original (version-bump behavior preserved,--amend --no-verifyrecursion guard intact).--no-verify→ bypasses.make lintpasses (0 issues).Reviewed task-by-task plus a whole-branch review (verdict: ready to merge; only non-blocking cosmetic findings).
🤖 Generated with Claude Code