fix(uninstall): remove graphify hook/section from Claude local-only files (#1731)#1733
Closed
TPAteeq wants to merge 1 commit into
Closed
fix(uninstall): remove graphify hook/section from Claude local-only files (#1731)#1733TPAteeq wants to merge 1 commit into
TPAteeq wants to merge 1 commit into
Conversation
…iles (Graphify-Labs#1731) `graphify uninstall` (and `graphify claude uninstall`) only looked at `.claude/settings.json` and root `CLAUDE.md`. A user who relocates the PreToolUse hook into `.claude/settings.local.json` and the `## graphify` instructions into `CLAUDE.local.md` / `.claude/CLAUDE.local.md` - so they are not committed to a shared repo - was left with both behind after uninstall, which reported "nothing to do". - `_uninstall_claude_hook` now strips the hook from both `settings.json` and `settings.local.json` (factored into `_strip_graphify_hook`). - `claude_uninstall` now strips the `## graphify` section from `CLAUDE.md`, root `CLAUDE.local.md`, and `.claude/CLAUDE.local.md` (factored into `_strip_graphify_md_section`), cleaning every present file rather than the first, and always runs the hook cleanup. - `_strip_graphify_md_section` reads the two newly-covered files defensively so a non-UTF-8 or otherwise unreadable file can't abort uninstall. Unrelated local-only files (no graphify content) are left byte-for-byte untouched. The `--local` install flag suggested in the issue is left out of scope; this change makes uninstall symmetric with wherever the config lives. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Merged into |
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.
Fixes #1731.
Problem
graphify uninstall(andgraphify claude uninstall) only touched.claude/settings.jsonand the rootCLAUDE.md. If a user relocates thePreToolUse hook into
.claude/settings.local.jsonand the## graphifyinstructions into
CLAUDE.local.md/.claude/CLAUDE.local.md— a common moveso graphify's config isn't committed to a shared repo — uninstall skipped both
and reported "nothing to do", leaving them behind.
Fix
_uninstall_claude_hookstrips the hook from bothsettings.jsonandsettings.local.json(new shared helper_strip_graphify_hook).claude_uninstallstrips the## graphifysection fromCLAUDE.md, rootCLAUDE.local.md, and.claude/CLAUDE.local.md(new shared helper_strip_graphify_md_section). It cleans every file that's present rather thanthe first one found, and always runs the hook cleanup afterward.
_strip_graphify_md_sectionreads the two newly-covered local filesdefensively, so a non-UTF-8 or unreadable file can't abort uninstall.
Unrelated local-only files (no graphify content) are left byte-for-byte
untouched, and the existing "nothing to do" / "not found" messaging is preserved.
Out of scope
The issue also suggests an install-side
--localflag to write directly intothe local-only files. That's a feature and a separate design decision; this PR
only makes uninstall symmetric with wherever the config actually lives.
Testing
Six regression tests added in
tests/test_claude_md.pycovering the hook insettings.local.json, the section in bothCLAUDE.local.mdlocations, the"section in both standard and local" case, content preservation, and an
unreadable (non-UTF-8) local file. Full test suite passes.