| 5148 | } |
| 5149 | |
| 5150 | static int cbm_edit_devin_context_hooks(const char *config_path, const char *binary_path, |
| 5151 | bool remove, bool include_session_start) { |
| 5152 | static const char *const events[] = {"SessionStart", "UserPromptSubmit", "PostCompaction"}; |
| 5153 | char command[CLI_BUF_8K]; |
| 5154 | if (cbm_build_augment_dialect_command(binary_path, "devin", command, sizeof(command)) != |
| 5155 | CLI_OK) { |
| 5156 | return CLI_ERR; |
| 5157 | } |
| 5158 | int result = CLI_OK; |
| 5159 | size_t first_event = include_session_start ? 0U : 1U; |
| 5160 | for (size_t i = first_event; i < sizeof(events) / sizeof(events[0]); i++) { |
| 5161 | int event_result = remove ? remove_hooks_json((hooks_remove_args_t){ |
| 5162 | .settings_path = config_path, |
| 5163 | .hook_event = events[i], |
| 5164 | .match_command_exact = command, |
| 5165 | }) |
| 5166 | : upsert_hooks_json((hooks_upsert_args_t){ |
| 5167 | .settings_path = config_path, |
| 5168 | .hook_event = events[i], |
| 5169 | .command_str = command, |
| 5170 | .timeout_value = CMM_HOOK_TIMEOUT_SEC, |
| 5171 | .match_command_exact = command, |
| 5172 | }); |
| 5173 | if (event_result != CLI_OK) { |
| 5174 | result = CLI_ERR; |
| 5175 | } |
| 5176 | } |
| 5177 | return result; |
| 5178 | } |
| 5179 | |
| 5180 | static int cbm_upsert_devin_context_hooks(const char *config_path, const char *binary_path, |
| 5181 | bool include_session_start) { |
no test coverage detected