| 5364 | } |
| 5365 | |
| 5366 | static int cbm_remove_session_hooks(const char *settings_path) { |
| 5367 | static const char *matchers[] = {"startup", "resume", "clear", "compact"}; |
| 5368 | char command[CLI_BUF_8K]; |
| 5369 | char previous_command[CLI_BUF_8K]; |
| 5370 | char released_command[CLI_BUF_8K]; |
| 5371 | char previous_legacy_command[CLI_BUF_8K]; |
| 5372 | char released_legacy_command[CLI_BUF_8K]; |
| 5373 | if (cbm_resolve_hook_command(CMM_SESSION_REMINDER_SCRIPT, command, sizeof(command)) != CLI_OK || |
| 5374 | cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT, previous_command, |
| 5375 | sizeof(previous_command)) != CLI_OK || |
| 5376 | cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT, released_command, |
| 5377 | sizeof(released_command)) != CLI_OK || |
| 5378 | cbm_resolve_previous_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY, |
| 5379 | previous_legacy_command, |
| 5380 | sizeof(previous_legacy_command)) != CLI_OK || |
| 5381 | cbm_resolve_released_hook_command(CMM_SESSION_REMINDER_SCRIPT_LEGACY, |
| 5382 | released_legacy_command, |
| 5383 | sizeof(released_legacy_command)) != CLI_OK) { |
| 5384 | return CLI_ERR; |
| 5385 | } |
| 5386 | const char *const old_commands[] = {released_command, previous_command, released_legacy_command, |
| 5387 | previous_legacy_command, NULL}; |
| 5388 | int rc = 0; |
| 5389 | for (int i = 0; i < NUM_DIRS; i++) { |
| 5390 | if (remove_hooks_json((hooks_remove_args_t){.settings_path = settings_path, |
| 5391 | .hook_event = "SessionStart", |
| 5392 | .matcher_str = matchers[i], |
| 5393 | .old_commands = old_commands, |
| 5394 | .match_command_exact = command}) != 0) { |
| 5395 | rc = CLI_ERR; |
| 5396 | } |
| 5397 | } |
| 5398 | return rc; |
| 5399 | } |
| 5400 | |
| 5401 | static bool cbm_has_complete_claude_session_hooks(const char *home) { |
| 5402 | static const char *const matchers[] = {"startup", "resume", "clear", "compact"}; |
no test coverage detected