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

Function cbm_upsert_factory_hooks

src/cli/cli.c:5870–5898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5868}
5869
5870static int cbm_upsert_factory_hooks(const char *settings_path, const char *binary_path) {
5871 char command[CLI_BUF_8K];
5872 char released_command[CLI_BUF_8K];
5873 if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) !=
5874 CLI_OK ||
5875 cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) !=
5876 CLI_OK) {
5877 return CLI_ERR;
5878 }
5879 const char *const old_commands[] = {released_command, NULL};
5880 int session_result = upsert_hooks_json((hooks_upsert_args_t){
5881 .settings_path = settings_path,
5882 .hook_event = "SessionStart",
5883 .matcher_str = NULL,
5884 .command_str = command,
5885 .old_commands = old_commands,
5886 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5887 .match_command_exact = command,
5888 });
5889 int read_result = upsert_hooks_json((hooks_upsert_args_t){
5890 .settings_path = settings_path,
5891 .hook_event = "PostToolUse",
5892 .matcher_str = "Read",
5893 .command_str = command,
5894 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5895 .match_command_exact = command,
5896 });
5897 return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR;
5898}
5899
5900static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) {
5901 char command[CLI_BUF_8K];

Callers 1

Calls 3

upsert_hooks_jsonFunction · 0.85

Tested by

no test coverage detected