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

Function cbm_upsert_factory_hooks

src/cli/cli.c:6405–6433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6403}
6404
6405static int cbm_upsert_factory_hooks(const char *settings_path, const char *binary_path) {
6406 char command[CLI_BUF_8K];
6407 char released_command[CLI_BUF_8K];
6408 if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) !=
6409 CLI_OK ||
6410 cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) !=
6411 CLI_OK) {
6412 return CLI_ERR;
6413 }
6414 const char *const old_commands[] = {released_command, NULL};
6415 int session_result = upsert_hooks_json((hooks_upsert_args_t){
6416 .settings_path = settings_path,
6417 .hook_event = "SessionStart",
6418 .matcher_str = NULL,
6419 .command_str = command,
6420 .old_commands = old_commands,
6421 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
6422 .match_command_exact = command,
6423 });
6424 int read_result = upsert_hooks_json((hooks_upsert_args_t){
6425 .settings_path = settings_path,
6426 .hook_event = "PostToolUse",
6427 .matcher_str = "Read",
6428 .command_str = command,
6429 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
6430 .match_command_exact = command,
6431 });
6432 return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR;
6433}
6434
6435static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) {
6436 char command[CLI_BUF_8K];

Callers 1

Calls 3

upsert_hooks_jsonFunction · 0.85

Tested by

no test coverage detected