| 5043 | } |
| 5044 | |
| 5045 | static int cbm_remove_qoder_context_hook(const char *settings_path, const char *binary_path) { |
| 5046 | char command[CLI_BUF_8K]; |
| 5047 | char shell[CLI_BUF_32]; |
| 5048 | if (cbm_build_qoder_hook_command(binary_path, cbm_current_platform_is_windows(), command, |
| 5049 | sizeof(command), shell, sizeof(shell)) != CLI_OK) { |
| 5050 | return CLI_ERR; |
| 5051 | } |
| 5052 | int legacy_result = remove_hooks_json((hooks_remove_args_t){ |
| 5053 | .settings_path = settings_path, |
| 5054 | .hook_event = "UserPromptSubmit", |
| 5055 | .match_command_exact = command, |
| 5056 | }); |
| 5057 | int session_result = remove_hooks_json((hooks_remove_args_t){ |
| 5058 | .settings_path = settings_path, |
| 5059 | .hook_event = "SessionStart", |
| 5060 | .matcher_str = "startup|resume|clear|compact|new", |
| 5061 | .match_command_exact = command, |
| 5062 | }); |
| 5063 | int subagent_result = remove_hooks_json((hooks_remove_args_t){ |
| 5064 | .settings_path = settings_path, |
| 5065 | .hook_event = "SubagentStart", |
| 5066 | .matcher_str = "*", |
| 5067 | .match_command_exact = command, |
| 5068 | }); |
| 5069 | int read_result = remove_hooks_json((hooks_remove_args_t){ |
| 5070 | .settings_path = settings_path, |
| 5071 | .hook_event = "PostToolUse", |
| 5072 | .matcher_str = "Read", |
| 5073 | .match_command_exact = command, |
| 5074 | }); |
| 5075 | return legacy_result == CLI_OK && session_result == CLI_OK && subagent_result == CLI_OK && |
| 5076 | read_result == CLI_OK |
| 5077 | ? CLI_OK |
| 5078 | : CLI_ERR; |
| 5079 | } |
| 5080 | |
| 5081 | #ifdef CBM_CLI_ENABLE_TEST_API |
| 5082 | int cbm_upsert_qoder_context_hooks_for_testing(const char *settings_path, const char *binary_path) { |
no test coverage detected