feat(hooks): add icm hook disable (#268) - #338
Merged
Merged
Conversation
Adds a command that strips ICM's hook entries from every detected AI tool (Claude Code, Gemini, Codex, Copilot settings JSON + the OpenCode plugin file) while preserving each tool's non-ICM hooks, the MCP server config, and your memory database. It's the reverse of `icm init --mode hook` — useful after an upgrade or to stop hook-driven extraction without a full `icm uninstall`. - Backs up each modified settings file to `<file>.icm-bak-<ts>` before writing. - `--dry-run` previews removals without touching anything. - Reuses the existing per-tool hook-location catalog (extracted to `hook_targets`, shared with `icm doctor`) and ICM-hook detection (`check_icm_hook_command`). - Dispatched before `open_store`, so it edits only settings files — it never opens or creates the DB. - Re-enable with `icm init --mode hook`. Tests: removes only ICM hooks (non-ICM entries, MCP config, and unrelated settings preserved; ICM-only events dropped; idempotent) and dry-run leaves the file byte-identical. Verified e2e against a temp HOME. clippy `-D warnings` clean; 296 cli tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adversarial review flagged that rewriting a settings file drops JSONC comments and reformats it (a backup is already written). Surface that in the command output so it's expected, not a surprise.
Merged
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.
Closes #268.
Adds
icm hook disable— removes ICM's hooks from every detected AI tool while keeping everything else. Useful after an upgrade, or to stop hook-driven extraction without a fullicm uninstall.What it does
<file>.icm-bak-<ts>before writing.--dry-runpreviews without changing anything."SessionEnd": []left behind).icm init --mode hookre-installs.Why not just
icm uninstallicm uninstallremoves all ICM config (hooks and MCP server) across tools.hook disableis the narrower, reversible "hooks only" operation #268 asked for.Implementation notes
hook_targets, now shared withicm doctor) and the existingcheck_icm_hook_commanddetection — no new heuristics.open_store, so it only touches settings files and never opens/creates the DB.Tests / validation
--dry-runleaves the file byte-identical.HOME: 2 ICM hooks removed, othertool hook +mcpServers+otherSettingintact, backup written, dry-run correct, empty-home → "nothing to disable".cargo clippy --all-targets -- -D warningsclean; 296 cli tests pass.🤖 Generated with Claude Code