| 4283 | } |
| 4284 | |
| 4285 | static int cbm_remove_qoder_context_hook(const char *settings_path, const char *binary_path) { |
| 4286 | char command[CLI_BUF_8K]; |
| 4287 | char shell[CLI_BUF_32]; |
| 4288 | if (cbm_build_qoder_hook_command(binary_path, cbm_current_platform_is_windows(), command, |
| 4289 | sizeof(command), shell, sizeof(shell)) != CLI_OK) { |
| 4290 | return CLI_ERR; |
| 4291 | } |
| 4292 | int legacy_result = remove_hooks_json((hooks_remove_args_t){ |
| 4293 | .settings_path = settings_path, |
| 4294 | .hook_event = "UserPromptSubmit", |
| 4295 | .match_command_exact = command, |
| 4296 | }); |
| 4297 | int session_result = remove_hooks_json((hooks_remove_args_t){ |
| 4298 | .settings_path = settings_path, |
| 4299 | .hook_event = "SessionStart", |
| 4300 | .matcher_str = "startup|resume|clear|compact|new", |
| 4301 | .match_command_exact = command, |
| 4302 | }); |
| 4303 | int subagent_result = remove_hooks_json((hooks_remove_args_t){ |
| 4304 | .settings_path = settings_path, |
| 4305 | .hook_event = "SubagentStart", |
| 4306 | .matcher_str = "*", |
| 4307 | .match_command_exact = command, |
| 4308 | }); |
| 4309 | int read_result = remove_hooks_json((hooks_remove_args_t){ |
| 4310 | .settings_path = settings_path, |
| 4311 | .hook_event = "PostToolUse", |
| 4312 | .matcher_str = "Read", |
| 4313 | .match_command_exact = command, |
| 4314 | }); |
| 4315 | return legacy_result == CLI_OK && session_result == CLI_OK && subagent_result == CLI_OK && |
| 4316 | read_result == CLI_OK |
| 4317 | ? CLI_OK |
| 4318 | : CLI_ERR; |
| 4319 | } |
| 4320 | |
| 4321 | #ifdef CBM_CLI_ENABLE_TEST_API |
| 4322 | int cbm_upsert_qoder_context_hooks_for_testing(const char *settings_path, const char *binary_path) { |
no test coverage detected