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