Skip to content

Conversation

@jd
Copy link
Member

@jd jd commented Jan 22, 2026

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

@jd
Copy link
Member Author

jd commented Jan 22, 2026

This pull request is part of a stack:

  1. feat(stack): add git hooks with sourcing architecture (#926) 👈
  2. feat(stack): add hooks subcommand for status display (#933)
  3. refactor(stack): extract _get_hooks_dir() helper (#934)
  4. refactor(stack): extract _get_script_resource_path() helper (#935)
  5. refactor(stack): use as_file() for package resource copying (#937)

@mergify mergify bot had a problem deploying to Mergify Merge Protections January 22, 2026 09:44 Failure
@mergify
Copy link
Contributor

mergify bot commented Jan 22, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 🤖 Continuous Integration

Wonderful, this rule succeeded.
  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

Wonderful, this rule succeeded.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?:

🟢 🔎 Reviews

Wonderful, this rule succeeded.
  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

@mergify
Copy link
Contributor

mergify bot commented Jan 22, 2026

🧪 CI Insights

Here's what we observed from your CI run for 3a3cb1c.

🟢 All jobs passed!

But CI Insights is watching 👀

@mergify mergify bot requested a review from a team January 22, 2026 09:46
sileht
sileht previously approved these changes Jan 22, 2026
@jd jd force-pushed the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch from c8c6667 to 684f427 Compare January 22, 2026 10:23
@mergify mergify bot dismissed sileht’s stale review January 22, 2026 10:24

Pull request has been modified.

@mergify mergify bot had a problem deploying to Mergify Merge Protections January 22, 2026 10:24 Failure
@mergify mergify bot requested a review from a team January 22, 2026 10:25
@jd jd force-pushed the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch from 684f427 to cf101e1 Compare January 22, 2026 10:34
@mergify mergify bot had a problem deploying to Mergify Merge Protections January 22, 2026 10:34 Failure
@jd jd force-pushed the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch from cf101e1 to 656cbb9 Compare January 22, 2026 10:49
@mergify mergify bot had a problem deploying to Mergify Merge Protections January 22, 2026 10:49 Failure
@jd jd force-pushed the devs/jd/version-hooks/I3c458313822df489627119561bcc84572c5e9873 branch from 54ab5d6 to ca34ab5 Compare January 22, 2026 12:49
@jd jd force-pushed the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch from 656cbb9 to eb8ed6d Compare January 22, 2026 12:49
@mergify mergify bot had a problem deploying to Mergify Merge Protections January 22, 2026 12:50 Failure
Base automatically changed from devs/jd/version-hooks/I3c458313822df489627119561bcc84572c5e9873 to main January 22, 2026 13:20
@mergify
Copy link
Contributor

mergify bot commented Jan 22, 2026

@jd this pull request is now in conflict 😩

@mergify mergify bot added the conflict label Jan 22, 2026
@jd jd force-pushed the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch from eb8ed6d to 2d0952c Compare January 22, 2026 13:27
@mergify mergify bot removed the conflict label Jan 22, 2026
@mergify mergify bot had a problem deploying to Mergify Merge Protections January 22, 2026 13:28 Failure
@mergify mergify bot requested a review from a team January 23, 2026 13:28
Copilot AI review requested due to automatic review settings January 24, 2026 16:28
@jd jd force-pushed the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch from 2d0952c to d957766 Compare January 24, 2026 16:28
@mergify mergify bot had a problem deploying to Mergify Merge Protections January 24, 2026 16:29 Failure
Copy link

Copilot AI left a 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 setup to support --force and --check, and adds automatic managed-script upgrades via stack 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.

@jd jd force-pushed the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch from d957766 to 2ddf3dd Compare January 25, 2026 13:35
@mergify mergify bot had a problem deploying to Mergify Merge Protections January 25, 2026 13:36 Failure
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
@jd jd force-pushed the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch from 2ddf3dd to 3a3cb1c Compare January 25, 2026 14:32
@mergify mergify bot deployed to Mergify Merge Protections January 25, 2026 14:33 Active
@mergify mergify bot merged commit c5a89e6 into main Jan 26, 2026
10 checks passed
@mergify mergify bot deleted the devs/jd/version-hooks/I23a8e9fd0cf3468418a856420ee51ec104ae1cb3 branch January 26, 2026 12:14
@mergify
Copy link
Contributor

mergify bot commented Jan 26, 2026

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.
The checks were run in-place.

Required conditions to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants