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

Function cbm_remove_session_hooks

src/cli/cli.c:5976–6018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5974}
5975
5976static int cbm_remove_session_hooks(const char *settings_path, const char *binary_path) {
5977 static const char *matchers[] = {"startup", "resume", "clear", "compact"};
5978 char shell_command[CLI_BUF_8K];
5979 char previous_command[CLI_BUF_8K];
5980 char released_command[CLI_BUF_8K];
5981 char previous_legacy_command[CLI_BUF_8K];
5982 char released_legacy_command[CLI_BUF_8K];
5983 if (cbm_resolve_hook_command(CMM_SESSION_REMINDER_SCRIPT, shell_command,
5984 sizeof(shell_command)) != CLI_OK ||
5985 cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT, previous_command,
5986 sizeof(previous_command)) != CLI_OK ||
5987 cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT, released_command,
5988 sizeof(released_command)) != CLI_OK ||
5989 cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY,
5990 previous_legacy_command,
5991 sizeof(previous_legacy_command)) != CLI_OK ||
5992 cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY,
5993 released_legacy_command,
5994 sizeof(released_legacy_command)) != CLI_OK) {
5995 return CLI_ERR;
5996 }
5997 const char *command = binary_path && binary_path[0] ? binary_path : shell_command;
5998 const char *const *command_args = binary_path && binary_path[0] ? cmm_claude_exec_args : NULL;
5999 size_t command_arg_count = binary_path && binary_path[0]
6000 ? sizeof(cmm_claude_exec_args) / sizeof(cmm_claude_exec_args[0])
6001 : 0U;
6002 const char *const old_commands[] = {shell_command, released_command,
6003 previous_command, released_legacy_command,
6004 previous_legacy_command, NULL};
6005 int rc = 0;
6006 for (int i = 0; i < NUM_DIRS; i++) {
6007 if (remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path,
6008 .hook_event = "SessionStart",
6009 .matcher_str = matchers[i],
6010 .old_commands = old_commands,
6011 .match_command_exact = command,
6012 .match_args = command_args,
6013 .match_arg_count = command_arg_count}) != 0) {
6014 rc = CLI_ERR;
6015 }
6016 }
6017 return rc;
6018}
6019
6020static bool cbm_has_complete_claude_session_hooks(const char *home, const char *binary_path) {
6021 static const char *const matchers[] = {"startup", "resume", "clear", "compact"};

Callers 1

uninstall_claude_codeFunction · 0.85

Tested by

no test coverage detected