| 4387 | } |
| 4388 | |
| 4389 | static int cbm_edit_devin_context_hooks(const char *config_path, const char *binary_path, |
| 4390 | bool remove, bool include_session_start) { |
| 4391 | static const char *const events[] = {"SessionStart", "UserPromptSubmit", "PostCompaction"}; |
| 4392 | char command[CLI_BUF_8K]; |
| 4393 | if (cbm_build_augment_dialect_command(binary_path, "devin", command, sizeof(command)) != |
| 4394 | CLI_OK) { |
| 4395 | return CLI_ERR; |
| 4396 | } |
| 4397 | int result = CLI_OK; |
| 4398 | size_t first_event = include_session_start ? 0U : 1U; |
| 4399 | for (size_t i = first_event; i < sizeof(events) / sizeof(events[0]); i++) { |
| 4400 | int event_result = remove ? remove_hooks_json((hooks_remove_args_t){ |
| 4401 | .settings_path = config_path, |
| 4402 | .hook_event = events[i], |
| 4403 | .match_command_exact = command, |
| 4404 | }) |
| 4405 | : upsert_hooks_json((hooks_upsert_args_t){ |
| 4406 | .settings_path = config_path, |
| 4407 | .hook_event = events[i], |
| 4408 | .command_str = command, |
| 4409 | .timeout_value = CMM_HOOK_TIMEOUT_SEC, |
| 4410 | .match_command_exact = command, |
| 4411 | }); |
| 4412 | if (event_result != CLI_OK) { |
| 4413 | result = CLI_ERR; |
| 4414 | } |
| 4415 | } |
| 4416 | return result; |
| 4417 | } |
| 4418 | |
| 4419 | static int cbm_upsert_devin_context_hooks(const char *config_path, const char *binary_path, |
| 4420 | bool include_session_start) { |
no test coverage detected