| 5221 | } |
| 5222 | |
| 5223 | static int cbm_remove_session_hooks(const char *settings_path) { |
| 5224 | static const char *matchers[] = {"startup", "resume", "clear", "compact"}; |
| 5225 | char command[CLI_BUF_8K]; |
| 5226 | char previous_command[CLI_BUF_8K]; |
| 5227 | char released_command[CLI_BUF_8K]; |
| 5228 | char previous_legacy_command[CLI_BUF_8K]; |
| 5229 | char released_legacy_command[CLI_BUF_8K]; |
| 5230 | if (cbm_resolve_hook_command(CMM_SESSION_REMINDER_SCRIPT, command, sizeof(command)) != CLI_OK || |
| 5231 | cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT, previous_command, |
| 5232 | sizeof(previous_command)) != CLI_OK || |
| 5233 | cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT, released_command, |
| 5234 | sizeof(released_command)) != CLI_OK || |
| 5235 | cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY, |
| 5236 | previous_legacy_command, |
| 5237 | sizeof(previous_legacy_command)) != CLI_OK || |
| 5238 | cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY, |
| 5239 | released_legacy_command, |
| 5240 | sizeof(released_legacy_command)) != CLI_OK) { |
| 5241 | return CLI_ERR; |
| 5242 | } |
| 5243 | const char *const old_commands[] = {released_command, previous_command, released_legacy_command, |
| 5244 | previous_legacy_command, NULL}; |
| 5245 | int rc = 0; |
| 5246 | for (int i = 0; i < NUM_DIRS; i++) { |
| 5247 | if (remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path, |
| 5248 | .hook_event = "SessionStart", |
| 5249 | .matcher_str = matchers[i], |
| 5250 | .old_commands = old_commands, |
| 5251 | .match_command_exact = command}) != 0) { |
| 5252 | rc = CLI_ERR; |
| 5253 | } |
| 5254 | } |
| 5255 | return rc; |
| 5256 | } |
| 5257 | |
| 5258 | static bool cbm_has_complete_claude_session_hooks(const char *home) { |
| 5259 | static const char *const matchers[] = {"startup", "resume", "clear", "compact"}; |
no test coverage detected