Skip to content

fix(uninstall): remove graphify hook/section from Claude local-only files (#1731)#1733

Closed
TPAteeq wants to merge 1 commit into
Graphify-Labs:v8from
TPAteeq:fix/uninstall-claude-local-files
Closed

fix(uninstall): remove graphify hook/section from Claude local-only files (#1731)#1733
TPAteeq wants to merge 1 commit into
Graphify-Labs:v8from
TPAteeq:fix/uninstall-claude-local-files

Conversation

@TPAteeq

@TPAteeq TPAteeq commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #1731.

Problem

graphify uninstall (and graphify claude uninstall) only touched
.claude/settings.json and the root CLAUDE.md. If a user relocates the
PreToolUse hook into .claude/settings.local.json and the ## graphify
instructions into CLAUDE.local.md / .claude/CLAUDE.local.md — a common move
so graphify's config isn't committed to a shared repo — uninstall skipped both
and reported "nothing to do", leaving them behind.

Fix

  • _uninstall_claude_hook strips the hook from both settings.json and
    settings.local.json (new shared helper _strip_graphify_hook).
  • claude_uninstall strips the ## graphify section from CLAUDE.md, root
    CLAUDE.local.md, and .claude/CLAUDE.local.md (new shared helper
    _strip_graphify_md_section). It cleans every file that's present rather than
    the first one found, and always runs the hook cleanup afterward.
  • _strip_graphify_md_section reads the two newly-covered local files
    defensively, 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 --local flag to write directly into
the 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.py covering the hook in
settings.local.json, the section in both CLAUDE.local.md locations, the
"section in both standard and local" case, content preservation, and an
unreadable (non-UTF-8) local file. Full test suite passes.

…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>
@safishamsi

Copy link
Copy Markdown
Collaborator

Merged into v8 (0d206cb), authorship preserved — thanks @TPAteeq. Clean helper extraction (_strip_graphify_hook / _strip_graphify_md_section), cleans all present files (not short-circuited), deletes emptied files, tolerates non-UTF-8, and preserves other content. I verified both entry points the issue names: graphify claude uninstall and the bare graphify uninstall (uninstall_all) both now clean .claude/settings.local.json and .claude/CLAUDE.local.md. Full suite green (3089 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.

uninstall does not remove hooks/instructions from .claude/settings.local.json or .claude/CLAUDE.local.md

2 participants