fix(installer): strip stale auto-sync hooks on install and uninstall (#278)
Pre-0.8 installers wrote `codegraph mark-dirty` / `sync-if-dirty` hooks
to Claude Code's settings.json. Both subcommands were removed from the
CLI, so the Stop hook fails every turn ("unknown command
'sync-if-dirty'"). The cleanup that once removed them was lost when the
installer moved to the per-target architecture.
Add cleanupLegacyHooks(), wired into both install (upgrades self-heal)
and uninstall (so the npm preuninstall step fully reverses a legacy
install). Surgical at the command level: only codegraph's own hook
entries are dropped, so unrelated hooks sharing a matcher group or event
(e.g. GitKraken's `gk ai hook run`) survive, and a settings.json with no
legacy hooks is left byte-for-byte untouched.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
4329a52bec
commit
b8aec39abd
@@ -21,6 +21,20 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
signatures, generics, and Roblox instance-path `require(script.Parent.X)`
|
||||
imports.
|
||||
|
||||
### Fixed
|
||||
- **Installer**: re-running `codegraph install` now removes the broken
|
||||
auto-sync hooks that pre-0.8 versions wrote to Claude Code's
|
||||
`settings.json`. Those builds added a `Stop → codegraph sync-if-dirty`
|
||||
hook (and a `PostToolUse → codegraph mark-dirty` partner); both
|
||||
subcommands were later removed from the CLI, so Claude Code reported
|
||||
`Stop hook error: ... unknown command 'sync-if-dirty'` on every turn.
|
||||
The cleanup is surgical — only codegraph's own hook entries are
|
||||
stripped, so unrelated hooks sharing the same file or event (e.g. a
|
||||
GitKraken `gk ai hook run` hook) are left untouched — and it also runs
|
||||
on uninstall, so the npm `preuninstall` step fully reverses a legacy
|
||||
install. Re-run `codegraph install` once on an affected machine to
|
||||
clear the error.
|
||||
|
||||
## [0.8.0] - 2026-05-20
|
||||
|
||||
### Added
|
||||
|
||||
Reference in New Issue
Block a user