MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_remove_claude_hooks

Function cbm_remove_claude_hooks

src/cli/cli.c:4813–4848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4811}
4812
4813int cbm_remove_claude_hooks(const char *settings_path) {
4814 char command[CLI_BUF_8K];
4815 char previous_command[CLI_BUF_8K];
4816 char released_command[CLI_BUF_8K];
4817 char previous_legacy_command[CLI_BUF_8K];
4818 char released_legacy_command[CLI_BUF_8K];
4819 if (cbm_resolve_hook_command(CMM_HOOK_GATE_SCRIPT, command, sizeof(command)) != CLI_OK ||
4820 cbm_resolve_previous_hook_command(CMM_HOOK_GATE_SCRIPT, previous_command,
4821 sizeof(previous_command)) != CLI_OK ||
4822 cbm_resolve_released_hook_command(CMM_HOOK_GATE_SCRIPT, released_command,
4823 sizeof(released_command)) != CLI_OK ||
4824 cbm_resolve_previous_hook_command(CMM_HOOK_GATE_SCRIPT_LEGACY, previous_legacy_command,
4825 sizeof(previous_legacy_command)) != CLI_OK ||
4826 cbm_resolve_released_hook_command(CMM_HOOK_GATE_SCRIPT_LEGACY, released_legacy_command,
4827 sizeof(released_legacy_command)) != CLI_OK) {
4828 return CLI_ERR;
4829 }
4830 const char *const old_commands[] = {released_command, previous_command, released_legacy_command,
4831 previous_legacy_command, NULL};
4832 int search_result = remove_hooks_json((hooks_remove_args_t){
4833 .settings_path = settings_path,
4834 .hook_event = "PreToolUse",
4835 .matcher_str = CMM_HOOK_SEARCH_MATCHER,
4836 .old_matchers = cmm_claude_old_matchers,
4837 .old_commands = old_commands,
4838 .match_command_exact = command,
4839 });
4840 int read_result = remove_hooks_json((hooks_remove_args_t){
4841 .settings_path = settings_path,
4842 .hook_event = "PostToolUse",
4843 .matcher_str = CMM_HOOK_READ_MATCHER,
4844 .old_commands = old_commands,
4845 .match_command_exact = command,
4846 });
4847 return search_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR;
4848}
4849
4850/* Encode one shell word without permitting expansion or command substitution.
4851 * POSIX single-quoted strings represent an apostrophe as: '\'' */

Callers 2

uninstall_claude_codeFunction · 0.85
test_cli.cFile · 0.85

Tested by

no test coverage detected