Skip to content

Fix Install to replace stale standalone hooks on path change#13

Merged
jim80net merged 4 commits intomainfrom
fix/replace-stale-standalone-hook
Mar 14, 2026
Merged

Fix Install to replace stale standalone hooks on path change#13
jim80net merged 4 commits intomainfrom
fix/replace-stale-standalone-hook

Conversation

@jim80net
Copy link
Owner

Summary

  • Install() now checks for exact command path match instead of any gatekeeper hook
  • When a gatekeeper hook exists at a different path (e.g., old standalone binary at ~/.claude/hooks/claude-gatekeeper), it removes the stale entry before installing the new one (e.g., plugin at ${PLUGIN_ROOT}/bin/run.sh)
  • Previously, migrating from standalone to plugin left both hooks running — the old binary lacked features like cd-prefix handling, causing false denies on cross-repo operations

Test plan

  • TestInstallReplacesOldHook — verifies old hook at different path gets replaced
  • TestInstallIdempotentWithSamePath — verifies exact same path is still a no-op
  • Existing tests all pass (12/12 in setup, full suite green)

🤖 Generated with Claude Code

jim80net and others added 4 commits March 8, 2026 14:43
Set release-as 1.1.0 for the pull-model distribution migration.
Remove release-as after release-please creates the release PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When migrating from standalone binary to plugin installation, the old
hook entry in settings.json was never removed. Install() treated any
existing gatekeeper hook as "already configured" regardless of path,
so the old binary kept running alongside the plugin version. The old
binary could be outdated and missing features like cd-prefix handling.

Now Install() checks for an exact command match. If a gatekeeper hook
exists at a different path, it removes the old one before adding the
new entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jim80net jim80net merged commit e645b9d into main Mar 14, 2026
1 check passed
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.

1 participant