Skip to content

refactor(git-hooks): move validators to ci/ and reduce hooks to adapters - #223

Merged
ruby-automation merged 2 commits into
mainfrom
EXT-30-consolidate-git-hooks
Sep 5, 2026
Merged

refactor(git-hooks): move validators to ci/ and reduce hooks to adapters#223
ruby-automation merged 2 commits into
mainfrom
EXT-30-consolidate-git-hooks

Conversation

@ruby-automation

Copy link
Copy Markdown
Contributor

Summary

Implements EXT-30: consolidates the repository Git hook architecture so that canonical check programs live under ci/ and git-hooks/ contains only the two thin lifecycle adapters.

  • ci/validate_conventional_subject.sh — canonical subject validator (renamed from git-hooks/validate-conventional-subject; was ci/validate_conventional_commit.sh)
  • ci/validate_pull_request_title.sh — canonical PR title guard (renamed from git-hooks/validate-pull-request-title)
  • ci/validate_commit_range.sh — canonical commit-range checker (renamed from git-hooks/validate-commit-range)
  • ci/validate_push_refs.sh — new canonical pre-push check; implements Git's pre-push stdin protocol (<local-ref> <local-sha> <remote-ref> <remote-sha> per line); skips deletions; handles new branches via merge-base with origin/main; handles existing branches using remote SHA as base; preserves the GitHub Update-branch merge exception
  • git-hooks/commit-msgexec "$repo_top/ci/validate_conventional_subject.sh" "$1" (adapter only)
  • git-hooks/pre-pushexec "$repo_top/ci/validate_push_refs.sh" "$@" (adapter only, replaces former mix precommit call)
  • mix precommit — calls ci/validate_pull_request_title.sh and ci/validate_commit_range.sh directly
  • .github/workflows/ci.yamlconventional_commits job calls ./ci/validate_commit_range.sh directly
  • Deleted: ci/conventional_commits.sh, ci/validate_conventional_commit.sh (superseded by canonical ci/validate_*.sh names)

Test plan

  • @subject_guard, @title_guard, @range_guard updated to ci/*.sh paths
  • @push_refs_guard added with tests: empty stdin, deletion skip, valid range, invalid range, new-branch mode
  • setup_ci_worktree! creates ci/ directory in test worktree so scripts resolve $repo_top/ci/validate_conventional_subject.sh correctly
  • Structural assertion: git-hooks/ contains exactly ["commit-msg", "pre-push"]
  • precommit_test.exs expects ./ci/validate_pull_request_title.sh and ./ci/validate_commit_range.sh
  • 41 root tests pass
  • mix format --check-formatted clean

Closes EXT-30.

🤖 Generated with Claude Code

ruby-automation and others added 2 commits September 4, 2026 21:36
Replace the two legacy ci/ validation scripts (conventional_commits.sh,
validate_conventional_commit.sh) with direct calls to their counterparts
under git-hooks/: git-hooks/validate-commit-range and
git-hooks/validate-conventional-subject.

- Delete ci/conventional_commits.sh and ci/validate_conventional_commit.sh
- Update .github/workflows/ci.yaml to run ./git-hooks/validate-commit-range
- Update app/usage-rules.md to reference git-hooks/validate-commit-range

The hook installer (mix git_hooks), the hook wrappers (git-hooks/commit-msg
and git-hooks/pre-push), the shared validators, and documentation were
already updated by EXT-29 (db08f0e / 044459e).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ci/validate_conventional_subject.sh, ci/validate_pull_request_title.sh,
ci/validate_commit_range.sh, and ci/validate_push_refs.sh are now the
canonical check programs. git-hooks/commit-msg and git-hooks/pre-push
are thin exec wrappers that delegate to them. mix precommit and GitHub
Actions call ci/ scripts directly. Former git-hooks/ validator scripts
are removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ruby-automation
ruby-automation merged commit fd2dbb8 into main Sep 5, 2026
4 checks passed
@ruby-automation
ruby-automation deleted the EXT-30-consolidate-git-hooks branch September 5, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants