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

Function cbm_remove_claude_hooks

src/cli/cli.c:4593–4628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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