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

Function cbm_remove_claude_hooks

src/cli/cli.c:4587–4622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4585}
4586
4587int cbm_remove_claude_hooks(const char *settings_path) {
4588 char command[CLI_BUF_8K];
4589 char previous_command[CLI_BUF_8K];
4590 char released_command[CLI_BUF_8K];
4591 char previous_legacy_command[CLI_BUF_8K];
4592 char released_legacy_command[CLI_BUF_8K];
4593 if (cbm_resolve_hook_command(CMM_HOOK_GATE_SCRIPT, command, sizeof(command)) != CLI_OK ||
4594 cbm_resolve_previous_hook_command(CMM_HOOK_GATE_SCRIPT, previous_command,
4595 sizeof(previous_command)) != CLI_OK ||
4596 cbm_resolve_released_hook_command(CMM_HOOK_GATE_SCRIPT, released_command,
4597 sizeof(released_command)) != CLI_OK ||
4598 cbm_resolve_previous_hook_command(CMM_HOOK_GATE_SCRIPT_LEGACY, previous_legacy_command,
4599 sizeof(previous_legacy_command)) != CLI_OK ||
4600 cbm_resolve_released_hook_command(CMM_HOOK_GATE_SCRIPT_LEGACY, released_legacy_command,
4601 sizeof(released_legacy_command)) != CLI_OK) {
4602 return CLI_ERR;
4603 }
4604 const char *const old_commands[] = {released_command, previous_command, released_legacy_command,
4605 previous_legacy_command, NULL};
4606 int search_result = remove_hooks_json((hooks_remove_args_t){
4607 .settings_path = settings_path,
4608 .hook_event = "PreToolUse",
4609 .matcher_str = CMM_HOOK_SEARCH_MATCHER,
4610 .old_matchers = cmm_claude_old_matchers,
4611 .old_commands = old_commands,
4612 .match_command_exact = command,
4613 });
4614 int read_result = remove_hooks_json((hooks_remove_args_t){
4615 .settings_path = settings_path,
4616 .hook_event = "PostToolUse",
4617 .matcher_str = CMM_HOOK_READ_MATCHER,
4618 .old_commands = old_commands,
4619 .match_command_exact = command,
4620 });
4621 return search_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR;
4622}
4623
4624/* Encode one shell word without permitting expansion or command substitution.
4625 * 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