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

Function cbm_upsert_factory_hooks

src/cli/cli.c:6537–6565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6535}
6536
6537static int cbm_upsert_factory_hooks(const char *settings_path, const char *binary_path) {
6538 char command[CLI_BUF_8K];
6539 char released_command[CLI_BUF_8K];
6540 if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) !=
6541 CLI_OK ||
6542 cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) !=
6543 CLI_OK) {
6544 return CLI_ERR;
6545 }
6546 const char *const old_commands[] = {released_command, NULL};
6547 int session_result = upsert_hooks_json((hooks_upsert_args_t){
6548 .settings_path = settings_path,
6549 .hook_event = "SessionStart",
6550 .matcher_str = NULL,
6551 .command_str = command,
6552 .old_commands = old_commands,
6553 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
6554 .match_command_exact = command,
6555 });
6556 int read_result = upsert_hooks_json((hooks_upsert_args_t){
6557 .settings_path = settings_path,
6558 .hook_event = "PostToolUse",
6559 .matcher_str = "Read",
6560 .command_str = command,
6561 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
6562 .match_command_exact = command,
6563 });
6564 return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR;
6565}
6566
6567static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) {
6568 char command[CLI_BUF_8K];

Callers 1

Calls 3

upsert_hooks_jsonFunction · 0.85

Tested by

no test coverage detected