| 5200 | } |
| 5201 | |
| 5202 | static int cbm_remove_session_hooks(const char *settings_path) { |
| 5203 | static const char *matchers[] = {"startup", "resume", "clear", "compact"}; |
| 5204 | char command[CLI_BUF_8K]; |
| 5205 | char previous_command[CLI_BUF_8K]; |
| 5206 | char released_command[CLI_BUF_8K]; |
| 5207 | char previous_legacy_command[CLI_BUF_8K]; |
| 5208 | char released_legacy_command[CLI_BUF_8K]; |
| 5209 | if (cbm_resolve_hook_command(CMM_SESSION_REMINDER_SCRIPT, command, sizeof(command)) != CLI_OK || |
| 5210 | cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT, previous_command, |
| 5211 | sizeof(previous_command)) != CLI_OK || |
| 5212 | cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT, released_command, |
| 5213 | sizeof(released_command)) != CLI_OK || |
| 5214 | cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY, |
| 5215 | previous_legacy_command, |
| 5216 | sizeof(previous_legacy_command)) != CLI_OK || |
| 5217 | cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY, |
| 5218 | released_legacy_command, |
| 5219 | sizeof(released_legacy_command)) != CLI_OK) { |
| 5220 | return CLI_ERR; |
| 5221 | } |
| 5222 | const char *const old_commands[] = {released_command, previous_command, released_legacy_command, |
| 5223 | previous_legacy_command, NULL}; |
| 5224 | int rc = 0; |
| 5225 | for (int i = 0; i < NUM_DIRS; i++) { |
| 5226 | if (remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path, |
| 5227 | .hook_event = "SessionStart", |
| 5228 | .matcher_str = matchers[i], |
| 5229 | .old_commands = old_commands, |
| 5230 | .match_command_exact = command}) != 0) { |
| 5231 | rc = CLI_ERR; |
| 5232 | } |
| 5233 | } |
| 5234 | return rc; |
| 5235 | } |
| 5236 | |
| 5237 | static bool cbm_has_complete_claude_session_hooks(const char *home) { |
| 5238 | static const char *const matchers[] = {"startup", "resume", "clear", "compact"}; |
no test coverage detected