| 5144 | } |
| 5145 | |
| 5146 | static int cbm_remove_session_hooks(const char *settings_path) { |
| 5147 | static const char *matchers[] = {"startup", "resume", "clear", "compact"}; |
| 5148 | char command[CLI_BUF_8K]; |
| 5149 | char previous_command[CLI_BUF_8K]; |
| 5150 | char released_command[CLI_BUF_8K]; |
| 5151 | char previous_legacy_command[CLI_BUF_8K]; |
| 5152 | char released_legacy_command[CLI_BUF_8K]; |
| 5153 | if (cbm_resolve_hook_command(CMM_SESSION_REMINDER_SCRIPT, command, sizeof(command)) != CLI_OK || |
| 5154 | cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT, previous_command, |
| 5155 | sizeof(previous_command)) != CLI_OK || |
| 5156 | cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT, released_command, |
| 5157 | sizeof(released_command)) != CLI_OK || |
| 5158 | cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY, |
| 5159 | previous_legacy_command, |
| 5160 | sizeof(previous_legacy_command)) != CLI_OK || |
| 5161 | cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY, |
| 5162 | released_legacy_command, |
| 5163 | sizeof(released_legacy_command)) != CLI_OK) { |
| 5164 | return CLI_ERR; |
| 5165 | } |
| 5166 | const char *const old_commands[] = {released_command, previous_command, released_legacy_command, |
| 5167 | previous_legacy_command, NULL}; |
| 5168 | int rc = 0; |
| 5169 | for (int i = 0; i < NUM_DIRS; i++) { |
| 5170 | if (remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path, |
| 5171 | .hook_event = "SessionStart", |
| 5172 | .matcher_str = matchers[i], |
| 5173 | .old_commands = old_commands, |
| 5174 | .match_command_exact = command}) != 0) { |
| 5175 | rc = CLI_ERR; |
| 5176 | } |
| 5177 | } |
| 5178 | return rc; |
| 5179 | } |
| 5180 | |
| 5181 | static bool cbm_has_complete_claude_session_hooks(const char *home) { |
| 5182 | static const char *const matchers[] = {"startup", "resume", "clear", "compact"}; |
no test coverage detected