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

Function cbm_upsert_factory_hooks

src/cli/cli.c:5650–5678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5648}
5649
5650static int cbm_upsert_factory_hooks(const char *settings_path, const char *binary_path) {
5651 char command[CLI_BUF_8K];
5652 char released_command[CLI_BUF_8K];
5653 if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) !=
5654 CLI_OK ||
5655 cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) !=
5656 CLI_OK) {
5657 return CLI_ERR;
5658 }
5659 const char *const old_commands[] = {released_command, NULL};
5660 int session_result = upsert_hooks_json((hooks_upsert_args_t){
5661 .settings_path = settings_path,
5662 .hook_event = "SessionStart",
5663 .matcher_str = NULL,
5664 .command_str = command,
5665 .old_commands = old_commands,
5666 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5667 .match_command_exact = command,
5668 });
5669 int read_result = upsert_hooks_json((hooks_upsert_args_t){
5670 .settings_path = settings_path,
5671 .hook_event = "PostToolUse",
5672 .matcher_str = "Read",
5673 .command_str = command,
5674 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5675 .match_command_exact = command,
5676 });
5677 return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR;
5678}
5679
5680static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) {
5681 char command[CLI_BUF_8K];

Callers 1

Calls 3

upsert_hooks_jsonFunction · 0.85

Tested by

no test coverage detected