-
Notifications
You must be signed in to change notification settings - Fork 10
feat(stack): add git hooks with sourcing architecture #926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(stack): add git hooks with sourcing architecture #926
Conversation
|
This pull request is part of a stack:
|
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 👀 Review RequirementsWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
🧪 CI InsightsHere's what we observed from your CI run for 3a3cb1c. 🟢 All jobs passed!But CI Insights is watching 👀 |
c8c6667 to
684f427
Compare
684f427 to
cf101e1
Compare
cf101e1 to
656cbb9
Compare
54ab5d6 to
ca34ab5
Compare
656cbb9 to
eb8ed6d
Compare
|
@jd this pull request is now in conflict 😩 |
eb8ed6d to
2d0952c
Compare
2d0952c to
d957766
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new Git hook “sourcing” architecture so hook logic can be upgraded automatically without overwriting user-customized wrappers.
Changes:
- Introduces wrapper hooks in
.git/hooks/{hook}that source managed scripts in.git/hooks/mergify-hooks/{hook}.sh. - Updates
stack setupto support--forceand--check, and adds automatic managed-script upgrades viastack push(toggleable with--no-upgrade-hooks). - Refactors hook installation/update logic and adjusts tests/fixtures accordingly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
mergify_cli/tests/conftest.py |
Updates test fixture to install wrapper + managed script layout. |
mergify_cli/stack/setup.py |
Implements new install/update/check flows for wrappers + managed scripts; adds auto-upgrade helper. |
mergify_cli/stack/hooks/wrappers/prepare-commit-msg |
Adds new wrapper that sources the managed script and provides a user customization section. |
mergify_cli/stack/hooks/wrappers/commit-msg |
Adds new wrapper that sources the managed script and provides a user customization section. |
mergify_cli/stack/hooks/scripts/prepare-commit-msg.sh |
Converts hook logic to be sourced (replaces early exit with return) and adds header. |
mergify_cli/stack/hooks/scripts/commit-msg.sh |
Converts hook logic to be sourced (replaces exit with return) and adds header. |
mergify_cli/stack/cli.py |
Adds CLI flags for setup/check/force and push hook auto-upgrade control. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d957766 to
2ddf3dd
Compare
Implement a new hook structure that separates user-modifiable wrappers
from managed scripts:
- .git/hooks/{hook} - Thin wrapper (user can add custom logic)
- .git/hooks/mergify-hooks/{hook}.sh - Managed script (auto-upgradable)
This allows automatic upgrades of hook logic without touching user
customizations. Legacy hooks are detected and can be migrated with
--force flag.
CLI changes:
- `mergify stack setup --force`: Force reinstall wrappers
- `mergify stack setup --check`: Check status without changes
- `mergify stack push --no-upgrade-hooks`: Skip auto-upgrade
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change-Id: I23a8e9fd0cf3468418a856420ee51ec104ae1cb3
Claude-Session-Id: 5f1a97a3-70f4-4099-8edf-810289af8151
2ddf3dd to
3a3cb1c
Compare
Merge Queue Status✅ The pull request has been merged at 3a3cb1c This pull request spent 8 seconds in the queue, with no time running CI. Required conditions to merge
|
Implement a new hook structure that separates user-modifiable wrappers
from managed scripts:
This allows automatic upgrades of hook logic without touching user
customizations. Legacy hooks are detected and can be migrated with
--force flag.
CLI changes:
mergify stack setup --force: Force reinstall wrappersmergify stack setup --check: Check status without changesmergify stack push --no-upgrade-hooks: Skip auto-upgradeCo-Authored-By: Claude Opus 4.5 noreply@anthropic.com