| 4443 | } |
| 4444 | |
| 4445 | static int cbm_edit_devin_context_hooks(const char *config_path, const char *binary_path, |
| 4446 | bool remove, bool include_session_start) { |
| 4447 | static const char *const events[] = {"SessionStart", "UserPromptSubmit", "PostCompaction"}; |
| 4448 | char command[CLI_BUF_8K]; |
| 4449 | if (cbm_build_augment_dialect_command(binary_path, "devin", command, sizeof(command)) != |
| 4450 | CLI_OK) { |
| 4451 | return CLI_ERR; |
| 4452 | } |
| 4453 | int result = CLI_OK; |
| 4454 | size_t first_event = include_session_start ? 0U : 1U; |
| 4455 | for (size_t i = first_event; i < sizeof(events) / sizeof(events[0]); i++) { |
| 4456 | int event_result = remove ? remove_hooks_json((hooks_remove_args_t){ |
| 4457 | .settings_path = config_path, |
| 4458 | .hook_event = events[i], |
| 4459 | .match_command_exact = command, |
| 4460 | }) |
| 4461 | : upsert_hooks_json((hooks_upsert_args_t){ |
| 4462 | .settings_path = config_path, |
| 4463 | .hook_event = events[i], |
| 4464 | .command_str = command, |
| 4465 | .timeout_value = CMM_HOOK_TIMEOUT_SEC, |
| 4466 | .match_command_exact = command, |
| 4467 | }); |
| 4468 | if (event_result != CLI_OK) { |
| 4469 | result = CLI_ERR; |
| 4470 | } |
| 4471 | } |
| 4472 | return result; |
| 4473 | } |
| 4474 | |
| 4475 | static int cbm_upsert_devin_context_hooks(const char *config_path, const char *binary_path, |
| 4476 | bool include_session_start) { |
no test coverage detected