fix: self-heal legacy untagged ccstatusline hooks on sync#490
Open
bit-saver wants to merge 1 commit into
Open
Conversation
stripManagedHooks only removed entries tagged 'ccstatusline-managed', so untagged hooks written by pre-tag versions survived every sync and piled up beside the freshly-written managed hooks. Also strip untagged entries whose command matches the ccstatusline --hook invocation, making hook sync idempotent for legacy installs. Non-ccstatusline user hooks are untouched.
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.
Problem
stripManagedHooksremoves only entries taggedccstatusline-managed. Untagged hooks — written by pre-tag versions, annpx-vs-global-binary command variant, settings synced from another machine, or a manual edit — are invisible to it. So everysyncWidgetHooksleaves them in place and adds a fresh managed copy beside them: ccstatusline hooks accumulate in~/.claude/settings.json, and saving from the configurator never converges.Fix
stripManagedHooksnow also drops untagged entries whose hook command matches the ccstatusline--hookinvocation (/ccstatusline.* --hook(?:\s|$)/), then re-adds the deduped managed set as before. Hook sync becomes idempotent even for legacy installs — it migrates old/untagged hooks into the managed set automatically. Non-ccstatusline user hooks are untouched.The match requires a space before
--hookand a trailing word boundary so it can't catch unrelated--hook*substrings.Tests
Adds vitest cases to
src/utils/__tests__/hooks.test.ts(real tempCLAUDE_CONFIG_DIR, no mocks):bun run lintpasses clean; thehookssuite passes.