| 4607 | } |
| 4608 | |
| 4609 | static int cbm_edit_devin_context_hooks(const char *config_path, const char *binary_path, |
| 4610 | bool remove, bool include_session_start) { |
| 4611 | static const char *const events[] = {"SessionStart", "UserPromptSubmit", "PostCompaction"}; |
| 4612 | char command[CLI_BUF_8K]; |
| 4613 | if (cbm_build_augment_dialect_command(binary_path, "devin", command, sizeof(command)) != |
| 4614 | CLI_OK) { |
| 4615 | return CLI_ERR; |
| 4616 | } |
| 4617 | int result = CLI_OK; |
| 4618 | size_t first_event = include_session_start ? 0U : 1U; |
| 4619 | for (size_t i = first_event; i < sizeof(events) / sizeof(events[0]); i++) { |
| 4620 | int event_result = remove ? remove_hooks_json((hooks_remove_args_t){ |
| 4621 | .settings_path = config_path, |
| 4622 | .hook_event = events[i], |
| 4623 | .match_command_exact = command, |
| 4624 | }) |
| 4625 | : upsert_hooks_json((hooks_upsert_args_t){ |
| 4626 | .settings_path = config_path, |
| 4627 | .hook_event = events[i], |
| 4628 | .command_str = command, |
| 4629 | .timeout_value = CMM_HOOK_TIMEOUT_SEC, |
| 4630 | .match_command_exact = command, |
| 4631 | }); |
| 4632 | if (event_result != CLI_OK) { |
| 4633 | result = CLI_ERR; |
| 4634 | } |
| 4635 | } |
| 4636 | return result; |
| 4637 | } |
| 4638 | |
| 4639 | static int cbm_upsert_devin_context_hooks(const char *config_path, const char *binary_path, |
| 4640 | bool include_session_start) { |
no test coverage detected