fix: preserve sibling custom hooks on install/uninstall (#484)#485
Open
tarekrached wants to merge 1 commit intoPeonPing:mainfrom
Open
fix: preserve sibling custom hooks on install/uninstall (#484)#485tarekrached wants to merge 1 commit intoPeonPing:mainfrom
tarekrached wants to merge 1 commit intoPeonPing:mainfrom
Conversation
install.sh / peon update filtered settings.json hooks at the matcher-entry level: if any inner hook command contained peon.sh or notify.sh, the entire matcher entry (with all its siblings) was dropped. Users composing peon-ping under the same matcher as other hooks silently lost them on every update. Filter at the inner-hook level instead — strip only peon/notify/handle-use hooks and drop the containing entry only when its hooks list is emptied. Applied symmetrically to install.sh, install.ps1, uninstall.sh, uninstall.ps1. Also tightened incidental gaps uncovered while reviewing: - install.ps1 regex `-match "peon"` narrowed to `peon\.(ps1|sh)` (matches install.sh / uninstall.ps1 precision; previously would match any path containing "peon" e.g. `openpeon-*`, `peony-*`). - uninstall.sh now strips `notify.sh` hooks (parity with install.sh and uninstall.ps1). - uninstall.sh preserves entries that already had `hooks: []` rather than silently dropping them. Regression test in tests/install.bats injects a custom sibling hook into peon's SessionStart and UserPromptSubmit entries, re-runs install, and asserts both the custom hooks and peon hooks survive. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@tarekrached is attempting to deploy a commit to the Gary Sheng's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
Fixes #484.
install.sh/peon updatefilteredsettings.jsonhooks at the matcher-entry level: if any inner hook command containedpeon.shornotify.sh, the whole matcher entry (with all its siblings) was dropped. Users composing peon-ping under the same matcher as other hooks — a natural thing to do whenmatcher: ""is the default — silently lost those hooks on every update.The fix filters at the inner-hook level instead: strip only peon/notify/handle-use hooks, and drop the containing entry only when its hooks list becomes empty. Applied symmetrically to
install.sh,install.ps1,uninstall.sh, anduninstall.ps1.Incidental fixes uncovered during review
install.ps1regex-match "peon"narrowed topeon\.(ps1|sh). Matches the precision already ininstall.shanduninstall.ps1; previously would match any path containing the stringpeon(e.g.openpeon-*,peony-*). Pre-existing, but made subtler by the new surgical filter.uninstall.shnow stripsnotify.shhooks (parity withinstall.shanduninstall.ps1).uninstall.shpreserves matcher entries that already hadhooks: []— the old code silently dropped them.Test plan
tests/install.batsinjects a custom sibling hook into peon'sSessionStartandUserPromptSubmitentries, re-runs install, and asserts both the custom hooks and peon hooks survive.bats tests/install.batstests pass locally.🤖 Generated with Claude Code