MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_upsert_factory_hooks

Function cbm_upsert_factory_hooks

src/cli/cli.c:5706–5734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5704}
5705
5706static int cbm_upsert_factory_hooks(const char *settings_path, const char *binary_path) {
5707 char command[CLI_BUF_8K];
5708 char released_command[CLI_BUF_8K];
5709 if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) !=
5710 CLI_OK ||
5711 cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) !=
5712 CLI_OK) {
5713 return CLI_ERR;
5714 }
5715 const char *const old_commands[] = {released_command, NULL};
5716 int session_result = upsert_hooks_json((hooks_upsert_args_t){
5717 .settings_path = settings_path,
5718 .hook_event = "SessionStart",
5719 .matcher_str = NULL,
5720 .command_str = command,
5721 .old_commands = old_commands,
5722 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5723 .match_command_exact = command,
5724 });
5725 int read_result = upsert_hooks_json((hooks_upsert_args_t){
5726 .settings_path = settings_path,
5727 .hook_event = "PostToolUse",
5728 .matcher_str = "Read",
5729 .command_str = command,
5730 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5731 .match_command_exact = command,
5732 });
5733 return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR;
5734}
5735
5736static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) {
5737 char command[CLI_BUF_8K];

Callers 1

Calls 3

upsert_hooks_jsonFunction · 0.85

Tested by

no test coverage detected